Files
ShadowsocksX-NG/ShadowsocksX-NG2/Agent/AgentPaths.swift
T
Qiu Yuzhou 8aedf8c42e perf(acl): per-variant ACL files behind a stable active link
Stop rewriting the whole ACL on every proxy-mode switch: materialize one
file per routing shape (acl-<summary>.ini), keep acl-active.ini as a stable
symlink the contract points at, and skip unchanged writes via a digest
manifest. The contract carries only path/summary/sha256 — the agent checks
the link stays inside the runtime directory and never reads ACL bytes.

Agent switch now defaults to off (no server config on a fresh install) and
survives preferences reset, which also returns any held system proxy and
converges a still-running agent onto the factory runtime. See ADR-0011.
2026-09-27 03:14:38 +08:00

29 lines
978 B
Swift

import Foundation
// MARK: - 进程级路径与环境(测试缝经 SSXNG_* 环境变量覆盖)
let environment = ProcessInfo.processInfo.environment
let contractURL: URL =
environment["SSXNG_CONTRACT_PATH"].map { URL(fileURLWithPath: $0) }
?? RuntimePaths.runtimeFileURL()
let sslocalURL: URL =
environment["SSXNG_SSLOCAL_PATH"].map { URL(fileURLWithPath: $0) }
?? Bundle.main.bundleURL.appendingPathComponent("Contents/Helpers/sslocal")
let runtimeDirectoryOverride: URL? = environment["SSXNG_RUNTIME_DIR"].map {
URL(fileURLWithPath: $0, isDirectory: true)
}
let aclFileURL: URL =
runtimeDirectoryOverride?.appendingPathComponent("acl-active.ini")
?? RuntimePaths.aclFileURL()
let pidFileURL: URL =
runtimeDirectoryOverride?.appendingPathComponent("agent.pid") ?? RuntimePaths.agentPIDFileURL()
let runtimeStatusFileURL: URL =
runtimeDirectoryOverride?.appendingPathComponent("agent-runtime-status.json")
?? RuntimePaths.agentRuntimeStatusURL()