Files
ShadowsocksX-NG/ShadowsocksX-NG2/SystemProxyHelper/main.swift
Qiu Yuzhou 94ef128db8 feat(system-proxy): emit privileged helper events to unified log
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).
2026-10-20 15:59:38 +08:00

15 lines
722 B
Swift
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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()