summaryrefslogtreecommitdiffhomepage
path: root/talpid-core/src
diff options
context:
space:
mode:
authorMarkus Pettersson <markus.pettersson@mullvad.net>2024-02-16 16:24:33 +0100
committerMarkus Pettersson <markus.pettersson@mullvad.net>2024-03-27 11:43:44 +0100
commit707ecf44bd2b21642e51c8b9f5440bc287bcc511 (patch)
tree1c4e914a879cc6d1c126db1e47019cc2f5f2cea4 /talpid-core/src
parent66f2127aed8bea1e1434c7e8efc50293ebdd9223 (diff)
downloadmullvadvpn-707ecf44bd2b21642e51c8b9f5440bc287bcc511.tar.xz
mullvadvpn-707ecf44bd2b21642e51c8b9f5440bc287bcc511.zip
Refactor `mullvad-relay-selector`
Implement a system built on 'queries' for selecting appropriate relays. A query is a set of constraints which dictates which relay(s) that *can* be chosen by the relay selector. The user's settings can naturally be expressed as a query. The semantics of merging two queries in a way that always prefer user settings is defined by the new `Intersection` trait. Split `mullvad-relay-selector` into several modules: - `query.rs`: Definition of a query on different types of relays. This module is integral to the new API of `mullvad-relay-selector` - `matcher.rs`: Logic for filtering out candidate relays based on a query. - `detailer.rs`: Logic for deriving connection details for the selected relay. - `tests/`: Integration tests for the new relay selector. These tests only use the public APIs of `RelaySelector` and make sure that the output matches the expected output in different scenarios.
Diffstat (limited to 'talpid-core/src')
-rw-r--r--talpid-core/src/tunnel_state_machine/connecting_state.rs2
-rw-r--r--talpid-core/src/tunnel_state_machine/mod.rs1
2 files changed, 2 insertions, 1 deletions
diff --git a/talpid-core/src/tunnel_state_machine/connecting_state.rs b/talpid-core/src/tunnel_state_machine/connecting_state.rs
index 71a88e64fb..96800f8a0d 100644
--- a/talpid-core/src/tunnel_state_machine/connecting_state.rs
+++ b/talpid-core/src/tunnel_state_machine/connecting_state.rs
@@ -69,7 +69,7 @@ impl ConnectingState {
match shared_values.runtime.block_on(
shared_values
.tunnel_parameters_generator
- .generate(retry_attempt),
+ .generate(retry_attempt, shared_values.connectivity.has_ipv6()),
) {
Err(err) => {
ErrorState::enter(shared_values, ErrorStateCause::TunnelParameterError(err))
diff --git a/talpid-core/src/tunnel_state_machine/mod.rs b/talpid-core/src/tunnel_state_machine/mod.rs
index 164b1741ad..02bd2bdbff 100644
--- a/talpid-core/src/tunnel_state_machine/mod.rs
+++ b/talpid-core/src/tunnel_state_machine/mod.rs
@@ -417,6 +417,7 @@ pub trait TunnelParametersGenerator: Send + 'static {
fn generate(
&mut self,
retry_attempt: u32,
+ ipv6: bool,
) -> Pin<Box<dyn Future<Output = Result<TunnelParameters, ParameterGenerationError>>>>;
}