diff options
| author | Markus Pettersson <markus.pettersson@mullvad.net> | 2023-06-19 11:40:03 +0200 |
|---|---|---|
| committer | Markus Pettersson <markus.pettersson@mullvad.net> | 2023-06-21 13:15:34 +0200 |
| commit | fb6badcaddc57f2da1b4aafa408b9f2bd3bca087 (patch) | |
| tree | 2587c7b6185d06158798b93507beabf668f3a80e /mullvad-cli/src | |
| parent | b2f2a44f9d88f981d46162d46f61c1f206cf0eb7 (diff) | |
| download | mullvadvpn-fb6badcaddc57f2da1b4aafa408b9f2bd3bca087.tar.xz mullvadvpn-fb6badcaddc57f2da1b4aafa408b9f2bd3bca087.zip | |
Remove `mullvad relay set hostname` command
Diffstat (limited to 'mullvad-cli/src')
| -rw-r--r-- | mullvad-cli/src/cmds/relay.rs | 43 |
1 files changed, 4 insertions, 39 deletions
diff --git a/mullvad-cli/src/cmds/relay.rs b/mullvad-cli/src/cmds/relay.rs index 9ddc86e5ba..f2562dd694 100644 --- a/mullvad-cli/src/cmds/relay.rs +++ b/mullvad-cli/src/cmds/relay.rs @@ -3,9 +3,8 @@ use clap::Subcommand; use itertools::Itertools; use mullvad_management_interface::MullvadProxyClient; use mullvad_types::{ - location::Hostname, relay_constraints::{ - Constraint, LocationConstraint, Match, OpenVpnConstraints, Ownership, Provider, Providers, + Constraint, Match, OpenVpnConstraints, Ownership, Provider, Providers, RelayConstraintsUpdate, RelaySettings, RelaySettingsUpdate, TransportPort, WireguardConstraints, }, @@ -42,14 +41,11 @@ pub enum Relay { pub enum SetCommands { /// Set country or city to select relays from. Use the 'list' /// command to show available alternatives. + /// + /// A relay can be selected by only supplying the hostname, such as + /// "se3-wireguard". Location(LocationArgs), - /// Set the location using only a hostname - Hostname { - /// A hostname, such as "se3-wireguard". - hostname: Hostname, - }, - /// Set hosting provider(s) to select relays from. The 'list' /// command shows the available relays and their providers. Provider { @@ -268,7 +264,6 @@ impl Relay { match subcmd { SetCommands::Custom(subcmd) => Self::set_custom(subcmd).await, SetCommands::Location(location) => Self::set_location(location).await, - SetCommands::Hostname { hostname } => Self::set_hostname(hostname).await, SetCommands::Provider { providers } => Self::set_providers(providers).await, SetCommands::Ownership { ownership } => Self::set_ownership(ownership).await, SetCommands::Tunnel(subcmd) => Self::set_tunnel(subcmd).await, @@ -395,36 +390,6 @@ impl Relay { }) } - async fn set_hostname(hostname: String) -> Result<()> { - let countries = Self::get_filtered_relays().await?; - - let find_relay = || { - for country in countries { - for city in country.cities { - for relay in city.relays { - if relay.hostname.to_lowercase() == hostname.to_lowercase() { - return Some(LocationConstraint::Hostname( - country.code, - city.code, - relay.hostname, - )); - } - } - } - } - None - }; - - let location = find_relay().ok_or(anyhow!("Hostname not found"))?; - - println!("Setting location constraint to {location}"); - Self::update_constraints(RelaySettingsUpdate::Normal(RelayConstraintsUpdate { - location: Some(Constraint::Only(location)), - ..Default::default() - })) - .await - } - async fn set_location(location_constraint: LocationArgs) -> Result<()> { let location_constraint = Constraint::from(location_constraint); match &location_constraint { |
