diff options
author | Andrej Mihajlov <and@mullvad.net> | 2020-12-11 11:49:56 +0100 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2020-12-11 11:56:05 +0100 |
commit | d414cec9aa57fdf1c4266c02e0f8e6d547543175 (patch) | |
tree | 6c8e7d4697c2c6591170aa5cfabccdb401853bf5 | |
parent | WireGuardApp: add CrowdIn syncer and run it (diff) | |
download | wireguard-apple-d414cec9aa57fdf1c4266c02e0f8e6d547543175.tar.xz wireguard-apple-d414cec9aa57fdf1c4266c02e0f8e6d547543175.zip |
WireGuardKit: Let wireguard-go backend run in offline on macOS
Signed-off-by: Andrej Mihajlov <and@mullvad.net>
-rw-r--r-- | Sources/WireGuardKit/WireGuardAdapter.swift | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/Sources/WireGuardKit/WireGuardAdapter.swift b/Sources/WireGuardKit/WireGuardAdapter.swift index bf885c2..f2e4040 100644 --- a/Sources/WireGuardKit/WireGuardAdapter.swift +++ b/Sources/WireGuardKit/WireGuardAdapter.swift @@ -386,16 +386,18 @@ public class WireGuardAdapter { private func didReceivePathUpdate(path: Network.NWPath) { self.logHandler(.debug, "Network change detected with \(path.status) route and interface order \(path.availableInterfaces)") + #if os(macOS) + if case .started(let handle, _) = self.state { + wgBumpSockets(handle) + } + #elseif os(iOS) switch self.state { case .started(let handle, let settingsGenerator): if path.status.isSatisfiable { - #if os(iOS) let (wgConfig, resolutionResults) = settingsGenerator.endpointUapiConfiguration() self.logEndpointResolutionResults(resolutionResults) wgSetConfig(handle, wgConfig) - #endif - wgBumpSockets(handle) } else { self.logHandler(.info, "Connectivity offline, pausing backend.") @@ -427,6 +429,9 @@ public class WireGuardAdapter { // no-op break } + #else + #error("Unsupported") + #endif } } |