aboutsummaryrefslogtreecommitdiffstats
path: root/WireGuard/WireGuard/Tunnel
diff options
context:
space:
mode:
authorRoopesh Chander <roop@roopc.net>2019-01-22 04:06:27 +0530
committerRoopesh Chander <roop@roopc.net>2019-01-22 04:06:37 +0530
commit273ee04450b776bb5456c75ef17caa2e9e5ed2e7 (patch)
tree722f2ed10ef9357a456561bd9552fe69d7316671 /WireGuard/WireGuard/Tunnel
parentmacOS: Tunnel edit: actually clean up error handling (diff)
downloadwireguard-apple-273ee04450b776bb5456c75ef17caa2e9e5ed2e7.tar.xz
wireguard-apple-273ee04450b776bb5456c75ef17caa2e9e5ed2e7.zip
Better os() directives
Signed-off-by: Roopesh Chander <roop@roopc.net>
Diffstat (limited to 'WireGuard/WireGuard/Tunnel')
-rw-r--r--WireGuard/WireGuard/Tunnel/ActivateOnDemandSetting.swift12
1 files changed, 9 insertions, 3 deletions
diff --git a/WireGuard/WireGuard/Tunnel/ActivateOnDemandSetting.swift b/WireGuard/WireGuard/Tunnel/ActivateOnDemandSetting.swift
index c89cce37..38359da4 100644
--- a/WireGuard/WireGuard/Tunnel/ActivateOnDemandSetting.swift
+++ b/WireGuard/WireGuard/Tunnel/ActivateOnDemandSetting.swift
@@ -14,9 +14,11 @@ enum ActivateOnDemandOption {
#if os(iOS)
case useOnDemandOverWiFiOrCellular
case useOnDemandOverCellularOnly
- #elseif os(OSX)
+ #elseif os(macOS)
case useOnDemandOverWiFiOrEthernet
case useOnDemandOverEthernetOnly
+ #else
+ #error("Unimplemented")
#endif
}
@@ -40,7 +42,7 @@ extension ActivateOnDemandSetting {
connectRule.interfaceTypeMatch = .cellular
disconnectRule.interfaceTypeMatch = .wiFi
rules = [connectRule, disconnectRule]
- #elseif os(OSX)
+ #elseif os(macOS)
case .useOnDemandOverWiFiOrEthernet:
rules = [connectRule]
case .useOnDemandOverWiFiOnly:
@@ -51,6 +53,8 @@ extension ActivateOnDemandSetting {
connectRule.interfaceTypeMatch = .ethernet
disconnectRule.interfaceTypeMatch = .wiFi
rules = [connectRule, disconnectRule]
+ #else
+ #error("Unimplemented")
#endif
}
tunnelProviderManager.onDemandRules = rules
@@ -62,10 +66,12 @@ extension ActivateOnDemandSetting {
let otherInterfaceType: NEOnDemandRuleInterfaceType = .cellular
let useWiFiOrOtherOption: ActivateOnDemandOption = .useOnDemandOverWiFiOrCellular
let useOtherOnlyOption: ActivateOnDemandOption = .useOnDemandOverCellularOnly
- #elseif os(OSX)
+ #elseif os(macOS)
let otherInterfaceType: NEOnDemandRuleInterfaceType = .ethernet
let useWiFiOrOtherOption: ActivateOnDemandOption = .useOnDemandOverWiFiOrEthernet
let useOtherOnlyOption: ActivateOnDemandOption = .useOnDemandOverEthernetOnly
+ #else
+ #error("Unimplemented")
#endif
let activateOnDemandOption: ActivateOnDemandOption
switch rules.count {