aboutsummaryrefslogtreecommitdiffstats
path: root/WireGuard
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2019-01-22 13:09:38 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2019-01-22 13:11:28 +0100
commit668c4a475c2154aa14574b10c3c938877a8ae7d8 (patch)
tree0aad72577e0431cde213db49b1c0735ab0659711 /WireGuard
parentMacOS: StatusMenu: Properly localize menu title (diff)
downloadwireguard-apple-668c4a475c2154aa14574b10c3c938877a8ae7d8.tar.xz
wireguard-apple-668c4a475c2154aa14574b10c3c938877a8ae7d8.zip
macOS: remove mobile network tweeks
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'WireGuard')
-rw-r--r--WireGuard/WireGuardNetworkExtension/DNSResolver.swift6
-rw-r--r--WireGuard/WireGuardNetworkExtension/PacketTunnelProvider.swift11
2 files changed, 15 insertions, 2 deletions
diff --git a/WireGuard/WireGuardNetworkExtension/DNSResolver.swift b/WireGuard/WireGuardNetworkExtension/DNSResolver.swift
index f7a8f5b1..16b79093 100644
--- a/WireGuard/WireGuardNetworkExtension/DNSResolver.swift
+++ b/WireGuard/WireGuardNetworkExtension/DNSResolver.swift
@@ -107,6 +107,7 @@ class DNSResolver {
extension Endpoint {
func withReresolvedIP() -> Endpoint {
+ #if os(iOS)
var ret = self
let hostname: String
switch host {
@@ -148,5 +149,10 @@ extension Endpoint {
wg_log(.debug, message: "DNS64: mapped \(host) to itself.")
}
return ret
+ #elseif os(macOS)
+ return self
+ #else
+ #error("Unimplemented")
+ #endif
}
}
diff --git a/WireGuard/WireGuardNetworkExtension/PacketTunnelProvider.swift b/WireGuard/WireGuardNetworkExtension/PacketTunnelProvider.swift
index cfc3aedf..7c84491a 100644
--- a/WireGuard/WireGuardNetworkExtension/PacketTunnelProvider.swift
+++ b/WireGuard/WireGuardNetworkExtension/PacketTunnelProvider.swift
@@ -30,6 +30,9 @@ class PacketTunnelProvider: NEPacketTunnelProvider {
}
configureLogger()
+ #if os(macOS)
+ wgEnableRoaming(true)
+ #endif
wg_log(.info, message: "Starting tunnel from the " + (activationAttemptId == nil ? "OS directly, rather than the app" : "app"))
@@ -114,9 +117,13 @@ class PacketTunnelProvider: NEPacketTunnelProvider {
}
private func pathUpdate(path: Network.NWPath) {
- guard let handle = handle, let packetTunnelSettingsGenerator = packetTunnelSettingsGenerator else { return }
+ guard let handle = handle else { return }
wg_log(.debug, message: "Network change detected with \(path.status) route and interface order \(path.availableInterfaces)")
- _ = packetTunnelSettingsGenerator.endpointUapiConfiguration().withGoString { return wgSetConfig(handle, $0) }
+ #if os(iOS)
+ if let packetTunnelSettingsGenerator = packetTunnelSettingsGenerator {
+ _ = packetTunnelSettingsGenerator.endpointUapiConfiguration().withGoString { return wgSetConfig(handle, $0) }
+ }
+ #endif
var interfaces = path.availableInterfaces
if let ifname = ifname {
interfaces = interfaces.filter { $0.name != ifname }