From: Andrej Mihajlov Date: Fri, 11 Dec 2020 10:49:56 +0000 (+0100) Subject: WireGuardKit: Let wireguard-go backend run in offline on macOS X-Git-Tag: 1.0.10-18~14 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d414cec9aa57fdf1c4266c02e0f8e6d547543175;p=thirdparty%2Fwireguard-apple.git WireGuardKit: Let wireguard-go backend run in offline on macOS Signed-off-by: Andrej Mihajlov --- 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 } }