Skip to content

Commit

Permalink
Remote daita cfg from mullvad-cli
Browse files Browse the repository at this point in the history
  • Loading branch information
hulthe committed Aug 19, 2024
1 parent 7be3aef commit 315e980
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 19 deletions.
7 changes: 0 additions & 7 deletions mullvad-cli/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"#);
}
}
1 change: 0 additions & 1 deletion mullvad-cli/src/cmds/relay.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
13 changes: 2 additions & 11 deletions mullvad-cli/src/cmds/tunnel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,9 @@ 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 "use anywhere"
#[cfg(daita)]
#[arg(long)]
daita_use_anywhere: Option<BooleanOption>,
/// The key rotation interval. Number of hours, or 'any'
Expand Down Expand Up @@ -103,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?;
Expand Down Expand Up @@ -140,19 +137,15 @@ impl Tunnel {
TunnelOptions::Wireguard {
mtu,
quantum_resistant,
#[cfg(daita)]
daita,
#[cfg(daita)]
daita_use_anywhere,
rotation_interval,
rotate_key,
} => {
Self::handle_wireguard(
mtu,
quantum_resistant,
#[cfg(daita)]
daita,
#[cfg(daita)]
daita_use_anywhere,
rotation_interval,
rotate_key,
Expand Down Expand Up @@ -184,8 +177,8 @@ impl Tunnel {
async fn handle_wireguard(
mtu: Option<Constraint<u16>>,
quantum_resistant: Option<QuantumResistantState>,
#[cfg(daita)] daita: Option<BooleanOption>,
#[cfg(daita)] daita_use_anywhere: Option<BooleanOption>,
daita: Option<BooleanOption>,
daita_use_anywhere: Option<BooleanOption>,
rotation_interval: Option<Constraint<RotationInterval>>,
rotate_key: Option<RotateKey>,
) -> Result<()> {
Expand All @@ -201,13 +194,11 @@ impl Tunnel {
println!("Quantum resistant setting has been updated");
}

#[cfg(daita)]
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");
Expand Down

0 comments on commit 315e980

Please sign in to comment.