How shadowsocks/shadowsocksx-ng works
ShadowsocksX-NG2 is a native macOS Shadowsocks client. Users manage server configurations and subscriptions, choose routing rules and proxy mode, activate a target, then the app derives a runtime configuration and supervises local SOCKS5/HTTP listeners; system proxy control is a separate effect. The graph also retains documented rule editing, connectivity checks, plugins, and diagnostic reporting. Several capabilities are represented at their exact enclosing directories because their implementations were not sampled; their links are documented in the README rather than inferred from module names.
Main entry points: ProxyRuntimeController.swift Runtime controller · CatalogWorkflow Catalog workflow · ActivationStateMachine.swift Target activation · main.swift Launch agent
Components 19
Server catalog
- Catalog workflow
ShadowsocksX-NG2/App/Application/CatalogWorkflow - Configuration catalog
ShadowsocksX-NG2/Domain/Catalog/ConfigurationCatalog.swift - Encrypted library
ShadowsocksX-NG2/Domain/Catalog/ServerLibraryStorage.swift - Subscriptions
ShadowsocksX-NG2/Domain/Subscription
Routing and plugins
- Target activation
ShadowsocksX-NG2/Domain/Activation/ActivationStateMachine.swift - Routing rules
ShadowsocksX-NG2/Domain/Rules - Plugin catalog
ShadowsocksX-NG2/Domain/Plugin/PluginCatalog.swift
Proxy runtime
- Runtime controller
ShadowsocksX-NG2/App/Application/ProxyRuntime/ProxyRuntimeController.swift - Runtime document
ShadowsocksX-NG2/Domain/Runtime/SslocalRuntimeDocument.swift - Runtime files
ShadowsocksX-NG2/Domain/Runtime/RuntimeFileStore.swift - Launch agent
ShadowsocksX-NG2/Agent/main.swift - Upstream sslocal
- Listener settings
ShadowsocksX-NG2/Domain/Runtime/ProxyListeningConfiguration.swift
System integration
- Menu bar app
ShadowsocksX-NG2/App/Composition/MainApp.swift - System proxy helper
ShadowsocksX-NG2/SystemProxyHelper/main.swift - Helper service client
ShadowsocksX-NG2/App/Application/Services/SystemProxyHelperService.swift
Connectivity and diagnostics
- Connectivity tests
ShadowsocksX-NG2/App/Application/Connectivity - Diagnostic reports
ShadowsocksX-NG2/Domain/Diagnostics/DiagnosticReport.swift
Other components
- Mac user
Connections 24
- Mac user → Menu bar app: uses
README.md - Menu bar app → Catalog workflow: manages
- Catalog workflow → Configuration catalog: edits
- Configuration catalog → Encrypted library: persists
ShadowsocksX-NG2/Domain/Catalog/ServerLibraryStorage.swift - Catalog workflow → Subscriptions: refreshes
README.md - Catalog workflow → Target activation: activates
- Target activation → Configuration catalog: expands target
ShadowsocksX-NG2/Domain/Activation/ActivationStateMachine.swift - Target activation → Plugin catalog: resolves plugins
ShadowsocksX-NG2/Domain/Activation/ActivationStateMachine.swift - Menu bar app → Runtime controller: controls proxy
- Runtime controller → Runtime document: deploys document
ShadowsocksX-NG2/App/Application/ProxyRuntime/ProxyRuntimeController+Commands.swift - Runtime controller → Listener settings: reads listener settings
ShadowsocksX-NG2/App/Application/ProxyRuntime/ProxyRuntimeController+SettingsSync.swift - Runtime controller → Routing rules: applies saved rules
ShadowsocksX-NG2/App/Application/ProxyRuntime/ProxyRuntimeController.swift - Runtime controller → Runtime files: writes runtime files
ShadowsocksX-NG2/App/Application/ProxyRuntime/ProxyRuntimeController.swift - Runtime controller → Launch agent: registers and signals
- Launch agent → Runtime files: reads contract
ShadowsocksX-NG2/Agent/main.swift - Launch agent → Upstream sslocal: supervises
ShadowsocksX-NG2/Agent/main.swift - Runtime document → Upstream sslocal: configures listeners
README.md - Listener settings → Runtime document: defines listeners
ShadowsocksX-NG2/Domain/Runtime/SslocalRuntimeDocument.swift - Runtime controller → Helper service client: requests system proxy
ShadowsocksX-NG2/App/Application/Services/SystemProxyHelperService.swift - Helper service client → System proxy helper: sends helper requests
ShadowsocksX-NG2/App/Application/Services/SystemProxyHelperService.swift - System proxy helper → Mac user: changes macOS proxy
README.md - Mac user → Routing rules: chooses routing mode
README.md - Mac user → Connectivity tests: tests latency
README.md - Mac user → Diagnostic reports: requests report
README.md