diff options
| author | David Lönnhager <david.l@mullvad.net> | 2021-04-27 18:46:18 +0200 |
|---|---|---|
| committer | David Lönnhager <david.l@mullvad.net> | 2021-05-17 11:08:50 +0200 |
| commit | d478193d76099077cdc4afd3bda5e48ecc6f1a1b (patch) | |
| tree | 9d7f2ef82b37432d0e5833d85c4c3c2e1d7d7ccb /mullvad-cli/src/cmds | |
| parent | 176690bc2e4a4d6c1267552b7f84804392528f19 (diff) | |
| download | mullvadvpn-d478193d76099077cdc4afd3bda5e48ecc6f1a1b.tar.xz mullvadvpn-d478193d76099077cdc4afd3bda5e48ecc6f1a1b.zip | |
Include entry endpoint in 'mullvad relay get'
Diffstat (limited to 'mullvad-cli/src/cmds')
| -rw-r--r-- | mullvad-cli/src/cmds/relay.rs | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/mullvad-cli/src/cmds/relay.rs b/mullvad-cli/src/cmds/relay.rs index 6451097891..245eda9e91 100644 --- a/mullvad-cli/src/cmds/relay.rs +++ b/mullvad-cli/src/cmds/relay.rs @@ -2,6 +2,7 @@ use crate::{location, new_rpc_client, Command, Error, Result}; use clap::{value_t, values_t}; use itertools::Itertools; use std::{ + fmt::Write, io::{self, BufRead}, net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr}, str::FromStr, @@ -733,7 +734,7 @@ impl Relay { fn format_wireguard_constraints(constraints: Option<&WireguardConstraints>) -> String { if let Some(constraints) = constraints { - format!( + let mut out = format!( "{} over {}", Self::format_port(constraints.port), Self::format_ip_version( @@ -742,7 +743,18 @@ impl Relay { .clone() .map(|protocol| IpVersion::from_i32(protocol.protocol).unwrap()) ) - ) + ); + + if let Some(ref entry) = constraints.entry_location { + write!( + &mut out, + " (via {})", + location::format_location(Some(entry)) + ) + .unwrap(); + } + + out } else { "any port over IPv4 or IPv6".to_string() } |
