diff options
| author | Linus Färnstrand <linus@mullvad.net> | 2022-04-14 13:32:01 +0200 |
|---|---|---|
| committer | Linus Färnstrand <linus@mullvad.net> | 2022-04-14 13:32:01 +0200 |
| commit | da4e9e8cea4a2c10370842dc9f404d41190fd919 (patch) | |
| tree | 092776ce088982c061b530be9a1e72d551404587 | |
| parent | 3bace688e87bc4836d5e8e9ce5306ee14f0f5c78 (diff) | |
| parent | 6e6d7ea7f7fbe389824e55112847b263e1542005 (diff) | |
| download | mullvadvpn-da4e9e8cea4a2c10370842dc9f404d41190fd919.tar.xz mullvadvpn-da4e9e8cea4a2c10370842dc9f404d41190fd919.zip | |
Merge branch 'clarify-cli-obfuscation-and-bridges'
| -rw-r--r-- | mullvad-cli/src/cmds/bridge.rs | 7 | ||||
| -rw-r--r-- | mullvad-cli/src/cmds/obfuscation.rs | 37 | ||||
| -rw-r--r-- | mullvad-cli/src/cmds/split_tunnel/linux.rs | 2 | ||||
| -rw-r--r-- | mullvad-types/src/relay_constraints.rs | 39 |
4 files changed, 36 insertions, 49 deletions
diff --git a/mullvad-cli/src/cmds/bridge.rs b/mullvad-cli/src/cmds/bridge.rs index e1b0056a15..40afc93b3b 100644 --- a/mullvad-cli/src/cmds/bridge.rs +++ b/mullvad-cli/src/cmds/bridge.rs @@ -18,7 +18,12 @@ impl Command for Bridge { fn clap_subcommand(&self) -> clap::App<'static> { clap::App::new(self.name()) - .about("Manage use of bridges") + .about( + "Manage use of bridges, socks proxies and Shadowsocks for OpenVPN. \ + Can make OpenVPN tunnels use Shadowsocks via one of the Mullvad bridge servers. \ + Can also make OpenVPN connect through any custom SOCKS5 proxy. \ + These settings also affect how the app reaches the API over Shadowsocks.", + ) .setting(clap::AppSettings::SubcommandRequiredElseHelp) .subcommand(create_bridge_set_subcommand()) .subcommand(clap::App::new("get").about("Get current bridge settings and state")) diff --git a/mullvad-cli/src/cmds/obfuscation.rs b/mullvad-cli/src/cmds/obfuscation.rs index 99887db555..3f015c896e 100644 --- a/mullvad-cli/src/cmds/obfuscation.rs +++ b/mullvad-cli/src/cmds/obfuscation.rs @@ -16,7 +16,11 @@ impl Command for Obfuscation { fn clap_subcommand(&self) -> clap::App<'static> { clap::App::new(self.name()) - .about("Manage use of obfuscators") + .about( + "Manage use of obfuscation protocols for WireGuard. \ + Can make WireGuard traffic look like something else on the network. \ + Helps circumvent censorship and to establish a tunnel when on restricted networks", + ) .setting(clap::AppSettings::SubcommandRequiredElseHelp) .subcommand(create_obfuscation_set_subcommand()) .subcommand(create_obfuscation_get_subcommand()) @@ -25,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"), } } @@ -46,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?; @@ -64,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(()) } @@ -105,14 +110,17 @@ fn create_obfuscation_set_subcommand() -> clap::App<'static> { .subcommand( clap::App::new("mode").about("Set obfuscation mode").arg( clap::Arg::new("mode") - .help("Specifies what kind of obfuscation should be used, if any") + .help( + "Specifies if obfuscation should be used with WireGuard connections. \ + And if so, what obfuscation protocol it should use.", + ) .required(true) .index(1) .possible_values(&["auto", "off", "udp2tcp"]), ), ) .subcommand( - clap::App::new("udp2tcp-settings") + clap::App::new("udp2tcp") .about("Specifies the config for the udp2tcp obfuscator") .setting(clap::AppSettings::ArgRequiredElseHelp) .arg( @@ -125,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") } diff --git a/mullvad-cli/src/cmds/split_tunnel/linux.rs b/mullvad-cli/src/cmds/split_tunnel/linux.rs index 3480f27fb0..03ee913b3e 100644 --- a/mullvad-cli/src/cmds/split_tunnel/linux.rs +++ b/mullvad-cli/src/cmds/split_tunnel/linux.rs @@ -12,7 +12,7 @@ impl Command for SplitTunnel { clap::App::new(self.name()) .about( "Manage split tunneling. To launch applications outside \ - the tunnel, use the program 'mullvad-exclude'.", + the tunnel, use the program 'mullvad-exclude' instead of this command.", ) .setting(clap::AppSettings::SubcommandRequiredElseHelp) .subcommand(create_pid_subcommand()) diff --git a/mullvad-types/src/relay_constraints.rs b/mullvad-types/src/relay_constraints.rs index 96d1014592..e3fd854df3 100644 --- a/mullvad-types/src/relay_constraints.rs +++ b/mullvad-types/src/relay_constraints.rs @@ -480,15 +480,11 @@ impl Default for SelectedObfuscation { impl fmt::Display for SelectedObfuscation { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - write!( - f, - "{}", - match self { - SelectedObfuscation::Auto => "auto", - SelectedObfuscation::Off => "off", - SelectedObfuscation::Udp2Tcp => "udp2tcp", - } - ) + match self { + SelectedObfuscation::Auto => "auto".fmt(f), + SelectedObfuscation::Off => "off".fmt(f), + SelectedObfuscation::Udp2Tcp => "udp2tcp".fmt(f), + } } } @@ -500,15 +496,10 @@ pub struct Udp2TcpObfuscationSettings { impl fmt::Display for Udp2TcpObfuscationSettings { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - write!( - f, - "port: {}", - match self.port { - Constraint::Any => "any".to_string(), - Constraint::Only(port) => port.to_string(), - } - )?; - Ok(()) + match self.port { + Constraint::Any => write!(f, "any port"), + Constraint::Only(port) => write!(f, "port {}", port), + } } } @@ -521,18 +512,6 @@ pub struct ObfuscationSettings { pub udp2tcp: Udp2TcpObfuscationSettings, } -impl fmt::Display for ObfuscationSettings { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> { - write!(f, "selected obfuscation: ")?; - match self.selected_obfuscation { - SelectedObfuscation::Auto => write!(f, "auto")?, - SelectedObfuscation::Off => write!(f, "off")?, - SelectedObfuscation::Udp2Tcp => write!(f, "Udp2Tcp ({})", self.udp2tcp)?, - }; - Ok(()) - } -} - /// Limits the set of bridge servers to use in `mullvad-daemon`. #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(default)] |
