Skip to content

Commit

Permalink
Fix Android build
Browse files Browse the repository at this point in the history
Fix Android build after removing `WireguardMatcher::new_matcher`
  • Loading branch information
MarkusPettersson98 committed Mar 15, 2024
1 parent bc58533 commit de7835e
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 11 deletions.
29 changes: 21 additions & 8 deletions mullvad-relay-selector/src/relay_selector/matcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,20 +36,33 @@ impl<'a> RelayMatcher<AnyTunnelMatcher<'a>> {
wireguard_data: &'a WireguardEndpointData,
custom_lists: &CustomListsSettings,
) -> RelayMatcher<AnyTunnelMatcher<'a>> {
Self {
let endpoint_matcher = AnyTunnelMatcher {
wireguard: WireguardMatcher::new(query.wireguard_constraints.clone(), wireguard_data),
openvpn: OpenVpnMatcher::new(
query.openvpn_constraints.clone(),
openvpn_data,
bridge_state,
),
tunnel_type: query.tunnel_protocol,
};
Self::using(query, custom_lists, endpoint_matcher)
}
}

impl<T: EndpointMatcher> RelayMatcher<T> {
pub fn using(
query: RelayQuery,
custom_lists: &CustomListsSettings,
endpoint_matcher: T,
) -> RelayMatcher<T> {
RelayMatcher {
locations: ResolvedLocationConstraint::from_constraint(query.location, custom_lists),
providers: query.providers,
ownership: query.ownership,
endpoint_matcher: AnyTunnelMatcher {
wireguard: WireguardMatcher::new(query.wireguard_constraints, wireguard_data),
openvpn: OpenVpnMatcher::new(query.openvpn_constraints, openvpn_data, bridge_state),
tunnel_type: query.tunnel_protocol,
},
endpoint_matcher,
}
}
}

impl<T: EndpointMatcher> RelayMatcher<T> {
/// Filter a list of relays and their endpoints based on constraints.
/// Only relays with (and including) matching endpoints are returned.
pub fn filter_matching_relay_list<'a, R: Iterator<Item = &'a Relay> + Clone>(
Expand Down
7 changes: 4 additions & 3 deletions mullvad-relay-selector/src/relay_selector/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -909,12 +909,13 @@ impl RelaySelector {
config: &NormalSelectorConfig<'_>,
parsed_relays: &ParsedRelays,
) -> Vec<Relay> {
use self::matcher::WireguardMatcher;
let relays = parsed_relays.relays();
let matcher = WireguardMatcher::new_matcher(
query.clone(),
let endpoint_matcher = WireguardMatcher::new(
query.wireguard_constraints.clone(),
&parsed_relays.parsed_list().wireguard,
config.custom_lists,
);
let matcher = RelayMatcher::using(query.clone(), config.custom_lists, endpoint_matcher);
matcher.filter_matching_relay_list(relays)
}
}

0 comments on commit de7835e

Please sign in to comment.