aboutsummaryrefslogtreecommitdiffstats
path: root/WireGuard/WireGuard/Tunnel
diff options
context:
space:
mode:
authorRoopesh Chander <roop@roopc.net>2019-02-27 13:30:57 +0530
committerJason A. Donenfeld <Jason@zx2c4.com>2019-03-18 06:46:55 +0100
commit5941bf181cc37368cfff5e1d92398bce6c7b8a5e (patch)
tree8375b2e35e3544512c25accedf2adb63ceea7346 /WireGuard/WireGuard/Tunnel
parenton-demand: Introducing ActivateOnDemandViewModel (diff)
downloadwireguard-apple-5941bf181cc37368cfff5e1d92398bce6c7b8a5e.tar.xz
wireguard-apple-5941bf181cc37368cfff5e1d92398bce6c7b8a5e.zip
on-demand: iOS: Support for SSIDs
Signed-off-by: Roopesh Chander <roop@roopc.net>
Diffstat (limited to 'WireGuard/WireGuard/Tunnel')
-rw-r--r--WireGuard/WireGuard/Tunnel/ActivateOnDemandSetting.swift10
1 files changed, 10 insertions, 0 deletions
diff --git a/WireGuard/WireGuard/Tunnel/ActivateOnDemandSetting.swift b/WireGuard/WireGuard/Tunnel/ActivateOnDemandSetting.swift
index 28612c70..89edd777 100644
--- a/WireGuard/WireGuard/Tunnel/ActivateOnDemandSetting.swift
+++ b/WireGuard/WireGuard/Tunnel/ActivateOnDemandSetting.swift
@@ -132,3 +132,13 @@ private func ssidOnDemandRules(option: ActivateOnDemandSSIDOption) -> [NEOnDeman
NEOnDemandRuleConnect(interfaceType: .wiFi)]
}
}
+
+extension ActivateOnDemandSetting {
+ init(with option: ActivateOnDemandOption) {
+ if option == .none {
+ self = ActivateOnDemandSetting(isActivateOnDemandEnabled: false, activateOnDemandOption: option)
+ } else {
+ self = ActivateOnDemandSetting(isActivateOnDemandEnabled: true, activateOnDemandOption: option)
+ }
+ }
+}