VPN: TunnelsManager: s/TunnelsManagerError/TunnelActivationError/g;
Signed-off-by: Roopesh Chander <roop@roopc.net>
This commit is contained in:
parent
0aab067a53
commit
dd33d74caf
|
@ -152,9 +152,9 @@ extension TunnelDetailTableViewController {
|
||||||
s.tunnelsManager.startActivation(of: s.tunnel) { [weak self] error in
|
s.tunnelsManager.startActivation(of: s.tunnel) { [weak self] error in
|
||||||
if let error = error {
|
if let error = error {
|
||||||
switch (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")
|
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")
|
self?.showErrorAlert(title: "DNS Failure", message: "One or more endpoint domains could not be resolved")
|
||||||
default:
|
default:
|
||||||
self?.showErrorAlert(title: "Internal error", message: "The tunnel could not be activated")
|
self?.showErrorAlert(title: "Internal error", message: "The tunnel could not be activated")
|
||||||
|
|
|
@ -246,9 +246,9 @@ extension TunnelsListTableViewController {
|
||||||
tunnelsManager.startActivation(of: tunnel) { error in
|
tunnelsManager.startActivation(of: tunnel) { error in
|
||||||
if let error = error {
|
if let error = error {
|
||||||
switch (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")
|
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")
|
self?.showErrorAlert(title: "DNS Failure", message: "One or more endpoint domains could not be resolved")
|
||||||
default:
|
default:
|
||||||
self?.showErrorAlert(title: "Internal error", message: "The tunnel could not be activated")
|
self?.showErrorAlert(title: "Internal error", message: "The tunnel could not be activated")
|
||||||
|
|
|
@ -12,7 +12,7 @@ protocol TunnelsManagerDelegate: class {
|
||||||
func tunnelRemoved(at: Int)
|
func tunnelRemoved(at: Int)
|
||||||
}
|
}
|
||||||
|
|
||||||
enum TunnelsManagerError: Error {
|
enum TunnelActivationError: Error {
|
||||||
case noEndpoint
|
case noEndpoint
|
||||||
case dnsResolutionFailed
|
case dnsResolutionFailed
|
||||||
case tunnelOperationFailed
|
case tunnelOperationFailed
|
||||||
|
@ -210,11 +210,11 @@ class TunnelsManager {
|
||||||
|
|
||||||
func startActivation(of tunnel: TunnelContainer, completionHandler: @escaping (Error?) -> Void) {
|
func startActivation(of tunnel: TunnelContainer, completionHandler: @escaping (Error?) -> Void) {
|
||||||
guard (tunnel.status == .inactive) else {
|
guard (tunnel.status == .inactive) else {
|
||||||
completionHandler(TunnelsManagerError.attemptingActivationWhenTunnelIsNotInactive)
|
completionHandler(TunnelActivationError.attemptingActivationWhenTunnelIsNotInactive)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
guard (currentTunnel == nil) else {
|
guard (currentTunnel == nil) else {
|
||||||
completionHandler(TunnelsManagerError.attemptingActivationWhenAnotherTunnelIsActive)
|
completionHandler(TunnelActivationError.attemptingActivationWhenAnotherTunnelIsActive)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
tunnel.startActivation(completionHandler: completionHandler)
|
tunnel.startActivation(completionHandler: completionHandler)
|
||||||
|
@ -223,7 +223,7 @@ class TunnelsManager {
|
||||||
|
|
||||||
func startDeactivation(of tunnel: TunnelContainer, completionHandler: @escaping (Error?) -> Void) {
|
func startDeactivation(of tunnel: TunnelContainer, completionHandler: @escaping (Error?) -> Void) {
|
||||||
if (tunnel.status == .inactive) {
|
if (tunnel.status == .inactive) {
|
||||||
completionHandler(TunnelsManagerError.attemptingDeactivationWhenTunnelIsInactive)
|
completionHandler(TunnelActivationError.attemptingDeactivationWhenTunnelIsInactive)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
assert(tunnel.index == currentTunnel!.index)
|
assert(tunnel.index == currentTunnel!.index)
|
||||||
|
@ -305,7 +305,7 @@ class TunnelContainer: NSObject {
|
||||||
guard (endpoints.contains(where: { $0 != nil })) else {
|
guard (endpoints.contains(where: { $0 != nil })) else {
|
||||||
DispatchQueue.main.async { [weak self] in
|
DispatchQueue.main.async { [weak self] in
|
||||||
self?.status = .inactive
|
self?.status = .inactive
|
||||||
completionHandler(TunnelsManagerError.noEndpoint)
|
completionHandler(TunnelActivationError.noEndpoint)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -328,7 +328,7 @@ class TunnelContainer: NSObject {
|
||||||
s.dnsResolver = nil
|
s.dnsResolver = nil
|
||||||
guard let resolvedEndpoints = resolvedEndpoints else {
|
guard let resolvedEndpoints = resolvedEndpoints else {
|
||||||
s.status = .inactive
|
s.status = .inactive
|
||||||
completionHandler(TunnelsManagerError.dnsResolutionFailed)
|
completionHandler(TunnelActivationError.dnsResolutionFailed)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
s.startActivation(tunnelConfiguration: tunnelConfiguration,
|
s.startActivation(tunnelConfiguration: tunnelConfiguration,
|
||||||
|
|
Loading…
Reference in New Issue