Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CLI for shadowsocks obfuscation #6629

Merged
merged 2 commits into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ Line wrap the file at 100 chars. Th

## [Unreleased]
### Added
- Add WireGuard over Shadowsocks obfuscation to the CLI. It can be enabled with
`mullvad obfuscation set mode shadowsocks`.

#### Windows
- Add experimental support for Windows ARM64.

Expand Down
24 changes: 20 additions & 4 deletions mullvad-cli/src/cmds/obfuscation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ use clap::Subcommand;
use mullvad_management_interface::MullvadProxyClient;
use mullvad_types::{
constraints::Constraint,
relay_constraints::{ObfuscationSettings, SelectedObfuscation, Udp2TcpObfuscationSettings},
relay_constraints::{
ObfuscationSettings, SelectedObfuscation, ShadowsocksSettings, Udp2TcpObfuscationSettings,
},
};

#[derive(Subcommand, Debug)]
Expand All @@ -18,16 +20,22 @@ pub enum Obfuscation {

#[derive(Subcommand, Debug, Clone)]
pub enum SetCommands {
/// Specifies if obfuscation should be used with WireGuard connections.
/// And if so, what obfuscation protocol it should use.
/// Specify which obfuscation protocol to use, if any.
Mode { mode: SelectedObfuscation },

/// Specifies the config for the udp2tcp obfuscator.
/// Configure udp2tcp obfuscation.
Udp2tcp {
/// Port to use, or 'any'
#[arg(long, short = 'p')]
port: Constraint<u16>,
},

/// Configure Shadowsocks obfuscation.
Shadowsocks {
/// Port to use, or 'any'
#[arg(long, short = 'p')]
port: Constraint<u16>,
},
}

impl Obfuscation {
Expand All @@ -41,6 +49,7 @@ impl Obfuscation {
obfuscation_settings.selected_obfuscation
);
println!("udp2tcp settings: {}", obfuscation_settings.udp2tcp);
println!("Shadowsocks settings: {}", obfuscation_settings.shadowsocks);
Ok(())
}
Obfuscation::Set(subcmd) => Self::set(subcmd).await,
Expand All @@ -66,6 +75,13 @@ impl Obfuscation {
})
.await?;
}
SetCommands::Shadowsocks { port } => {
rpc.set_obfuscation_settings(ObfuscationSettings {
shadowsocks: ShadowsocksSettings { port },
..current_settings
})
.await?;
}
}

println!("Updated obfuscation settings");
Expand Down
Loading