Skip to content

Commit

Permalink
Merge branch 'openvpn-servers-used-by-relay-selector-droid-565'
Browse files Browse the repository at this point in the history
  • Loading branch information
Pururun committed Dec 11, 2023
2 parents 6f78939 + 5bc23d3 commit 821d36f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ Line wrap the file at 100 chars. Th
#### Linux
- Prevent fragmentation when multihop is enabled by setting a default route MTU.

#### Android
- Fix issue with the app under some circumstances trying to connect to OpenVPN relays.

## [2023.6] - 2023-12-06
### Changed
Expand Down
11 changes: 11 additions & 0 deletions mullvad-relay-selector/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@ impl RelaySelector {

/// Returns a random relay and relay endpoint matching the given constraints and with
/// preferences applied.
#[cfg_attr(target_os = "android", allow(unused_variables))]
fn get_tunnel_endpoint(
&self,
relay_constraints: &RelayConstraints,
Expand All @@ -339,6 +340,12 @@ impl RelaySelector {
default_tunnel_type: TunnelType,
custom_lists: &CustomListsSettings,
) -> Result<NormalSelectedRelay, Error> {
#[cfg(target_os = "android")]
{
self.get_wireguard_endpoint(relay_constraints, retry_attempt, custom_lists)
}

#[cfg(not(target_os = "android"))]
match relay_constraints.tunnel_protocol {
Constraint::Only(TunnelType::OpenVpn) => self.get_openvpn_endpoint(
relay_constraints,
Expand Down Expand Up @@ -402,6 +409,7 @@ impl RelaySelector {

/// Returns an OpenVpn endpoint, should only ever be used when the user has specified the tunnel
/// protocol as only OpenVPN.
#[cfg_attr(target_os = "android", allow(dead_code))]
fn get_openvpn_endpoint(
&self,
relay_constraints: &RelayConstraints,
Expand Down Expand Up @@ -585,6 +593,7 @@ impl RelaySelector {
}

/// Like [Self::get_tunnel_endpoint_internal] but also selects an entry endpoint if applicable.
#[cfg_attr(target_os = "android", allow(dead_code))]
fn get_multihop_tunnel_endpoint_internal(
&self,
relay_constraints: &RelayConstraints,
Expand Down Expand Up @@ -674,6 +683,7 @@ impl RelaySelector {

/// Returns a tunnel endpoint of any type, should only be used when the user hasn't specified a
/// tunnel protocol.
#[cfg_attr(target_os = "android", allow(dead_code))]
fn get_any_tunnel_endpoint(
&self,
relay_constraints: &RelayConstraints,
Expand Down Expand Up @@ -719,6 +729,7 @@ impl RelaySelector {
}

// This function ignores the tunnel type constraint on purpose.
#[cfg_attr(target_os = "android", allow(dead_code))]
fn preferred_constraints(
&self,
original_constraints: &RelayConstraints,
Expand Down

0 comments on commit 821d36f

Please sign in to comment.