Publish reviewed history-free open-source snapshot (2026-10-12)
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
import Foundation
|
||||
|
||||
enum ConnectionAttemptDecision: Equatable {
|
||||
case retryNode
|
||||
case stop
|
||||
case revokeAuthorization
|
||||
}
|
||||
|
||||
enum ConnectionAttemptPolicy {
|
||||
static func decide(error: Error, hasAssignedNode: Bool) -> ConnectionAttemptDecision {
|
||||
if error is CancellationError { return .stop }
|
||||
if let failure = error as? UCVLError {
|
||||
switch failure {
|
||||
case .api(let status, _):
|
||||
return status == 401 || status == 403 ? .revokeAuthorization : .stop
|
||||
case .vpnPermission, .invalidConfiguration, .invalidResponse:
|
||||
// Permission, malformed local configuration and control-plane
|
||||
// failures must not mark every otherwise healthy node as failed.
|
||||
return .stop
|
||||
case .connection:
|
||||
break
|
||||
}
|
||||
}
|
||||
return hasAssignedNode ? .retryNode : .stop
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user