diff --git a/Tun/Punchnet/Policy/IdentityStore.swift b/Tun/Punchnet/Policy/PolicyRuleStore.swift similarity index 98% rename from Tun/Punchnet/Policy/IdentityStore.swift rename to Tun/Punchnet/Policy/PolicyRuleStore.swift index 170997a..a0a09f4 100644 --- a/Tun/Punchnet/Policy/IdentityStore.swift +++ b/Tun/Punchnet/Policy/PolicyRuleStore.swift @@ -1,5 +1,5 @@ // -// IdentityStore.swift +// PolicyRuleStore.swift // punchnet // 1. 需要增加规则基于轮训更新的逻辑 // Created by 安礼成 on 2026/2/5. @@ -7,7 +7,7 @@ import Foundation import NIO -actor IdentityStore { +actor PolicyRuleStore { // 处理权限的请求问题 nonisolated private let cooldown: Duration = .seconds(5) diff --git a/Tun/Punchnet/Policy/PolicyService.swift b/Tun/Punchnet/Policy/PolicyService.swift index 79faf26..ddd63b1 100644 --- a/Tun/Punchnet/Policy/PolicyService.swift +++ b/Tun/Punchnet/Policy/PolicyService.swift @@ -9,7 +9,7 @@ import Foundation actor PolicyService { // 处理权限控制 - private let identifyStore: IdentityStore + private let policyRuleStore: PolicyRuleStore nonisolated private let snapshotPublisher: SnapshotPublisher // Flow流会话管理, 过期时间为: 180秒 @@ -22,7 +22,7 @@ actor PolicyService { self.identityId = identityId // 权限控制 let snapshotPublisher = SnapshotPublisher(initial: IdentitySnapshot.empty()) - self.identifyStore = IdentityStore(publisher: snapshotPublisher) + self.policyRuleStore = PolicyRuleStore(publisher: snapshotPublisher) self.snapshotPublisher = snapshotPublisher } @@ -40,11 +40,11 @@ actor PolicyService { } func makePolicyRequest(srcIdentityID: UInt32) async -> Data? { - return await self.identifyStore.makePolicyRequest(srcIdentityId: srcIdentityID, dstIdentityId: self.identityId) + return await self.policyRuleStore.makePolicyRequest(srcIdentityId: srcIdentityID, dstIdentityId: self.identityId) } func updatePolicy(superServiceProxy: SDLSuperServiceProxy) async { - let requests = await self.identifyStore.makeBatchPolicyRequests(dstIdentityID: self.identityId) + let requests = await self.policyRuleStore.makeBatchPolicyRequests(dstIdentityID: self.identityId) for request in requests { await superServiceProxy.send(type: .policyRequest, data: request) } @@ -56,12 +56,12 @@ actor PolicyService { return } - await self.identifyStore.applyPolicyResponse(policyResponse) + await self.policyRuleStore.applyPolicyResponse(policyResponse) } func clear() async { self.flowSessionManager.clear() - await self.identifyStore.clear() + await self.policyRuleStore.clear() } deinit {