diff --git a/Tun/Punchnet/Policy/IdentityRuleMap.swift b/Tun/Punchnet/Policy/PolicyRuleMap.swift similarity index 91% rename from Tun/Punchnet/Policy/IdentityRuleMap.swift rename to Tun/Punchnet/Policy/PolicyRuleMap.swift index a4224bb..0c3c99e 100644 --- a/Tun/Punchnet/Policy/IdentityRuleMap.swift +++ b/Tun/Punchnet/Policy/PolicyRuleMap.swift @@ -1,11 +1,11 @@ // -// RuleMap.swift +// PolicyRuleMap.swift // punchnet // // Created by 安礼成 on 2026/2/5. // -struct IdentityRuleMap { +struct PolicyRuleMap { let version: UInt32 // map[proto][port] let ruleMap: [UInt8: [UInt16: Bool]] diff --git a/Tun/Punchnet/Policy/PolicyRuleSnapshot.swift b/Tun/Punchnet/Policy/PolicyRuleSnapshot.swift index 22fc0b2..610859c 100644 --- a/Tun/Punchnet/Policy/PolicyRuleSnapshot.swift +++ b/Tun/Punchnet/Policy/PolicyRuleSnapshot.swift @@ -9,13 +9,13 @@ import Foundation final class PolicyRuleSnapshot: Snapshot { typealias IdentityID = UInt32 - private let ruleMapByIdentity: [IdentityID: IdentityRuleMap] + private let ruleMapByIdentity: [IdentityID: PolicyRuleMap] - init(ruleMapByIdentity: [IdentityID : IdentityRuleMap]) { + init(ruleMapByIdentity: [IdentityID : PolicyRuleMap]) { self.ruleMapByIdentity = ruleMapByIdentity } - func lookup(_ id: IdentityID) -> IdentityRuleMap? { + func lookup(_ id: IdentityID) -> PolicyRuleMap? { return self.ruleMapByIdentity[id] } diff --git a/Tun/Punchnet/Policy/PolicyRuleStore.swift b/Tun/Punchnet/Policy/PolicyRuleStore.swift index 493d65a..f96d245 100644 --- a/Tun/Punchnet/Policy/PolicyRuleStore.swift +++ b/Tun/Punchnet/Policy/PolicyRuleStore.swift @@ -19,7 +19,7 @@ actor PolicyRuleStore { nonisolated private let alloctor = ByteBufferAllocator() private let publisher: SnapshotPublisher - private var ruleMapByIdentity: [UInt32: IdentityRuleMap] = [:] + private var ruleMapByIdentity: [UInt32: PolicyRuleMap] = [:] init(publisher: SnapshotPublisher) { self.publisher = publisher @@ -74,7 +74,7 @@ actor PolicyRuleStore { } ruleMap[proto, default: [:]][port] = true } - self.ruleMapByIdentity[id] = IdentityRuleMap(version: version, ruleMap: ruleMap) + self.ruleMapByIdentity[id] = PolicyRuleMap(version: version, ruleMap: ruleMap) // 发布新的快照信息 let snapshot = compileSnapshot()