diff options
| author | Emīls Piņķis <emils@mullvad.net> | 2018-10-17 15:40:35 +0100 |
|---|---|---|
| committer | Emīls Piņķis <emils@mullvad.net> | 2018-10-23 11:29:12 +0100 |
| commit | 8dc34dccda78800e4c78f7eada333f9430689574 (patch) | |
| tree | 1e2298ca66876ef2369fbaadefa9fcf8483a8850 /mullvad-cli/src/cmds | |
| parent | 5adfd92b767eb5df98608d5a28cde865228ee758 (diff) | |
| download | mullvadvpn-8dc34dccda78800e4c78f7eada333f9430689574.tar.xz mullvadvpn-8dc34dccda78800e4c78f7eada333f9430689574.zip | |
Use auth_failed parsing in CLI
Diffstat (limited to 'mullvad-cli/src/cmds')
| -rw-r--r-- | mullvad-cli/src/cmds/status.rs | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/mullvad-cli/src/cmds/status.rs b/mullvad-cli/src/cmds/status.rs index d25a591726..b1a05bfd07 100644 --- a/mullvad-cli/src/cmds/status.rs +++ b/mullvad-cli/src/cmds/status.rs @@ -4,6 +4,8 @@ use Command; use Result; use mullvad_ipc_client::DaemonRpcClient; +use mullvad_types::auth_failed::AuthFailed; +use talpid_types::tunnel::BlockReason; use talpid_types::tunnel::TunnelStateTransition::{self, *}; pub struct Status; @@ -44,7 +46,7 @@ impl Command for Status { fn print_state(state: &TunnelStateTransition) { print!("Tunnel status: "); match state { - Blocked(reason) => println!("Blocked ({})", reason), + Blocked(reason) => print_blocked_reason(reason), Connected(_) => println!("Connected"), Connecting(_) => println!("Connecting..."), Disconnected => println!("Disconnected"), @@ -52,6 +54,19 @@ fn print_state(state: &TunnelStateTransition) { } } +fn print_blocked_reason(reason: &BlockReason) { + match reason { + BlockReason::AuthFailed(ref auth_failure) => { + let auth_failure_str = auth_failure + .as_ref() + .map(|s| s.as_str()) + .unwrap_or("Account authentication failed"); + println!("Blocked: {}", AuthFailed::from_str(auth_failure_str)); + } + other => println!("Blocked: {}", other), + } +} + fn print_location(rpc: &mut DaemonRpcClient) -> Result<()> { let location = rpc.get_current_location()?; let city_and_country = if let Some(city) = location.city { |
