diff options
Diffstat (limited to 'WireGuard/WireGuard')
-rw-r--r-- | WireGuard/WireGuard/Base.lproj/Localizable.strings | 10 | ||||
-rw-r--r-- | WireGuard/WireGuard/Tunnel/TunnelsManager.swift | 21 |
2 files changed, 24 insertions, 7 deletions
diff --git a/WireGuard/WireGuard/Base.lproj/Localizable.strings b/WireGuard/WireGuard/Base.lproj/Localizable.strings index ac4a730..7815ddb 100644 --- a/WireGuard/WireGuard/Base.lproj/Localizable.strings +++ b/WireGuard/WireGuard/Base.lproj/Localizable.strings @@ -178,15 +178,23 @@ "alertTunnelActivationFailureTitle" = "Activation failure"; "alertTunnelActivationFailureMessage" = "The tunnel could not be activated. Please ensure that you are connected to the Internet."; +"alertTunnelActivationSavedConfigFailureMessage" = "Unable to retrieve tunnel information from the saved configuration."; +"alertTunnelActivationBackendFailureMessage" = "Unable to turn on Go backend library."; +"alertTunnelActivationFileDescriptorFailureMessage" = "Unable to determine TUN device file descriptor."; +"alertTunnelActivationSetNetworkSettingsMessage" = "Unable to apply network settings to tunnel object."; + "alertTunnelActivationFailureOnDemandAddendum" = " This tunnel has Activate On Demand enabled, so this tunnel might be re-activated automatically by the OS. You may turn off Activate On Demand in this app by editing the tunnel configuration."; +"alertTunnelDNSFailureTitle" = "DNS resolution failure"; +"alertTunnelDNSFailureMessage" = "One or more endpoint domains could not be resolved."; + "alertTunnelNameEmptyTitle" = "No name provided"; "alertTunnelNameEmptyMessage" = "Cannot create tunnel with an empty name"; "alertTunnelAlreadyExistsWithThatNameTitle" = "Name already exists"; "alertTunnelAlreadyExistsWithThatNameMessage" = "A tunnel with that name already exists"; -"alertTunnelActivationErrorTunnelIsNotInactiveTitle" = "Activation failure"; +"alertTunnelActivationErrorTunnelIsNotInactiveTitle" = "Activation in progress"; "alertTunnelActivationErrorTunnelIsNotInactiveMessage" = "The tunnel is already active or in the process of being activated"; // Tunnel management error alerts on system error diff --git a/WireGuard/WireGuard/Tunnel/TunnelsManager.swift b/WireGuard/WireGuard/Tunnel/TunnelsManager.swift index 4913fd2..c25d4b6 100644 --- a/WireGuard/WireGuard/Tunnel/TunnelsManager.swift +++ b/WireGuard/WireGuard/Tunnel/TunnelsManager.swift @@ -298,13 +298,22 @@ class TunnelsManager { guard let lastErrorData = try? Data(contentsOf: lastErrorFileURL) else { return nil } guard let lastErrorText = String(data: lastErrorData, encoding: .utf8) else { return nil } let lastErrorStrings = lastErrorText.splitToArray(separator: "\n") - guard lastErrorStrings.count == 3 else { return nil } - let attemptIdInDisk = lastErrorStrings[0] - if let attemptIdForTunnel = tunnel.activationAttemptId, attemptIdInDisk == attemptIdForTunnel { - return (title: lastErrorStrings[1], message: lastErrorStrings[2]) + guard lastErrorStrings.count == 2 && tunnel.activationAttemptId == lastErrorStrings[0] else { return nil } + + switch PacketTunnelProviderError(rawValue: lastErrorStrings[1]) { + case .some(.savedProtocolConfigurationIsInvalid): + return (tr("alertTunnelActivationFailureTitle"), tr("alertTunnelActivationSavedConfigFailureMessage")) + case .some(.dnsResolutionFailure): + return (tr("alertTunnelDNSFailureTitle"), tr("alertTunnelDNSFailureMessage")) + case .some(.couldNotStartBackend): + return (tr("alertTunnelActivationFailureTitle"), tr("alertTunnelActivationBackendFailureMessage")) + case .some(.couldNotDetermineFileDescriptor): + return (tr("alertTunnelActivationFailureTitle"), tr("alertTunnelActivationFileDescriptorFailureMessage")) + case .some(.couldNotSetNetworkSettings): + return (tr("alertTunnelActivationFailureTitle"), tr("alertTunnelActivationSetNetworkSettingsMessage")) + default: + return (tr("alertTunnelActivationFailureTitle"), tr("alertTunnelActivationFailureMessage")) } - - return nil } deinit { |