diff options
| -rw-r--r-- | docs/relay-selector.md | 4 | ||||
| -rw-r--r-- | mullvad-relay-selector/src/lib.rs | 11 |
2 files changed, 7 insertions, 8 deletions
diff --git a/docs/relay-selector.md b/docs/relay-selector.md index a4c4b8a249..7dca137657 100644 --- a/docs/relay-selector.md +++ b/docs/relay-selector.md @@ -63,8 +63,8 @@ constraints, following default ones will take effect: _udp2tcp_ all of the time. If obfuscation is turned _off_, WireGuard connections will first alternate between using - a random port and port 53, with 2 attempts each, e.g. first attempt using port 22151, second - 26107, third attempt and fourth attempt using port 53, and then back to random ports. + a random port and port 53, e.g. first attempt using port 22151, second 53, third + 26107, fourth attempt using port 53, and so on. If the user has specified a specific port for either _udp2tcp_ or WireGuard, it will override the port selection, but it will not change the connection type described above (WireGuard or WireGuard diff --git a/mullvad-relay-selector/src/lib.rs b/mullvad-relay-selector/src/lib.rs index c10d999afb..77bad9e8ab 100644 --- a/mullvad-relay-selector/src/lib.rs +++ b/mullvad-relay-selector/src/lib.rs @@ -1158,12 +1158,11 @@ impl RelaySelector { } const fn preferred_wireguard_port(retry_attempt: u32) -> Constraint<u16> { - // This ensures that if after the first 2 failed attempts the daemon does not - // connect, then afterwards 2 of each 4 successive attempts will try to connect - // on port 53. - match retry_attempt % 4 { - 0 | 1 => Constraint::Any, - _ => Constraint::Only(53), + // Alternate between using a random port and port 53 + if retry_attempt % 2 == 0 { + Constraint::Any + } else { + Constraint::Only(53) } } |
