aboutsummaryrefslogtreecommitdiffstats
path: root/WireGuard/WireGuard/UI/TunnelViewModel.swift
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2018-12-22 01:55:42 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2018-12-22 01:55:42 +0100
commit41a4c6362a1440512a326805ddf8730c932c3b57 (patch)
tree1738066255cd0f2847ddc3c9448afdf7e87c6db5 /WireGuard/WireGuard/UI/TunnelViewModel.swift
parentMove model helpers to model directory (diff)
downloadwireguard-apple-41a4c6362a1440512a326805ddf8730c932c3b57.tar.xz
wireguard-apple-41a4c6362a1440512a326805ddf8730c932c3b57.zip
Attempt to strongly recommend things
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to '')
-rw-r--r--WireGuard/WireGuard/UI/TunnelViewModel.swift10
1 files changed, 6 insertions, 4 deletions
diff --git a/WireGuard/WireGuard/UI/TunnelViewModel.swift b/WireGuard/WireGuard/UI/TunnelViewModel.swift
index 0be3cb8..a981ef0 100644
--- a/WireGuard/WireGuard/UI/TunnelViewModel.swift
+++ b/WireGuard/WireGuard/UI/TunnelViewModel.swift
@@ -210,6 +210,7 @@ class TunnelViewModel {
// For exclude private IPs
private(set) var shouldAllowExcludePrivateIPsControl = false
+ private(set) var shouldStronglyRecommendDNS = false
private(set) var excludePrivateIPsValue = false
fileprivate var numberOfPeers = 0
@@ -344,15 +345,16 @@ class TunnelViewModel {
]
func updateExcludePrivateIPsFieldState() {
+ if scratchpad.isEmpty {
+ populateScratchpad()
+ }
+ let allowedIPStrings = Set<String>(scratchpad[.allowedIPs].splitToArray(trimmingCharacters: .whitespacesAndNewlines))
+ shouldStronglyRecommendDNS = allowedIPStrings.contains(TunnelViewModel.PeerData.ipv4DefaultRouteString) || allowedIPStrings.isSuperset(of: TunnelViewModel.PeerData.ipv4DefaultRouteModRFC1918String)
guard numberOfPeers == 1 else {
shouldAllowExcludePrivateIPsControl = false
excludePrivateIPsValue = false
return
}
- if scratchpad.isEmpty {
- populateScratchpad()
- }
- let allowedIPStrings = Set<String>(scratchpad[.allowedIPs].splitToArray(trimmingCharacters: .whitespacesAndNewlines))
if allowedIPStrings.contains(TunnelViewModel.PeerData.ipv4DefaultRouteString) {
shouldAllowExcludePrivateIPsControl = true
excludePrivateIPsValue = false