diff options
| -rw-r--r-- | mullvad-daemon/src/relays.rs | 34 | ||||
| -rw-r--r-- | mullvad-types/src/relay_constraints.rs | 2 |
2 files changed, 35 insertions, 1 deletions
diff --git a/mullvad-daemon/src/relays.rs b/mullvad-daemon/src/relays.rs index 5b60369ad6..82a60fff55 100644 --- a/mullvad-daemon/src/relays.rs +++ b/mullvad-daemon/src/relays.rs @@ -323,6 +323,40 @@ impl RelaySelector { relay_constraints } + pub fn get_tunnel_exit_endpoint( + &mut self, + relay_constraints: &RelayConstraints, + ) -> Option<(Relay, MullvadEndpoint)> { + if relay_constraints.tunnel_protocol != Constraint::Only(TunnelType::Wireguard) + && relay_constraints.tunnel_protocol != Constraint::Any + { + return None; + } + if relay_constraints + .wireguard_constraints + .exit_location + .is_none() + { + return None; + } + + let exit_constraints = RelayConstraints { + location: relay_constraints + .wireguard_constraints + .exit_location + .clone() + .unwrap(), + tunnel_protocol: Constraint::Only(TunnelType::Wireguard), + providers: relay_constraints.providers.clone(), + wireguard_constraints: WireguardConstraints { + exit_location: None, + ..WireguardConstraints::default() + }, + ..RelayConstraints::default() + }; + self.get_tunnel_endpoint_internal(&exit_constraints) + } + pub fn get_auto_proxy_settings( &mut self, bridge_constraints: &InternalBridgeConstraints, diff --git a/mullvad-types/src/relay_constraints.rs b/mullvad-types/src/relay_constraints.rs index ab57c62529..6ad47c8af8 100644 --- a/mullvad-types/src/relay_constraints.rs +++ b/mullvad-types/src/relay_constraints.rs @@ -439,7 +439,7 @@ impl Match<OpenVpnEndpointData> for OpenVpnConstraints { pub struct WireguardConstraints { pub port: Constraint<u16>, pub ip_version: Constraint<IpVersion>, - pub exit_location: Option<LocationConstraint>, + pub exit_location: Option<Constraint<LocationConstraint>>, } impl fmt::Display for WireguardConstraints { |
