Skip to content

Commit

Permalink
Add Shadowsocks to retry order
Browse files Browse the repository at this point in the history
Co-authored-by: Sebastian Holmin <[email protected]>
  • Loading branch information
dlon and Serock3 committed Aug 27, 2024
1 parent 766f211 commit 9d922b2
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 13 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ 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`.
`mullvad obfuscation set mode shadowsocks`. This will also be used automatically when connecting
fails with other methods.

#### Windows
- Add experimental support for Windows ARM64.
Expand Down
5 changes: 3 additions & 2 deletions docs/relay-selector.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,11 @@ constraints the following default ones will take effect:
- The second attempt will connect to a Wireguard relay on port 443
- The third attempt will connect to a Wireguard relay over IPv6 (if IPv6 is configured on the host) on a random port
- The fourth-to-seventh attempt will alternate between Wireguard and OpenVPN
- The fourth attempt will connect to an OpenVPN relay over TCP on port 443
- The fourth attempt will connect to a Wireguard relay on a random port using Shadowsocks for obfuscation
- The fifth attempt will connect to a Wireguard relay on a random port using [UDP2TCP obfuscation](https://github.com/mullvad/udp-over-tcp)
- The sixth attempt will connect to a Wireguard relay over IPv6 on a random port using UDP2TCP obfuscation (if IPv6 is configured on the host)
- The seventh attempt will connect to an OpenVPN relay over a bridge on a random port
- The seventh attempt will connect to an OpenVPN relay over TCP on port 443
- The eighth attempt will connect to an OpenVPN relay over a bridge on a random port

If no tunnel has been established after exhausting this list of attempts, the relay selector will
loop back to the first default constraint and continue its search from there.
Expand Down
12 changes: 7 additions & 5 deletions mullvad-relay-selector/src/relay_selector/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,7 @@ pub static RETRY_ORDER: Lazy<Vec<RelayQuery>> = Lazy::new(|| {
.ip_version(IpVersion::V6)
.build(),
// 4
RelayQueryBuilder::new()
.openvpn()
.transport_protocol(TransportProtocol::Tcp)
.port(443)
.build(),
RelayQueryBuilder::new().wireguard().shadowsocks().build(),
// 5
RelayQueryBuilder::new().wireguard().udp2tcp().build(),
// 6
Expand All @@ -82,6 +78,12 @@ pub static RETRY_ORDER: Lazy<Vec<RelayQuery>> = Lazy::new(|| {
.ip_version(IpVersion::V6)
.build(),
// 7
RelayQueryBuilder::new()
.openvpn()
.transport_protocol(TransportProtocol::Tcp)
.port(443)
.build(),
// 8
RelayQueryBuilder::new()
.openvpn()
.transport_protocol(TransportProtocol::Tcp)
Expand Down
12 changes: 7 additions & 5 deletions mullvad-relay-selector/tests/relay_selector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -290,11 +290,7 @@ fn assert_retry_order() {
.ip_version(IpVersion::V6)
.build(),
// 4
RelayQueryBuilder::new()
.openvpn()
.transport_protocol(TransportProtocol::Tcp)
.port(443)
.build(),
RelayQueryBuilder::new().wireguard().shadowsocks().build(),
// 5
RelayQueryBuilder::new().wireguard().udp2tcp().build(),
// 6
Expand All @@ -304,6 +300,12 @@ fn assert_retry_order() {
.ip_version(IpVersion::V6)
.build(),
// 7
RelayQueryBuilder::new()
.openvpn()
.transport_protocol(TransportProtocol::Tcp)
.port(443)
.build(),
// 8
RelayQueryBuilder::new()
.openvpn()
.transport_protocol(TransportProtocol::Tcp)
Expand Down

0 comments on commit 9d922b2

Please sign in to comment.