diff options
Diffstat (limited to 'Sources/WireGuardKit/WireGuardAdapter.swift')
-rw-r--r-- | Sources/WireGuardKit/WireGuardAdapter.swift | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/Sources/WireGuardKit/WireGuardAdapter.swift b/Sources/WireGuardKit/WireGuardAdapter.swift index f2e4040..6c2e956 100644 --- a/Sources/WireGuardKit/WireGuardAdapter.swift +++ b/Sources/WireGuardKit/WireGuardAdapter.swift @@ -152,10 +152,6 @@ public class WireGuardAdapter { return } - #if os(macOS) - wgEnableRoaming(true) - #endif - let networkMonitor = NWPathMonitor() networkMonitor.pathUpdateHandler = { [weak self] path in self?.didReceivePathUpdate(path: path) @@ -238,6 +234,9 @@ public class WireGuardAdapter { self.logEndpointResolutionResults(resolutionResults) wgSetConfig(handle, wgConfig) + #if os(iOS) + wgDisableSomeRoamingForBrokenMobileSemantics(handle) + #endif self.state = .started(handle, settingsGenerator) @@ -346,11 +345,13 @@ public class WireGuardAdapter { } let handle = wgTurnOn(wgConfig, tunnelFileDescriptor) - if handle >= 0 { - return handle - } else { + if handle < 0 { throw WireGuardAdapterError.startWireGuardBackend(handle) } + #if os(iOS) + wgDisableSomeRoamingForBrokenMobileSemantics(handle) + #endif + return handle } /// Resolves the hostnames in the given tunnel configuration and return settings generator. @@ -398,6 +399,7 @@ public class WireGuardAdapter { self.logEndpointResolutionResults(resolutionResults) wgSetConfig(handle, wgConfig) + wgDisableSomeRoamingForBrokenMobileSemantics(handle) wgBumpSockets(handle) } else { self.logHandler(.info, "Connectivity offline, pausing backend.") |