Skip to content

Commit

Permalink
Remove mention of special automatic tunnel protocol logic on Windows,
Browse files Browse the repository at this point in the history
and other vestiges
  • Loading branch information
dlon committed Dec 7, 2023
1 parent 1744f62 commit f7e6d9d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 41 deletions.
12 changes: 3 additions & 9 deletions docs/relay-selector.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,9 @@ Endpoints may be filtered by:
Whilst all user selected constraints are always honored, when the user hasn't selected any specific
constraints, following default ones will take effect:

- If no tunnel protocol is specified for tunnel endpoints, then the behavior is different on Windows
and other platforms.
- On MacOS and Linux, first two connection attempts will use WireGuard, over a random port at
first and then port 53. From the third attempt onwards, OpenVPN will be used, alternating
between UDP on any port and TCP on port 443.
- On Windows, a migration to WireGuard is ongoing and a percentage value provided by the API tells
clients to randomly decide if they will use WireGuard as a default or OpenVPN as a default.
The client's decision will persist over time.
If the client decides to use WireGuard it will have the same behavior as MacOS and Linux.
- If no tunnel protocol is specified, the first two connection attempts will use WireGuard, over a
random port at first and then port 53. From the third attempt onwards, OpenVPN will be used,
alternating between UDP on any port and TCP on port 443.

- If the tunnel protocol is specified as WireGuard and obfuscation mode is set to _Auto_:
- First two attempts will be used without _udp2tcp_, using a random port on first attempt, and
Expand Down
33 changes: 1 addition & 32 deletions mullvad-relay-selector/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1174,9 +1174,7 @@ impl RelaySelector {
// between protocols.
// If the tunnel type constraint is set OpenVpn, from the 4th attempt onwards, the first
// two retry attempts OpenVpn constraints should be set to TCP as a bridge will be used,
// and to UDP or TCP for the next two attempts. If the tunnel type is specified to be _Any_
// and on not-Windows, the first two tries are used for WireGuard and don't
// affect counting here.
// and to UDP or TCP for the next two attempts.
match retry_attempt {
0 | 1 => (Constraint::Any, TransportProtocol::Udp),
2 | 3 => (Constraint::Only(443), TransportProtocol::Tcp),
Expand Down Expand Up @@ -1563,35 +1561,6 @@ mod test {
)
.is_ok());
}

// Prefer OpenVPN on Windows when possible
#[cfg(windows)]
{
let relay_constraints = RelayConstraints::default();
for attempt in 0..10 {
let preferred = relay_selector.preferred_constraints(
&relay_constraints,
BridgeState::Off,
attempt,
TunnelType::OpenVpn,
&CustomListsSettings::default(),
);
assert_eq!(
preferred.tunnel_protocol,
Constraint::Only(TunnelType::OpenVpn)
);
match relay_selector.get_any_tunnel_endpoint(
&relay_constraints,
BridgeState::Off,
attempt,
TunnelType::OpenVpn,
&CustomListsSettings::default(),
) {
Ok(result) if matches!(result.endpoint, MullvadEndpoint::OpenVpn(_)) => (),
_ => panic!("OpenVPN endpoint was not selected"),
}
}
}
}

#[test]
Expand Down

0 comments on commit f7e6d9d

Please sign in to comment.