diff options
Diffstat (limited to 'mullvad-cli/src/cmds')
| -rw-r--r-- | mullvad-cli/src/cmds/relay.rs | 6 | ||||
| -rw-r--r-- | mullvad-cli/src/cmds/tunnel.rs | 40 |
2 files changed, 24 insertions, 22 deletions
diff --git a/mullvad-cli/src/cmds/relay.rs b/mullvad-cli/src/cmds/relay.rs index ac7bd74c63..46d4567724 100644 --- a/mullvad-cli/src/cmds/relay.rs +++ b/mullvad-cli/src/cmds/relay.rs @@ -575,7 +575,7 @@ impl Relay { wireguard_constraints.entry_location = parse_entry_location_constraint(entry); let use_multihop = wireguard_constraints.entry_location.is_some(); if use_multihop { - let use_pq = rpc + let use_pq_safe_psk = rpc .get_settings(()) .await? .into_inner() @@ -584,9 +584,9 @@ impl Relay { .wireguard .unwrap() .use_pq_safe_psk; - if use_pq { + if use_pq_safe_psk { return Err(Error::CommandFailed( - "PQ PSK exchange does not work when multihop is enabled", + "Quantum resistant tunnels do not work when multihop is enabled", )); } } diff --git a/mullvad-cli/src/cmds/tunnel.rs b/mullvad-cli/src/cmds/tunnel.rs index 7856cc849c..8d2c5e596e 100644 --- a/mullvad-cli/src/cmds/tunnel.rs +++ b/mullvad-cli/src/cmds/tunnel.rs @@ -233,28 +233,30 @@ impl Tunnel { async fn process_wireguard_quantum_resistant_tunnel_set( matches: &clap::ArgMatches, ) -> Result<()> { - let new_state = matches.value_of("policy").unwrap() == "on"; + let use_pq_safe_psk = matches.value_of("policy").unwrap() == "on"; let mut rpc = new_rpc_client().await?; let settings = rpc.get_settings(()).await?; - let multihop_is_enabled = settings - .into_inner() - .relay_settings - .unwrap() - .endpoint - .and_then(|endpoint| { - if let types::relay_settings::Endpoint::Normal(settings) = endpoint { - Some(settings.wireguard_constraints.unwrap().use_multihop) - } else { - None - } - }) - .unwrap_or(false); - if multihop_is_enabled { - return Err(Error::CommandFailed( - "PQ PSK exchange does not work when multihop is enabled", - )); + if use_pq_safe_psk { + let multihop_is_enabled = settings + .into_inner() + .relay_settings + .unwrap() + .endpoint + .and_then(|endpoint| { + if let types::relay_settings::Endpoint::Normal(settings) = endpoint { + Some(settings.wireguard_constraints.unwrap().use_multihop) + } else { + None + } + }) + .unwrap_or(false); + if multihop_is_enabled { + return Err(Error::CommandFailed( + "Quantum resistant tunnels do not work when multihop is enabled", + )); + } } - rpc.set_quantum_resistant_tunnel(new_state).await?; + rpc.set_quantum_resistant_tunnel(use_pq_safe_psk).await?; println!("Updated quantum resistant tunnel setting"); Ok(()) } |
