aboutsummaryrefslogtreecommitdiffstats
path: root/WireGuard/WireGuard/Tunnel
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2018-12-22 03:41:54 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2018-12-22 03:42:01 +0100
commit8365adf4351c380004d2c871a81231083b2373cc (patch)
treefbc5b14bb9977c33bbe31a1a436cbc44d40e7b5a /WireGuard/WireGuard/Tunnel
parentRTL support (diff)
downloadwireguard-apple-8365adf4351c380004d2c871a81231083b2373cc.tar.xz
wireguard-apple-8365adf4351c380004d2c871a81231083b2373cc.zip
Localize remaining strings in network extension
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'WireGuard/WireGuard/Tunnel')
-rw-r--r--WireGuard/WireGuard/Tunnel/TunnelsManager.swift21
1 files changed, 15 insertions, 6 deletions
diff --git a/WireGuard/WireGuard/Tunnel/TunnelsManager.swift b/WireGuard/WireGuard/Tunnel/TunnelsManager.swift
index 4913fd2b..c25d4b61 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 {