summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorErik Larkö <erik@mullvad.net>2017-09-08 13:13:01 +0200
committerErik Larkö <erik@mullvad.net>2017-09-13 07:32:26 +0200
commit6f0b92ab5ed6d6b12664a052425dd94918e1110d (patch)
treedf5adb60434f8fe06f91e3277f1efde5c613afcb
parent6d724d021fb14a9885284c302fdbc9718b0338f9 (diff)
downloadmullvadvpn-6f0b92ab5ed6d6b12664a052425dd94918e1110d.tar.xz
mullvadvpn-6f0b92ab5ed6d6b12664a052425dd94918e1110d.zip
Remove custom relay in cli
-rw-r--r--mullvad-cli/src/cmds/custom_relay.rs14
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"))
+ }
}