mirror of
https://github.com/shadowsocks/ShadowsocksX-NG.git
synced 2026-11-21 21:04:07 +00:00
Remove the PAC product feature entirely: PAC HTTP service, port, health probe, runtime extension, PAC URL system proxy projection, PAC rule editing, and GFWList URL settings. The product now exposes rule / global / direct modes only, all projected as a local SOCKS system-proxy target. First-run defaults are rule + proxyWhenUnmatched, agent on, system proxy off. Homepage and status menu share one ProxyControlSnapshot showing the three modes and rule sub-options. Manual servers, subscriptions, Legacy import, and independent SOCKS/HTTP inbounds are retained. Fix: include verbose in SslocalListenFingerprint so a verbose-only contract change restarts sslocal instead of leaving RUST_LOG stale. Revise CONTEXT.md vocabulary, ADR-0007, and ADR-0009. Record GFWList exception shadowing, IPv6 system-exception, DNS, and traffic-coverage boundaries. Add host acceptance evidence document. Closes #67
50 lines
1.8 KiB
Swift
50 lines
1.8 KiB
Swift
import Foundation
|
|
|
|
/// Pure projection of one SystemConfiguration Proxies dictionary. Keeping the
|
|
/// key mapping here makes the mutually exclusive enablement rules testable
|
|
/// without opening a real SCPreferences session. PAC projection is gone
|
|
/// (issue #67); the product writes a SOCKS target only.
|
|
enum SystemProxyPropertyList {
|
|
static let httpEnabled = "HTTPEnable"
|
|
static let httpsEnabled = "HTTPSEnable"
|
|
static let socksEnabled = "SOCKSEnable"
|
|
static let socksPort = "SOCKSPort"
|
|
static let socksProxy = "SOCKSProxy"
|
|
static let pacEnabled = "ProxyAutoConfigEnable"
|
|
static let pacURL = "ProxyAutoConfigURLString"
|
|
static let pacJavaScript = "ProxyAutoConfigJavaScript"
|
|
static let autoDiscoveryEnabled = "ProxyAutoDiscoveryEnable"
|
|
static let exceptionsList = "ExceptionsList"
|
|
|
|
static func applying(
|
|
_ configuration: SystemProxyConfiguration, to original: [String: Any]
|
|
) -> [String: Any] {
|
|
var dictionary = original
|
|
dictionary[httpEnabled] = 0
|
|
dictionary[httpsEnabled] = 0
|
|
dictionary[socksEnabled] = 0
|
|
// 仍然清掉 PAC/自动发现,确保与 SOCKS 目标互斥(D8)。
|
|
dictionary[pacEnabled] = 0
|
|
dictionary[autoDiscoveryEnabled] = 0
|
|
dictionary.removeValue(forKey: pacJavaScript)
|
|
dictionary.removeValue(forKey: pacURL)
|
|
|
|
switch configuration.target {
|
|
case .socks(let host, let port):
|
|
dictionary[socksEnabled] = 1
|
|
dictionary[socksProxy] = host
|
|
dictionary[socksPort] = port
|
|
}
|
|
if let exceptions = configuration.exceptions {
|
|
dictionary[exceptionsList] = exceptions
|
|
}
|
|
return dictionary
|
|
}
|
|
|
|
static func applying(
|
|
_ target: SystemProxyConfiguration.Target, to original: [String: Any]
|
|
) -> [String: Any] {
|
|
applying(SystemProxyConfiguration(target: target), to: original)
|
|
}
|
|
}
|