Fix VPN internet connectivity and simplify client setup
Initialize Android physical interfaces and preserve macOS scoped routes. Add redacted diagnostics, default DNS, ordered auto-save, simplified controls, scanner rotation settings, and native regression coverage. Restore vendored build sources and document validation and stability checks.
This commit is contained in:
@@ -60,11 +60,13 @@ func registryContext(ctx context.Context) context.Context {
|
||||
}
|
||||
|
||||
type Snapshot struct {
|
||||
State string `json:"state"`
|
||||
Version string `json:"version"`
|
||||
State string `json:"state"`
|
||||
Version string `json:"version"`
|
||||
RuntimeEvents []RuntimeEvent `json:"runtime_events,omitempty"`
|
||||
}
|
||||
|
||||
type Engine struct {
|
||||
runtimeLogs runtimeLogs
|
||||
selfTestTrace bool
|
||||
startupCause error // Private diagnostic for package tests; never returned over ABI.
|
||||
// Protector must be installed before starting a host TUN.
|
||||
@@ -89,7 +91,7 @@ func (e *Engine) Snapshot() Snapshot {
|
||||
if state == "Running" && e.ctx.Err() != nil {
|
||||
state = "Failed"
|
||||
}
|
||||
return Snapshot{State: state, Version: "1.14.3"}
|
||||
return Snapshot{State: state, Version: "1.14.3", RuntimeEvents: e.runtimeLogs.snapshot()}
|
||||
}
|
||||
|
||||
func (e *Engine) Start(parent context.Context, config Config) error {
|
||||
@@ -135,7 +137,7 @@ func (e *Engine) Start(parent context.Context, config Config) error {
|
||||
if err != nil {
|
||||
cancel()
|
||||
e.state = "Failed"
|
||||
return errors.New("invalid managed engine configuration")
|
||||
return startupFailure("decode_configuration", err)
|
||||
}
|
||||
if config.FakeIP || len(config.RuleSets) > 0 {
|
||||
if e.cacheDir == "" {
|
||||
@@ -148,19 +150,26 @@ func (e *Engine) Start(parent context.Context, config Config) error {
|
||||
}
|
||||
options.Experimental = &option.ExperimentalOptions{CacheFile: &option.CacheFileOptions{Enabled: true, Path: filepath.Join(e.cacheDir, "fakeip.db"), StoreFakeIP: config.FakeIP}}
|
||||
}
|
||||
e.runtimeLogs.configure(config.Proxy)
|
||||
// Collect bounded, credential-redacted warning/error events in memory.
|
||||
// Raw upstream logs must never go to stderr or a user's log file.
|
||||
if !e.selfTestTrace {
|
||||
options.Log = &option.LogOptions{Level: "warn", Output: os.DevNull}
|
||||
}
|
||||
instance, err := box.New(box.Options{Options: options, Context: ctx})
|
||||
if err != nil {
|
||||
e.startupCause = err
|
||||
cancel()
|
||||
e.state = "Failed"
|
||||
return errors.New("cannot initialize proxy engine")
|
||||
return startupFailure("initialize_engine", err)
|
||||
}
|
||||
instance.LogFactory().AttachPlatformWriter(&e.runtimeLogs)
|
||||
if err = instance.Start(); err != nil {
|
||||
e.startupCause = err
|
||||
_ = instance.Close()
|
||||
cancel()
|
||||
e.state = "Failed"
|
||||
return errors.New("cannot start proxy engine")
|
||||
return startupFailure("start_engine", err)
|
||||
}
|
||||
e.box, e.cancel, e.ctx, e.state = instance, cancel, ctx, "Running"
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user