mirror of
https://github.com/shadowsocks/ShadowsocksX-NG.git
synced 2026-10-31 23:03:43 +00:00
6bfd3c0d35c9bd3787e69e004a637b3648a5e33f
GUI → LaunchAgent → wrapper → sslocal full chain (spec #21 D2/D5): - ShadowsocksX-NG2Agent: Swift BundleProgram tool target embedded at Contents/MacOS, supervised by launchd via SMAppService agent plist (Contents/Library/LaunchAgents, bundle-relative ProgramArguments, KeepAlive={SuccessfulExit:false}). Wrapper reads the cross-process contract v2/sslocal-active.json, spawns sslocal -c <absolute path> and supervises it: SIGTERM chain stop, SIGUSR1 forward for server-only changes vs graceful restart on listen fingerprint changes, non-zero exit on unexpected child loss for KeepAlive replay, invalid/missing contract → clean exit with plain unlink. - Runtime file protocol: RuntimeFileStore reuses AtomicFileWriter (0700 dir self-heal, 0600 temp at creation, atomic replace); explicit-stop cleanup unlinks contract, agent pid file and stale temporaries. Shared read-side validation via SslocalRuntimeDocument.decodeValidated so GUI and wrapper cannot drift. Wrapper pid file bridges SMAppService's missing pid. - GUI: ProxyRuntimeController consumes ActivationStateMachine effects through pure ProxyRuntimePlan decision table (ordered actions, idempotent skip of identical contract); proxy toggle and launch failure presentation (naming endpoint:port) in the status menu; launch resync reconciles agent registration, wrapper liveness and on-disk contract; catalog commits re-expand immediately. - Log sanitization baseline: closed RuntimeLogEvent enum plus Redactor, wrapper/sslocal output converged to a 0600 agent.log with RUST_LOG defaulting to warn. Tests (126 total, all green): stub-sslocal driven wrapper lifecycle (start/stop order, SIGTERM chain, crash replay, cleanup, reload protocol), real sslocal smoke (SOCKS port binding + full SOCKS5 handshake), plan decision table, controller flows with fakes, runtime file permissions/atomic replace, endpoint probe, redaction. Manual release-gate items (real launchd/SMAppService): agent registration approval flow, GUI-quit persistence, bootout behaviors. Closes #27
ShadowsocksX-NG
🚧 重新实现进行中 —— 本仓库正在使用现代技术栈重写 ShadowsocksX-NG macOS 客户端。
新工程不再通过 git 子模块在仓库内构建依赖,而是直接复制上游项目发布好的可执行文件,以简化构建流程。
目录结构
.
├── ShadowsocksX-NG2/ # 新工程:现代化重写版本(开发中)
└── Legacy/ # 旧版工程完整源码,仅供参考,不保证可构建
旧版工程的功能说明与使用文档见 Legacy/README.md。
Languages
Swift
95.8%
Python
2.5%
Shell
1.4%
C
0.3%