summaryrefslogtreecommitdiffhomepage
path: root/mullvad-cli/src
diff options
context:
space:
mode:
authorDavid Lönnhager <david.l@mullvad.net>2022-09-21 10:38:00 +0200
committerDavid Lönnhager <david.l@mullvad.net>2022-11-29 19:06:36 +0100
commit9fffb1e6636508dcb0878970349aa2eb699c2212 (patch)
treeddac342bac92af1c07b9ddae23241c45e9dd850b /mullvad-cli/src
parent8d102a013ecafca58ebfd60fae1f117e455681a3 (diff)
downloadmullvadvpn-9fffb1e6636508dcb0878970349aa2eb699c2212.tar.xz
mullvadvpn-9fffb1e6636508dcb0878970349aa2eb699c2212.zip
Parse new AuthFailed error correctly in the CLI
Diffstat (limited to 'mullvad-cli/src')
-rw-r--r--mullvad-cli/src/format.rs22
1 files changed, 21 insertions, 1 deletions
diff --git a/mullvad-cli/src/format.rs b/mullvad-cli/src/format.rs
index 693f5c9c7e..b4aa96a719 100644
--- a/mullvad-cli/src/format.rs
+++ b/mullvad-cli/src/format.rs
@@ -1,4 +1,4 @@
-use mullvad_types::{location::GeoIpLocation, states::TunnelState};
+use mullvad_types::{auth_failed::AuthFailed, location::GeoIpLocation, states::TunnelState};
use talpid_types::{
net::{Endpoint, TunnelEndpoint},
tunnel::ErrorState,
@@ -166,6 +166,26 @@ fn print_error_state(error_state: &ErrorState) {
println!("Blocked: {}", cause);
println!("Your kernel might be terribly out of date or missing nftables");
}
+ talpid_types::tunnel::ErrorStateCause::AuthFailed(Some(auth_failed)) => {
+ println!(
+ "Blocked: Authentication with remote server failed: {}",
+ get_auth_failed_message(AuthFailed::from(auth_failed.as_str()))
+ );
+ }
cause => println!("Blocked: {}", cause),
}
}
+
+const fn get_auth_failed_message(auth_failed: AuthFailed) -> &'static str {
+ const INVALID_ACCOUNT_MSG: &str = "You've logged in with an account number that is not valid. Please log out and try another one.";
+ const EXPIRED_ACCOUNT_MSG: &str = "You have no more VPN time left on this account. Please log in on our website to buy more credit.";
+ const TOO_MANY_CONNECTIONS_MSG: &str = "This account has too many simultaneous connections. Disconnect another device or try connecting again shortly.";
+ const UNKNOWN_MSG: &str = "Unknown error.";
+
+ match auth_failed {
+ AuthFailed::InvalidAccount => INVALID_ACCOUNT_MSG,
+ AuthFailed::ExpiredAccount => EXPIRED_ACCOUNT_MSG,
+ AuthFailed::TooManyConnections => TOO_MANY_CONNECTIONS_MSG,
+ AuthFailed::Unknown => UNKNOWN_MSG,
+ }
+}