fix policy
This commit is contained in:
parent
3ab82a13b5
commit
082fb1547e
@ -261,7 +261,7 @@ extension SDLContextActor {
|
|||||||
await self.handleEvent(event: event)
|
await self.handleEvent(event: event)
|
||||||
case .policyReponse(let policyResponse):
|
case .policyReponse(let policyResponse):
|
||||||
// 处理权限的请求问题
|
// 处理权限的请求问题
|
||||||
await self.policyService.identifyStore.applyPolicyResponse(policyResponse)
|
await self.policyService.applyPolicyResponse(policyResponse)
|
||||||
case .arpResponse(let arpResponse):
|
case .arpResponse(let arpResponse):
|
||||||
SDLLogger.log("[SDLContext] get arp response: \(arpResponse)")
|
SDLLogger.log("[SDLContext] get arp response: \(arpResponse)")
|
||||||
await self.arpServer.handleArpResponse(arpResponse: arpResponse)
|
await self.arpServer.handleArpResponse(arpResponse: arpResponse)
|
||||||
|
|||||||
@ -101,10 +101,8 @@ extension SDLTunPacketRouter.RouteDecision {
|
|||||||
switch self {
|
switch self {
|
||||||
case .forwardToNextHop(_, _, _, let kind):
|
case .forwardToNextHop(_, _, _, let kind):
|
||||||
switch kind {
|
switch kind {
|
||||||
case .sameNetwork, .exitNode:
|
case .sameNetwork, .exitNode, .dnsExitNode:
|
||||||
return true
|
return true
|
||||||
case .dnsExitNode:
|
|
||||||
return false
|
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
return false
|
return false
|
||||||
|
|||||||
@ -80,6 +80,13 @@ actor IdentityStore {
|
|||||||
let snapshot = compileSnapshot()
|
let snapshot = compileSnapshot()
|
||||||
publisher.publish(snapshot)
|
publisher.publish(snapshot)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func clear() {
|
||||||
|
self.coolingDown.removeAll()
|
||||||
|
self.versions.removeAll()
|
||||||
|
self.identityMap.removeAll()
|
||||||
|
self.publisher.publish(IdentitySnapshot.empty())
|
||||||
|
}
|
||||||
|
|
||||||
private func compileSnapshot() -> IdentitySnapshot {
|
private func compileSnapshot() -> IdentitySnapshot {
|
||||||
return IdentitySnapshot(identityMap: identityMap)
|
return IdentitySnapshot(identityMap: identityMap)
|
||||||
|
|||||||
@ -68,9 +68,19 @@ actor PolicyService {
|
|||||||
await superService.send(type: .policyRequest, data: request)
|
await superService.send(type: .policyRequest, data: request)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func applyPolicyResponse(_ policyResponse: SDLPolicyResponse) async {
|
||||||
|
guard policyResponse.dstIdentityID == self.identityId else {
|
||||||
|
SDLLogger.log("[PolicyService] ignore policy response, dstIdentityID mismatch: \(policyResponse.dstIdentityID), expected: \(self.identityId)", for: .debug)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
await self.identifyStore.applyPolicyResponse(policyResponse)
|
||||||
|
}
|
||||||
|
|
||||||
func clear() {
|
func clear() async {
|
||||||
self.flowSessionManager.clear()
|
self.flowSessionManager.clear()
|
||||||
|
await self.identifyStore.clear()
|
||||||
}
|
}
|
||||||
|
|
||||||
deinit {
|
deinit {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user