mirror of
https://github.com/shadowsocks/ShadowsocksX-NG.git
synced 2026-10-31 06:33:44 +00:00
fix(rules-smoke): adapt smoke fixtures to sourceless ProxyRule
fcd5645「slim built-in snapshots」移除了 ProxyRule 的 source 字段后 Smoke target 未同步,构造器多传 source: 导致冒烟编译失败(先于收敛脊柱重构就 存在的破损)。移除冒烟夹具中的 source 实参与不再使用的 RuleSourceIdentity 局部值;来源身份属于浏览集合层,运行时文档与 ACL 只消费 action+match, 夹具语义不变。
This commit is contained in:
@@ -99,9 +99,7 @@ extension RealSslocalSmokeTests {
|
||||
socksPort: selectedPorts[0], httpPort: selectedPorts[1])
|
||||
let chinaRules = [
|
||||
ProxyRule(
|
||||
action: .direct, match: try RuleMatch(nationalDomainSuffix: "cn"),
|
||||
source: RuleSourceIdentity(
|
||||
kind: .geolocationCN, upstreamVersion: "test", label: "geolocation-cn"))
|
||||
action: .direct, match: try RuleMatch(nationalDomainSuffix: "cn"))
|
||||
]
|
||||
let document = SslocalRuntimeDocument(
|
||||
servers: [
|
||||
@@ -176,17 +174,11 @@ extension RealSslocalSmokeTests {
|
||||
/// issue #64 冒烟夹具:`.cn` 域名 + 测试用 `8.8.8.0/24` CIDR 直连候选
|
||||
/// (仅验证命中/未命中路由,不代表真实中国 IP 归属)。
|
||||
private func chinaCIDRSmokeRules() throws -> [ProxyRule] {
|
||||
let domainSource = RuleSourceIdentity(
|
||||
kind: .geolocationCN, upstreamVersion: "test", label: "geolocation-cn")
|
||||
let cidrSource = RuleSourceIdentity(
|
||||
kind: .chinaIPv4, upstreamVersion: "test", label: "china-operator-ip")
|
||||
return [
|
||||
ProxyRule(
|
||||
action: .direct, match: try RuleMatch(nationalDomainSuffix: "cn"),
|
||||
source: domainSource),
|
||||
action: .direct, match: try RuleMatch(nationalDomainSuffix: "cn")),
|
||||
ProxyRule(
|
||||
action: .direct, match: try RuleMatch(ipv4CIDR: "8.8.8.0/24"),
|
||||
source: cidrSource),
|
||||
action: .direct, match: try RuleMatch(ipv4CIDR: "8.8.8.0/24")),
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
@@ -12,18 +12,13 @@ extension RealSslocalSmokeTests {
|
||||
let selectedPorts = try grabThreeListenPorts(excluding: [echoServer.port, fakeSSServer.port])
|
||||
let listen = SslocalListenSettings(
|
||||
socksPort: selectedPorts[0], httpPort: selectedPorts[1])
|
||||
let customSource = RuleSourceIdentity(
|
||||
kind: .custom, upstreamVersion: "user", label: "自定义")
|
||||
let customRules = [
|
||||
ProxyRule(
|
||||
action: .direct, match: try RuleMatch(domainSuffix: "direct.example"),
|
||||
source: customSource),
|
||||
action: .direct, match: try RuleMatch(domainSuffix: "direct.example")),
|
||||
ProxyRule(
|
||||
action: .direct, match: try RuleMatch(domainExact: "exact.direct.example"),
|
||||
source: customSource),
|
||||
action: .direct, match: try RuleMatch(domainExact: "exact.direct.example")),
|
||||
ProxyRule(
|
||||
action: .direct, match: try RuleMatch(ipv4CIDR: "203.0.113.0/24"),
|
||||
source: customSource),
|
||||
action: .direct, match: try RuleMatch(ipv4CIDR: "203.0.113.0/24")),
|
||||
]
|
||||
let document = SslocalRuntimeDocument(
|
||||
servers: [
|
||||
@@ -115,12 +110,9 @@ extension RealSslocalSmokeTests {
|
||||
let selectedPorts = try grabThreeListenPorts(excluding: [echoServer.port, fakeSSServer.port])
|
||||
let listen = SslocalListenSettings(
|
||||
socksPort: selectedPorts[0], httpPort: selectedPorts[1])
|
||||
let customSource = RuleSourceIdentity(
|
||||
kind: .custom, upstreamVersion: "user", label: "自定义")
|
||||
let customRules = [
|
||||
ProxyRule(
|
||||
action: .proxy, match: try RuleMatch(domainSuffix: "blocked.example"),
|
||||
source: customSource)
|
||||
action: .proxy, match: try RuleMatch(domainSuffix: "blocked.example"))
|
||||
]
|
||||
let document = SslocalRuntimeDocument(
|
||||
servers: [
|
||||
|
||||
@@ -12,15 +12,11 @@ extension RealSslocalSmokeTests {
|
||||
let selectedPorts = try grabThreeListenPorts(excluding: [echoServer.port, fakeSSServer.port])
|
||||
let listen = SslocalListenSettings(
|
||||
socksPort: selectedPorts[0], httpPort: selectedPorts[1])
|
||||
let gfwSource = RuleSourceIdentity(
|
||||
kind: .gfwlist, upstreamVersion: "test", label: "GFWList")
|
||||
let gfwRules = [
|
||||
ProxyRule(
|
||||
action: .proxy, match: try RuleMatch(domainSuffix: "blocked.example"),
|
||||
source: gfwSource),
|
||||
action: .proxy, match: try RuleMatch(domainSuffix: "blocked.example")),
|
||||
ProxyRule(
|
||||
action: .proxy, match: try RuleMatch(domainSuffix: "cdn.blocked.example"),
|
||||
source: gfwSource),
|
||||
action: .proxy, match: try RuleMatch(domainSuffix: "cdn.blocked.example")),
|
||||
]
|
||||
let document = SslocalRuntimeDocument(
|
||||
servers: [
|
||||
|
||||
Reference in New Issue
Block a user