Skip to content

Commit

Permalink
Merge branch 'add-shadowsocks-obfuscation-cli'
Browse files Browse the repository at this point in the history
  • Loading branch information
dlon committed Aug 26, 2024
2 parents 423bd57 + 7a77d26 commit b235a4d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
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

0 comments on commit b235a4d

Please sign in to comment.