summaryrefslogtreecommitdiffhomepage
path: root/mullvad-cli
diff options
context:
space:
mode:
authorMarkus Pettersson <markus.pettersson@mullvad.net>2025-03-13 09:34:44 +0100
committerMarkus Pettersson <markus.pettersson@mullvad.net>2025-04-04 16:17:49 +0200
commitf2a77bab45ebfdbd1122a2195f9ccd8368babb47 (patch)
tree59fd54f54482541a89e175040c9e5fb868a734e4 /mullvad-cli
parentf8f47dcb7543193a7b03fd0528a3540dcb5eed01 (diff)
downloadmullvadvpn-f2a77bab45ebfdbd1122a2195f9ccd8368babb47.tar.xz
mullvadvpn-f2a77bab45ebfdbd1122a2195f9ccd8368babb47.zip
Implement new debug commands: `relay disable` and `relay enable`
Add two new `mullvad debug` subcommands: - mullvad debug relay enable <country|city|hostname|openvpn|wireguard> - mullvad debug relay disable <country|city|hostname|openvpn|wireguard> These commands are used to update the state of relays the current relay list. This is useful to mock relays going offline or coming online from an offline state. These new debug commands were conceived during the development of the feature for adding warnings for the upcoming OpenVPN deprecation, as there wasn't a convenient way of mocking this.
Diffstat (limited to 'mullvad-cli')
-rw-r--r--mullvad-cli/src/cmds/debug.rs25
1 files changed, 25 insertions, 0 deletions
diff --git a/mullvad-cli/src/cmds/debug.rs b/mullvad-cli/src/cmds/debug.rs
index d67194b058..933f1212e8 100644
--- a/mullvad-cli/src/cmds/debug.rs
+++ b/mullvad-cli/src/cmds/debug.rs
@@ -9,6 +9,19 @@ use mullvad_types::{
pub enum DebugCommands {
/// Block all internet connection by setting an invalid relay constraint.
BlockConnection,
+ /// Relay
+ #[clap(subcommand)]
+ Relay(RelayDebugCommands),
+}
+
+#[derive(clap::Subcommand, Debug)]
+pub enum RelayDebugCommands {
+ /// Inactivate this _category of relays_ - a category can be one of the following: a relay, a
+ /// city, a country or a tunnel protocol (`openvpn` or `wireguard`).
+ Disable { relay: String },
+ /// (Re)Activate this _category of relays_ - a category can be one of the following: a relay, a
+ /// city, a country or a tunnel protocol (`openvpn` or `wireguard`).
+ Enable { relay: String },
}
impl DebugCommands {
@@ -41,6 +54,18 @@ impl DebugCommands {
eprintln!("WARNING: ENTERED BLOCKED MODE");
Ok(())
}
+ DebugCommands::Relay(RelayDebugCommands::Disable { relay }) => {
+ let mut rpc = MullvadProxyClient::new().await?;
+ rpc.disable_relay(relay.clone()).await?;
+ println!("{relay} is now marked as inactive");
+ Ok(())
+ }
+ DebugCommands::Relay(RelayDebugCommands::Enable { relay }) => {
+ let mut rpc = MullvadProxyClient::new().await?;
+ rpc.enable_relay(relay.clone()).await?;
+ println!("{relay} is now marked as active");
+ Ok(())
+ }
}
}
}