summaryrefslogtreecommitdiffhomepage
path: root/mullvad-cli/src/cmds
diff options
context:
space:
mode:
Diffstat (limited to 'mullvad-cli/src/cmds')
-rw-r--r--mullvad-cli/src/cmds/debug.rs46
1 files changed, 45 insertions, 1 deletions
diff --git a/mullvad-cli/src/cmds/debug.rs b/mullvad-cli/src/cmds/debug.rs
index 933f1212e8..37c2d579e3 100644
--- a/mullvad-cli/src/cmds/debug.rs
+++ b/mullvad-cli/src/cmds/debug.rs
@@ -1,4 +1,4 @@
-use anyhow::Result;
+use anyhow::{Result, bail};
use mullvad_management_interface::MullvadProxyClient;
use mullvad_types::{
constraints::Constraint,
@@ -12,6 +12,9 @@ pub enum DebugCommands {
/// Relay
#[clap(subcommand)]
Relay(RelayDebugCommands),
+ /// Handy commands for interacting with the app release rollout system.
+ #[clap(subcommand)]
+ Rollout(RolloutDebugCommands),
}
#[derive(clap::Subcommand, Debug)]
@@ -24,6 +27,18 @@ pub enum RelayDebugCommands {
Enable { relay: String },
}
+#[derive(clap::Subcommand, Debug)]
+pub enum RolloutDebugCommands {
+ /// Print your rollout threshold.
+ Get,
+ /// Generate a new rollout threshold (overwrites the current threshold value)
+ Reroll,
+ /// Set your rollout threshold seed to a known value.
+ ///
+ /// The seed is used to generate a rollout threshold.
+ Seed { value: u32 },
+}
+
impl DebugCommands {
pub async fn handle(self) -> Result<()> {
match self {
@@ -66,6 +81,35 @@ impl DebugCommands {
println!("{relay} is now marked as active");
Ok(())
}
+ DebugCommands::Rollout(rollout_cmd) => rollout_cmd.handle().await,
+ }
+ }
+}
+
+impl RolloutDebugCommands {
+ pub async fn handle(self) -> Result<()> {
+ let mut rpc = MullvadProxyClient::new().await?;
+ match self {
+ RolloutDebugCommands::Get => {
+ let Ok(threshold) = rpc.get_rollout_threshold().await else {
+ bail!("Failed to get rollout");
+ };
+ println!("{threshold}");
+ Ok(())
+ }
+ RolloutDebugCommands::Reroll => {
+ let Ok(threshold) = rpc.generate_new_rollout_threshold().await else {
+ bail!("Failed to get rollout");
+ };
+ println!("{threshold}");
+ Ok(())
+ }
+ RolloutDebugCommands::Seed { value: seed } => {
+ if rpc.set_new_rollout_threshold_seed(seed).await.is_err() {
+ bail!("Failed to update rollout seed");
+ }
+ Ok(())
+ }
}
}
}