TunnelsManager: If only Activate On Demand has changed, don't restart tunnel
Signed-off-by: Roopesh Chander <roop@roopc.net>
This commit is contained in:
@@ -37,4 +37,10 @@ extension NETunnelProviderProtocol {
|
||||
var isActivateOnDemandEnabled: Bool {
|
||||
return (providerConfiguration?["isActivateOnDemandEnabled"] as? Bool) ?? false
|
||||
}
|
||||
|
||||
func hasTunnelConfiguration(tunnelConfiguration otherTunnelConfiguration: TunnelConfiguration) -> Bool {
|
||||
guard let serializedThisTunnelConfiguration = providerConfiguration?["tunnelConfiguration"] as? Data else { return false }
|
||||
guard let serializedOtherTunnelConfiguration = try? JSONEncoder().encode(otherTunnelConfiguration) else { return false }
|
||||
return serializedThisTunnelConfiguration == serializedOtherTunnelConfiguration
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user