diff options
| author | Joakim Hulthe <joakim.hulthe@mullvad.net> | 2024-08-19 14:47:35 +0200 |
|---|---|---|
| committer | Joakim Hulthe <joakim.hulthe@mullvad.net> | 2024-09-17 11:29:28 +0200 |
| commit | 3fac6f5f6d84ee65ba015f900ab5436e0f48cc01 (patch) | |
| tree | 24e82fa02dd1566331d13e5d97b4fad7ecc7e2b8 /mullvad-cli/src/cmds | |
| parent | 4892d4a4f34509b9af21bd1349e9e5e964bf9846 (diff) | |
| download | mullvadvpn-3fac6f5f6d84ee65ba015f900ab5436e0f48cc01.tar.xz mullvadvpn-3fac6f5f6d84ee65ba015f900ab5436e0f48cc01.zip | |
Add daita.enabled and daita.use_anywhere rpc calls
Diffstat (limited to 'mullvad-cli/src/cmds')
| -rw-r--r-- | mullvad-cli/src/cmds/tunnel.rs | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/mullvad-cli/src/cmds/tunnel.rs b/mullvad-cli/src/cmds/tunnel.rs index 2464334cc6..911c2f010b 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}, @@ -44,6 +42,10 @@ pub enum TunnelOptions { #[cfg(daita)] #[arg(long)] daita: Option<BooleanOption>, + /// Configure whether to enable DAITA "use anywhere" + #[cfg(daita)] + #[arg(long)] + daita_use_anywhere: Option<BooleanOption>, /// The key rotation interval. Number of hours, or 'any' #[arg(long)] rotation_interval: Option<Constraint<RotationInterval>>, @@ -140,6 +142,8 @@ impl Tunnel { quantum_resistant, #[cfg(daita)] daita, + #[cfg(daita)] + daita_use_anywhere, rotation_interval, rotate_key, } => { @@ -148,6 +152,8 @@ impl Tunnel { quantum_resistant, #[cfg(daita)] daita, + #[cfg(daita)] + daita_use_anywhere, rotation_interval, rotate_key, ) @@ -179,6 +185,7 @@ impl Tunnel { mtu: Option<Constraint<u16>>, quantum_resistant: Option<QuantumResistantState>, #[cfg(daita)] daita: Option<BooleanOption>, + #[cfg(daita)] daita_use_anywhere: Option<BooleanOption>, rotation_interval: Option<Constraint<RotationInterval>>, rotate_key: Option<RotateKey>, ) -> Result<()> { @@ -195,12 +202,14 @@ impl Tunnel { } #[cfg(daita)] - if let Some(daita) = daita { - rpc.set_daita_settings(DaitaSettings { - enabled: *daita, - use_anywhere: true, /* TODO */ - }) - .await?; + if let Some(enable_daita) = daita { + rpc.set_enable_daita(*enable_daita).await?; + println!("DAITA setting has been updated"); + } + + #[cfg(daita)] + if let Some(daita_use_anywhere) = daita_use_anywhere { + rpc.set_daita_use_anywhere(*daita_use_anywhere).await?; println!("DAITA setting has been updated"); } |
