diff options
| author | Linus Färnstrand <faern@faern.net> | 2022-01-17 11:39:21 +0100 |
|---|---|---|
| committer | Linus Färnstrand <faern@faern.net> | 2022-01-17 11:44:50 +0100 |
| commit | 80d2476c066813745947ee0e5a4b272f3cdb476b (patch) | |
| tree | 3177fa6bc5da311765d759a64c8449aa32ca0e6e /mullvad-cli/src | |
| parent | 1e9f7fcaa1a489b88e49faadf7ee4a3233426045 (diff) | |
| download | mullvadvpn-80d2476c066813745947ee0e5a4b272f3cdb476b.tar.xz mullvadvpn-80d2476c066813745947ee0e5a4b272f3cdb476b.zip | |
Make `mullvad relay set hostname` not case sensitive to the input
Diffstat (limited to 'mullvad-cli/src')
| -rw-r--r-- | mullvad-cli/src/cmds/relay.rs | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/mullvad-cli/src/cmds/relay.rs b/mullvad-cli/src/cmds/relay.rs index 11e36e0d98..28baab3062 100644 --- a/mullvad-cli/src/cmds/relay.rs +++ b/mullvad-cli/src/cmds/relay.rs @@ -393,11 +393,15 @@ impl Relay { 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 == hostname { - return Some((country, city, 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(types::RelayLocation { + country: country.code, + city: city.code, + hostname: relay.hostname, + }); } } } @@ -408,19 +412,13 @@ impl Relay { if let Some(location) = find_relay() { println!( "Setting location constraint to {} in {}, {}", - location.2.hostname, location.1.name, location.0.name + location.hostname, location.city, location.country ); - let location_constraint = types::RelayLocation { - country: location.0.code.clone(), - city: location.1.code.clone(), - hostname: location.2.hostname.clone(), - }; - self.update_constraints(types::RelaySettingsUpdate { r#type: Some(types::relay_settings_update::Type::Normal( types::NormalRelaySettingsUpdate { - location: Some(location_constraint), + location: Some(location), ..Default::default() }, )), |
