summaryrefslogtreecommitdiffhomepage
path: root/mullvad-cli
diff options
context:
space:
mode:
Diffstat (limited to 'mullvad-cli')
-rw-r--r--mullvad-cli/build.rs7
-rw-r--r--mullvad-cli/src/cmds/relay.rs24
-rw-r--r--mullvad-cli/src/cmds/tunnel.rs26
3 files changed, 24 insertions, 33 deletions
diff --git a/mullvad-cli/build.rs b/mullvad-cli/build.rs
index ee547da265..de110d3a76 100644
--- a/mullvad-cli/build.rs
+++ b/mullvad-cli/build.rs
@@ -15,11 +15,4 @@ fn main() {
));
res.compile().expect("Unable to generate windows resources");
}
- let target_os = std::env::var("CARGO_CFG_TARGET_OS").expect("CARGO_CFG_TARGET_OS not set");
-
- // Enable DAITA by default on desktop
- println!("cargo::rustc-check-cfg=cfg(daita)");
- if let "linux" | "windows" | "macos" = target_os.as_str() {
- println!(r#"cargo::rustc-cfg=daita"#);
- }
}
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 {