diff options
| author | Erik Larkö <erik@mullvad.net> | 2017-09-08 13:13:01 +0200 |
|---|---|---|
| committer | Erik Larkö <erik@mullvad.net> | 2017-09-13 07:32:26 +0200 |
| commit | 6f0b92ab5ed6d6b12664a052425dd94918e1110d (patch) | |
| tree | df5adb60434f8fe06f91e3277f1efde5c613afcb /mullvad-cli/src | |
| parent | 6d724d021fb14a9885284c302fdbc9718b0338f9 (diff) | |
| download | mullvadvpn-6f0b92ab5ed6d6b12664a052425dd94918e1110d.tar.xz mullvadvpn-6f0b92ab5ed6d6b12664a052425dd94918e1110d.zip | |
Remove custom relay in cli
Diffstat (limited to 'mullvad-cli/src')
| -rw-r--r-- | mullvad-cli/src/cmds/custom_relay.rs | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/mullvad-cli/src/cmds/custom_relay.rs b/mullvad-cli/src/cmds/custom_relay.rs index 2272f3b7c2..90b4b5bd0e 100644 --- a/mullvad-cli/src/cmds/custom_relay.rs +++ b/mullvad-cli/src/cmds/custom_relay.rs @@ -16,7 +16,7 @@ impl Command for CustomRelay { fn clap_subcommand(&self) -> clap::App<'static, 'static> { clap::SubCommand::with_name(self.name()) - .about("Set a custom remote relay to connect to") + .about("Set or remove custom remote relay") .setting(clap::AppSettings::SubcommandRequired) .subcommand(clap::SubCommand::with_name("set") .about("Set a custom remote relay") @@ -30,6 +30,8 @@ impl Command for CustomRelay { .help("The transport protocol. UDP is recommended as it usually results in higher throughput that TCP") .possible_values(&["udp", "tcp"]) .default_value("udp"))) + .subcommand(clap::SubCommand::with_name("remove") + .about("Remove the custom remote server and use the default remotes instead")) } fn run(&self, matches: &clap::ArgMatches) -> Result<()> { @@ -39,6 +41,8 @@ impl Command for CustomRelay { let protocol = value_t_or_exit!(set_matches.value_of("protocol"), TransportProtocol); self.set(host, port, protocol) + } else if let Some(_) = matches.subcommand_matches("remove") { + self.remove() } else { unreachable!("No sub command given"); } @@ -59,4 +63,12 @@ impl CustomRelay { ) .map(|_: Option<()>| println!("Custom remote relay set")) } + + fn remove(&self) -> Result<()> { + rpc::call( + "remove_custom_relay", + &[] as &[u8; 0], + ) + .map(|_: Option<()>| println!("Custom relay removed")) + } } |
