diff options
| author | Linus Färnstrand <linus@mullvad.net> | 2019-03-28 16:18:25 +0100 |
|---|---|---|
| committer | Linus Färnstrand <linus@mullvad.net> | 2019-03-28 16:18:25 +0100 |
| commit | 58de89db26d7360783060cee0130a439b0f0c8da (patch) | |
| tree | 6a1e4c0d18a9788c1164005a9326a61672bb4e3a /mullvad-cli/src | |
| parent | 3f3355468bb0b9c1899913ed26141d9494f41c12 (diff) | |
| download | mullvadvpn-58de89db26d7360783060cee0130a439b0f0c8da.tar.xz mullvadvpn-58de89db26d7360783060cee0130a439b0f0c8da.zip | |
Emit relay_list update events in the daemon subscription
Diffstat (limited to 'mullvad-cli/src')
| -rw-r--r-- | mullvad-cli/src/cmds/status.rs | 37 |
1 files changed, 27 insertions, 10 deletions
diff --git a/mullvad-cli/src/cmds/status.rs b/mullvad-cli/src/cmds/status.rs index fc6df014fc..862514a9f4 100644 --- a/mullvad-cli/src/cmds/status.rs +++ b/mullvad-cli/src/cmds/status.rs @@ -15,7 +15,13 @@ impl Command for Status { clap::SubCommand::with_name(self.name()) .about("View the state of the VPN tunnel") .subcommand( - clap::SubCommand::with_name("listen").about("Listen for VPN tunnel state changes"), + clap::SubCommand::with_name("listen") + .about("Listen for VPN tunnel state changes") + .arg( + clap::Arg::with_name("verbose") + .short("v") + .help("Enables verbose output"), + ), ) } @@ -25,20 +31,31 @@ impl Command for Status { print_state(&state); print_location(&mut rpc)?; - if matches.subcommand_matches("listen").is_some() { + if let Some(listen_matches) = matches.subcommand_matches("listen") { + let verbose = listen_matches.is_present("verbose"); let subscription = rpc .daemon_event_subscribe() .wait() .map_err(|_err| Error::from(ErrorKind::CantSubscribe))?; for event in subscription.wait() { - if let DaemonEvent::StateTransition(new_state) = - event.chain_err(|| "Subscription failed")? - { - print_state(&new_state); - use self::TunnelStateTransition::*; - match new_state { - Connected(_) | Disconnected => print_location(&mut rpc)?, - _ => {} + match event.chain_err(|| "Subscription failed")? { + DaemonEvent::StateTransition(new_state) => { + print_state(&new_state); + use self::TunnelStateTransition::*; + match new_state { + Connected(_) | Disconnected => print_location(&mut rpc)?, + _ => {} + } + } + DaemonEvent::Settings(settings) => { + if verbose { + println!("New settings: {:#?}", settings); + } + } + DaemonEvent::RelayList(relay_list) => { + if verbose { + println!("New relay list: {:#?}", relay_list); + } } } } |
