diff options
| author | Joakim Hulthe <joakim.hulthe@mullvad.net> | 2024-09-17 11:55:02 +0200 |
|---|---|---|
| committer | Joakim Hulthe <joakim.hulthe@mullvad.net> | 2024-09-17 11:55:02 +0200 |
| commit | f0d4d64d1042248b255b3b7289bb4073088327cc (patch) | |
| tree | 59337b2a334557cba533858b27a9c58eaa5ad055 /mullvad-cli/src | |
| parent | 13af28efa7f73843327b017234640d2c58bbbeea (diff) | |
| parent | d77bd4d9d9412aab5705d949570f419f03415734 (diff) | |
| download | mullvadvpn-f0d4d64d1042248b255b3b7289bb4073088327cc.tar.xz mullvadvpn-f0d4d64d1042248b255b3b7289bb4073088327cc.zip | |
Merge branch 'implement-use-anywhere-daita-setting-des-1068'
Diffstat (limited to 'mullvad-cli/src')
| -rw-r--r-- | mullvad-cli/src/cmds/relay.rs | 24 | ||||
| -rw-r--r-- | mullvad-cli/src/cmds/tunnel.rs | 26 |
2 files changed, 24 insertions, 26 deletions
diff --git a/mullvad-cli/src/cmds/relay.rs b/mullvad-cli/src/cmds/relay.rs index 68292c0ad1..4fe11b2a8f 100644 --- a/mullvad-cli/src/cmds/relay.rs +++ b/mullvad-cli/src/cmds/relay.rs @@ -4,7 +4,7 @@ use itertools::Itertools; use mullvad_management_interface::MullvadProxyClient; use mullvad_types::{ constraints::{Constraint, Match}, - location::{CountryCode, Location}, + location::CountryCode, relay_constraints::{ GeographicLocationConstraint, LocationConstraint, LocationConstraintFormatter, OpenVpnConstraints, Ownership, Provider, Providers, RelayConstraints, RelayOverride, @@ -542,7 +542,6 @@ impl Relay { allowed_ips: all_of_the_internet(), endpoint: SocketAddr::new(IpAddr::V4(Ipv4Addr::UNSPECIFIED), port), psk: None, - #[cfg(daita)] constant_packet_size: false, }, exit_peer: None, @@ -921,15 +920,11 @@ fn parse_transport_port( fn relay_to_geographical_constraint( relay: mullvad_types::relay_list::Relay, -) -> Option<GeographicLocationConstraint> { - relay.location.map( - |Location { - country_code, - city_code, - .. - }| { - GeographicLocationConstraint::Hostname(country_code, city_code, relay.hostname) - }, +) -> GeographicLocationConstraint { + GeographicLocationConstraint::Hostname( + relay.location.country_code, + relay.location.city_code, + relay.hostname, ) } @@ -952,10 +947,9 @@ pub async fn resolve_location_constraint( .find(|relay| relay.hostname.to_lowercase() == location_constraint_args.country) { if relay_filter(&matching_relay) { - Ok(Constraint::Only( - relay_to_geographical_constraint(matching_relay) - .context("Selected relay did not contain a valid location")?, - )) + Ok(Constraint::Only(relay_to_geographical_constraint( + matching_relay, + ))) } else { bail!( "The relay `{}` is not valid for this operation", diff --git a/mullvad-cli/src/cmds/tunnel.rs b/mullvad-cli/src/cmds/tunnel.rs index 0937cc8229..da66cac5d5 100644 --- a/mullvad-cli/src/cmds/tunnel.rs +++ b/mullvad-cli/src/cmds/tunnel.rs @@ -1,8 +1,6 @@ use anyhow::Result; use clap::Subcommand; use mullvad_management_interface::MullvadProxyClient; -#[cfg(daita)] -use mullvad_types::wireguard::DaitaSettings; use mullvad_types::{ constraints::Constraint, wireguard::{QuantumResistantState, RotationInterval, DEFAULT_ROTATION_INTERVAL}, @@ -41,9 +39,11 @@ pub enum TunnelOptions { #[arg(long)] quantum_resistant: Option<QuantumResistantState>, /// Configure whether to enable DAITA - #[cfg(daita)] #[arg(long)] daita: Option<BooleanOption>, + /// Configure whether to enable DAITA smart routing + #[arg(long)] + daita_smart_routing: Option<BooleanOption>, /// The key rotation interval. Number of hours, or 'any' #[arg(long)] rotation_interval: Option<Constraint<RotationInterval>>, @@ -101,7 +101,6 @@ impl Tunnel { tunnel_options.wireguard.quantum_resistant, ); - #[cfg(daita)] print_option!("DAITA", tunnel_options.wireguard.daita.enabled); let key = rpc.get_wireguard_key().await?; @@ -138,16 +137,16 @@ impl Tunnel { TunnelOptions::Wireguard { mtu, quantum_resistant, - #[cfg(daita)] daita, + daita_smart_routing, rotation_interval, rotate_key, } => { Self::handle_wireguard( mtu, quantum_resistant, - #[cfg(daita)] daita, + daita_smart_routing, rotation_interval, rotate_key, ) @@ -178,7 +177,8 @@ impl Tunnel { async fn handle_wireguard( mtu: Option<Constraint<u16>>, quantum_resistant: Option<QuantumResistantState>, - #[cfg(daita)] daita: Option<BooleanOption>, + daita: Option<BooleanOption>, + daita_smart_routing: Option<BooleanOption>, rotation_interval: Option<Constraint<RotationInterval>>, rotate_key: Option<RotateKey>, ) -> Result<()> { @@ -194,11 +194,15 @@ impl Tunnel { println!("Quantum resistant setting has been updated"); } - #[cfg(daita)] - if let Some(daita) = daita { - rpc.set_daita_settings(DaitaSettings { enabled: *daita }) - .await?; + if let Some(enable_daita) = daita { + rpc.set_enable_daita(*enable_daita).await?; println!("DAITA setting has been updated"); + println!("Smart routing setting has been updated"); + } + + if let Some(daita_smart_routing) = daita_smart_routing { + rpc.set_daita_smart_routing(*daita_smart_routing).await?; + println!("Smart routing setting has been updated"); } if let Some(interval) = rotation_interval { |
