summaryrefslogtreecommitdiffhomepage
path: root/mullvad-cli/src/cmds/split_tunnel.rs
diff options
context:
space:
mode:
authorDavid Lönnhager <david.l@mullvad.net>2020-06-02 13:11:36 +0200
committerDavid Lönnhager <david.l@mullvad.net>2020-06-04 14:48:25 +0200
commit1551534cdb1cada7579a1f2e281f2d9927474455 (patch)
tree99e286364d34d8d4f26f838bfe09b2f7c39e8bd4 /mullvad-cli/src/cmds/split_tunnel.rs
parent76a75a268abb1ac8daeffd39087c96cc6fe688c0 (diff)
downloadmullvadvpn-1551534cdb1cada7579a1f2e281f2d9927474455.tar.xz
mullvadvpn-1551534cdb1cada7579a1f2e281f2d9927474455.zip
Fix names conflicting with split_tunnel modules on Windows
Diffstat (limited to 'mullvad-cli/src/cmds/split_tunnel.rs')
-rw-r--r--mullvad-cli/src/cmds/split_tunnel.rs70
1 files changed, 0 insertions, 70 deletions
diff --git a/mullvad-cli/src/cmds/split_tunnel.rs b/mullvad-cli/src/cmds/split_tunnel.rs
deleted file mode 100644
index 95b172eb6b..0000000000
--- a/mullvad-cli/src/cmds/split_tunnel.rs
+++ /dev/null
@@ -1,70 +0,0 @@
-use crate::{new_rpc_client, Command, Result};
-use clap::value_t_or_exit;
-
-pub struct SplitTunnel;
-
-impl Command for SplitTunnel {
- fn name(&self) -> &'static str {
- "split-tunnel"
- }
-
- fn clap_subcommand(&self) -> clap::App<'static, 'static> {
- clap::SubCommand::with_name(self.name())
- .about("Manage split tunneling")
- .setting(clap::AppSettings::SubcommandRequiredElseHelp)
- .subcommand(create_pid_subcommand())
- }
-
- fn run(&self, matches: &clap::ArgMatches<'_>) -> Result<()> {
- match matches.subcommand() {
- ("pid", Some(pid_matches)) => Self::handle_pid_cmd(pid_matches),
- _ => unreachable!("unhandled comand"),
- }
- }
-}
-
-fn create_pid_subcommand() -> clap::App<'static, 'static> {
- clap::SubCommand::with_name("pid")
- .about("Manage processes to exclude from the tunnel")
- .setting(clap::AppSettings::SubcommandRequiredElseHelp)
- .subcommand(
- clap::SubCommand::with_name("add").arg(clap::Arg::with_name("pid").required(true)),
- )
- .subcommand(
- clap::SubCommand::with_name("delete").arg(clap::Arg::with_name("pid").required(true)),
- )
- .subcommand(clap::SubCommand::with_name("clear"))
- .subcommand(clap::SubCommand::with_name("list"))
-}
-
-impl SplitTunnel {
- fn handle_pid_cmd(matches: &clap::ArgMatches<'_>) -> Result<()> {
- match matches.subcommand() {
- ("add", Some(matches)) => {
- let pid = value_t_or_exit!(matches.value_of("pid"), i32);
- new_rpc_client()?.add_split_tunnel_process(pid)?;
- Ok(())
- }
- ("delete", Some(matches)) => {
- let pid = value_t_or_exit!(matches.value_of("pid"), i32);
- new_rpc_client()?.remove_split_tunnel_process(pid)?;
- Ok(())
- }
- ("clear", Some(_)) => {
- new_rpc_client()?.clear_split_tunnel_processes()?;
- Ok(())
- }
- ("list", Some(_)) => {
- let pids = new_rpc_client()?.get_split_tunnel_processes()?;
- println!("Excluded PIDs:");
-
- for pid in pids.iter() {
- println!(" {}", pid);
- }
-
- Ok(())
- }
- _ => unreachable!("unhandled command"),
- }
- }
-}