diff --git a/WireGuard/WireGuard/UI/iOS/TunnelDetailTableViewController.swift b/WireGuard/WireGuard/UI/iOS/TunnelDetailTableViewController.swift index 72df738..18f4610 100644 --- a/WireGuard/WireGuard/UI/iOS/TunnelDetailTableViewController.swift +++ b/WireGuard/WireGuard/UI/iOS/TunnelDetailTableViewController.swift @@ -152,9 +152,9 @@ extension TunnelDetailTableViewController { s.tunnelsManager.startActivation(of: s.tunnel) { [weak self] error in if let error = error { switch (error) { - case TunnelsManagerError.noEndpoint: + case TunnelActivationError.noEndpoint: self?.showErrorAlert(title: "Endpoint missing", message: "There must be at least one peer with an endpoint") - case TunnelsManagerError.dnsResolutionFailed: + case TunnelActivationError.dnsResolutionFailed: self?.showErrorAlert(title: "DNS Failure", message: "One or more endpoint domains could not be resolved") default: self?.showErrorAlert(title: "Internal error", message: "The tunnel could not be activated") diff --git a/WireGuard/WireGuard/UI/iOS/TunnelsListTableViewController.swift b/WireGuard/WireGuard/UI/iOS/TunnelsListTableViewController.swift index 9763b92..75c3687 100644 --- a/WireGuard/WireGuard/UI/iOS/TunnelsListTableViewController.swift +++ b/WireGuard/WireGuard/UI/iOS/TunnelsListTableViewController.swift @@ -246,9 +246,9 @@ extension TunnelsListTableViewController { tunnelsManager.startActivation(of: tunnel) { error in if let error = error { switch (error) { - case TunnelsManagerError.noEndpoint: + case TunnelActivationError.noEndpoint: self?.showErrorAlert(title: "Endpoint missing", message: "There must be at least one peer with an endpoint") - case TunnelsManagerError.dnsResolutionFailed: + case TunnelActivationError.dnsResolutionFailed: self?.showErrorAlert(title: "DNS Failure", message: "One or more endpoint domains could not be resolved") default: self?.showErrorAlert(title: "Internal error", message: "The tunnel could not be activated") diff --git a/WireGuard/WireGuard/VPN/TunnelsManager.swift b/WireGuard/WireGuard/VPN/TunnelsManager.swift index a9cc1ac..f620779 100644 --- a/WireGuard/WireGuard/VPN/TunnelsManager.swift +++ b/WireGuard/WireGuard/VPN/TunnelsManager.swift @@ -12,7 +12,7 @@ protocol TunnelsManagerDelegate: class { func tunnelRemoved(at: Int) } -enum TunnelsManagerError: Error { +enum TunnelActivationError: Error { case noEndpoint case dnsResolutionFailed case tunnelOperationFailed @@ -210,11 +210,11 @@ class TunnelsManager { func startActivation(of tunnel: TunnelContainer, completionHandler: @escaping (Error?) -> Void) { guard (tunnel.status == .inactive) else { - completionHandler(TunnelsManagerError.attemptingActivationWhenTunnelIsNotInactive) + completionHandler(TunnelActivationError.attemptingActivationWhenTunnelIsNotInactive) return } guard (currentTunnel == nil) else { - completionHandler(TunnelsManagerError.attemptingActivationWhenAnotherTunnelIsActive) + completionHandler(TunnelActivationError.attemptingActivationWhenAnotherTunnelIsActive) return } tunnel.startActivation(completionHandler: completionHandler) @@ -223,7 +223,7 @@ class TunnelsManager { func startDeactivation(of tunnel: TunnelContainer, completionHandler: @escaping (Error?) -> Void) { if (tunnel.status == .inactive) { - completionHandler(TunnelsManagerError.attemptingDeactivationWhenTunnelIsInactive) + completionHandler(TunnelActivationError.attemptingDeactivationWhenTunnelIsInactive) return } assert(tunnel.index == currentTunnel!.index) @@ -305,7 +305,7 @@ class TunnelContainer: NSObject { guard (endpoints.contains(where: { $0 != nil })) else { DispatchQueue.main.async { [weak self] in self?.status = .inactive - completionHandler(TunnelsManagerError.noEndpoint) + completionHandler(TunnelActivationError.noEndpoint) } return } @@ -328,7 +328,7 @@ class TunnelContainer: NSObject { s.dnsResolver = nil guard let resolvedEndpoints = resolvedEndpoints else { s.status = .inactive - completionHandler(TunnelsManagerError.dnsResolutionFailed) + completionHandler(TunnelActivationError.dnsResolutionFailed) return } s.startActivation(tunnelConfiguration: tunnelConfiguration,