aboutsummaryrefslogtreecommitdiffstats
path: root/WireGuard/WireGuard/Tunnel
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2018-12-21 23:34:56 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2018-12-21 23:34:56 +0100
commit7b9d4cb9e35a88f13face71543ce4773102fe224 (patch)
tree90810e67570a1bd2b520f352b50117925d3b1fab /WireGuard/WireGuard/Tunnel
parentproviderConfiguration is now a WgQuickConfig (diff)
downloadwireguard-apple-7b9d4cb9e35a88f13face71543ce4773102fe224.tar.xz
wireguard-apple-7b9d4cb9e35a88f13face71543ce4773102fe224.zip
Nuke trailing spaces
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'WireGuard/WireGuard/Tunnel')
-rw-r--r--WireGuard/WireGuard/Tunnel/TunnelErrors.swift2
-rw-r--r--WireGuard/WireGuard/Tunnel/TunnelStatus.swift2
-rw-r--r--WireGuard/WireGuard/Tunnel/TunnelsManager.swift14
3 files changed, 9 insertions, 9 deletions
diff --git a/WireGuard/WireGuard/Tunnel/TunnelErrors.swift b/WireGuard/WireGuard/Tunnel/TunnelErrors.swift
index 9b2b574..77b0410 100644
--- a/WireGuard/WireGuard/Tunnel/TunnelErrors.swift
+++ b/WireGuard/WireGuard/Tunnel/TunnelErrors.swift
@@ -53,7 +53,7 @@ enum TunnelsManagerActivationAttemptError: WireGuardAppError {
enum TunnelsManagerActivationError: WireGuardAppError {
case activationFailed(wasOnDemandEnabled: Bool)
case activationFailedWithExtensionError(title: String, message: String, wasOnDemandEnabled: Bool)
-
+
var alertText: AlertText {
switch self {
case .activationFailed(let wasOnDemandEnabled):
diff --git a/WireGuard/WireGuard/Tunnel/TunnelStatus.swift b/WireGuard/WireGuard/Tunnel/TunnelStatus.swift
index 9f03417..cfa1307 100644
--- a/WireGuard/WireGuard/Tunnel/TunnelStatus.swift
+++ b/WireGuard/WireGuard/Tunnel/TunnelStatus.swift
@@ -12,7 +12,7 @@ import NetworkExtension
case reasserting // Not a possible state at present
case restarting // Restarting tunnel (done after saving modifications to an active tunnel)
case waiting // Waiting for another tunnel to be brought down
-
+
init(from systemStatus: NEVPNStatus) {
switch systemStatus {
case .connected:
diff --git a/WireGuard/WireGuard/Tunnel/TunnelsManager.swift b/WireGuard/WireGuard/Tunnel/TunnelsManager.swift
index 903dfad..5fa8e7e 100644
--- a/WireGuard/WireGuard/Tunnel/TunnelsManager.swift
+++ b/WireGuard/WireGuard/Tunnel/TunnelsManager.swift
@@ -41,7 +41,7 @@ class TunnelsManager {
completionHandler(.failure(TunnelsManagerError.systemErrorOnListingTunnels(systemError: error)))
return
}
-
+
let tunnelManagers = managers ?? []
tunnelManagers.forEach { tunnelManager in
if (tunnelManager.protocolConfiguration as? NETunnelProviderProtocol)?.migrateConfigurationIfNeeded() == true {
@@ -78,9 +78,9 @@ class TunnelsManager {
completionHandler(.failure(TunnelsManagerError.systemErrorOnAddTunnel(systemError: error!)))
return
}
-
+
guard let self = self else { return }
-
+
let tunnel = TunnelContainer(tunnel: tunnelProviderManager)
self.tunnels.append(tunnel)
self.tunnels.sort { $0.name < $1.name }
@@ -126,7 +126,7 @@ class TunnelsManager {
tunnelProviderManager.protocolConfiguration = NETunnelProviderProtocol(tunnelConfiguration: tunnelConfiguration)
tunnelProviderManager.localizedDescription = (tunnelConfiguration).interface.name
tunnelProviderManager.isEnabled = true
-
+
let isActivatingOnDemand = !tunnelProviderManager.isOnDemandEnabled && activateOnDemandSetting.isActivateOnDemandEnabled
activateOnDemandSetting.apply(on: tunnelProviderManager)
@@ -137,7 +137,7 @@ class TunnelsManager {
return
}
guard let self = self else { return }
-
+
if isNameChanged {
let oldIndex = self.tunnels.firstIndex(of: tunnel)!
self.tunnels.sort { $0.name < $1.name }
@@ -351,11 +351,11 @@ class TunnelContainer: NSObject {
var tunnelConfiguration: TunnelConfiguration? {
return (tunnelProvider.protocolConfiguration as? NETunnelProviderProtocol)?.tunnelConfiguration(name: tunnelProvider.localizedDescription)
}
-
+
var activateOnDemandSetting: ActivateOnDemandSetting {
return ActivateOnDemandSetting(from: tunnelProvider)
}
-
+
init(tunnel: NETunnelProviderManager) {
name = tunnel.localizedDescription ?? "Unnamed"
let status = TunnelStatus(from: tunnel.connection.status)