aboutsummaryrefslogtreecommitdiffstats
path: root/WireGuard/WireGuard
diff options
context:
space:
mode:
authorRoopesh Chander <roop@roopc.net>2019-02-12 17:43:40 +0530
committerRoopesh Chander <roop@roopc.net>2019-02-12 17:43:40 +0530
commit6331b81b5d253c9cbc3b3c64fc2f551bf44eea57 (patch)
tree50f8575b6f62e2b1726b41c1d14497b34f6ddceb /WireGuard/WireGuard
parentDon't migrate in asTunnelConfiguration() (diff)
downloadwireguard-apple-6331b81b5d253c9cbc3b3c64fc2f551bf44eea57.tar.xz
wireguard-apple-6331b81b5d253c9cbc3b3c64fc2f551bf44eea57.zip
Migrate when we notice a new tunnel in reload()
Signed-off-by: Roopesh Chander <roop@roopc.net>
Diffstat (limited to 'WireGuard/WireGuard')
-rw-r--r--WireGuard/WireGuard/Tunnel/TunnelsManager.swift5
1 files changed, 5 insertions, 0 deletions
diff --git a/WireGuard/WireGuard/Tunnel/TunnelsManager.swift b/WireGuard/WireGuard/Tunnel/TunnelsManager.swift
index fbfd81aa..ece1e721 100644
--- a/WireGuard/WireGuard/Tunnel/TunnelsManager.swift
+++ b/WireGuard/WireGuard/Tunnel/TunnelsManager.swift
@@ -83,6 +83,11 @@ class TunnelsManager {
matchingTunnel.refreshStatus()
} else {
// Tunnel was added outside the app
+ if let proto = loadedTunnelProvider.protocolConfiguration as? NETunnelProviderProtocol {
+ if proto.migrateConfigurationIfNeeded(called: loadedTunnelProvider.localizedDescription ?? "unknown") {
+ loadedTunnelProvider.saveToPreferences { _ in }
+ }
+ }
let tunnel = TunnelContainer(tunnel: loadedTunnelProvider)
self.tunnels.append(tunnel)
self.tunnels.sort { $0.name < $1.name }