mirror of
https://github.com/shadowsocks/ShadowsocksX-NG.git
synced 2026-11-02 16:53:45 +00:00
The root system-proxy helper logged nothing and launchd discards its stdout/stderr, leaving helper launches, connection refusals, GUI-side timeouts and root-side failures invisible. Share the minimal unified-log emission unit (SystemLog) across GUI, wrapper and helper, and add a dedicated closed helper event enum (lifecycle minimum: listener ready, connection accepted/rejected with peer pid, typed apply/clear results) with ADR-0045 privacy splitting. The emission seam is injected at the helper engine and listener for test doubles. Helper events are Console-only: no stderr, no agent.log, no diagnostic view or report surface (ADR-0047).
15 lines
722 B
Swift
15 lines
722 B
Swift
import Foundation
|
||
|
||
// 特权系统代理 helper 入口:随 app 打包、经 SMAppService.daemon
|
||
// 注册的 on-demand LaunchDaemon。launchd 以 MachServices 键按需拉起本进程,
|
||
// GUI 侧每次连接到固定 MachService 名即触发激活。
|
||
let delegate = SystemProxyHelperListenerDelegate(
|
||
engine: SystemProxyHelperEngine(perform: SystemProxyWriter.perform))
|
||
let listener = NSXPCListener(machServiceName: SystemProxyHelperIdentity.machServiceName)
|
||
listener.delegate = delegate
|
||
listener.resume()
|
||
// 拉起就绪事件只进统一日志(ADR-0047):launchd 丢弃本进程 stdout/stderr,
|
||
// 这是「helper 是否被拉起」的唯一痕迹。
|
||
SystemProxyHelperLog.emit(.listenerReady)
|
||
dispatchMain()
|