aboutsummaryrefslogtreecommitdiffstats
path: root/WireGuard/WireGuard/Tunnel/ActivateOnDemandSetting.swift
diff options
context:
space:
mode:
Diffstat (limited to 'WireGuard/WireGuard/Tunnel/ActivateOnDemandSetting.swift')
-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)
+ }
+ }
+}