summaryrefslogtreecommitdiffhomepage
path: root/mullvad-cli/src
diff options
context:
space:
mode:
authorLinus Färnstrand <faern@faern.net>2022-04-13 14:35:51 +0200
committerLinus Färnstrand <linus@mullvad.net>2022-04-14 13:17:15 +0200
commite6b2e24c2a79b122a05dbfc90fa5a96a49a65bee (patch)
treef413ac9be4e6bd16742af7be43cc84af53265551 /mullvad-cli/src
parentb98207961f1615014cb7b5d00d62c8a82145c8c1 (diff)
downloadmullvadvpn-e6b2e24c2a79b122a05dbfc90fa5a96a49a65bee.tar.xz
mullvadvpn-e6b2e24c2a79b122a05dbfc90fa5a96a49a65bee.zip
Improve and change output of `mullvad obfuscation get`
Somewhat refactors how some obfuscation related types display themselves
Diffstat (limited to 'mullvad-cli/src')
-rw-r--r--mullvad-cli/src/cmds/obfuscation.rs26
1 files changed, 11 insertions, 15 deletions
diff --git a/mullvad-cli/src/cmds/obfuscation.rs b/mullvad-cli/src/cmds/obfuscation.rs
index 9316333e8c..3f015c896e 100644
--- a/mullvad-cli/src/cmds/obfuscation.rs
+++ b/mullvad-cli/src/cmds/obfuscation.rs
@@ -29,7 +29,7 @@ impl Command for Obfuscation {
async fn run(&self, matches: &clap::ArgMatches) -> Result<()> {
match matches.subcommand() {
Some(("set", set_matches)) => Self::handle_set(set_matches).await,
- Some(("get", get_matches)) => Self::handle_get(get_matches).await,
+ Some(("get", _get_matches)) => Self::handle_get().await,
_ => unreachable!("unhandled command"),
}
}
@@ -50,7 +50,7 @@ impl Obfuscation {
};
Self::set_obfuscation_settings(&mut rpc, &settings).await?;
}
- Some(("udp2tcp-settings", settings_matches)) => {
+ Some(("udp2tcp", settings_matches)) => {
let port: String = settings_matches.value_of_t_or_exit("port");
let mut rpc = new_rpc_client().await?;
let mut settings = Self::get_obfuscation_settings(&mut rpc).await?;
@@ -68,13 +68,14 @@ impl Obfuscation {
Ok(())
}
- async fn handle_get(matches: &clap::ArgMatches) -> Result<()> {
+ async fn handle_get() -> Result<()> {
let mut rpc = new_rpc_client().await?;
- let settings = Self::get_obfuscation_settings(&mut rpc).await?;
- match matches.subcommand() {
- Some(("udp2tcp-settings", _)) => println!("Udp2Tcp: {}", settings.udp2tcp),
- _ => println!("Current settings: {}", settings),
- }
+ let obfuscation_settings = Self::get_obfuscation_settings(&mut rpc).await?;
+ println!(
+ "Obfuscation mode: {}",
+ obfuscation_settings.selected_obfuscation
+ );
+ println!("udp2tcp settings: {}", obfuscation_settings.udp2tcp);
Ok(())
}
@@ -119,7 +120,7 @@ fn create_obfuscation_set_subcommand() -> clap::App<'static> {
),
)
.subcommand(
- clap::App::new("udp2tcp-settings")
+ clap::App::new("udp2tcp")
.about("Specifies the config for the udp2tcp obfuscator")
.setting(clap::AppSettings::ArgRequiredElseHelp)
.arg(
@@ -132,10 +133,5 @@ fn create_obfuscation_set_subcommand() -> clap::App<'static> {
}
fn create_obfuscation_get_subcommand() -> clap::App<'static> {
- clap::App::new("get")
- .about("Get obfuscation settings")
- .subcommand(
- clap::App::new("udp2tcp-settings")
- .about("Specifies the config for the udp2tcp obfuscator"),
- )
+ clap::App::new("get").about("Get current obfuscation settings")
}