summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorDavid Lönnhager <david.l@mullvad.net>2025-09-24 12:54:01 +0200
committerDavid Lönnhager <david.l@mullvad.net>2025-09-30 16:09:04 +0200
commit2f5dc7fd40898db547b4560d028774c9cc602630 (patch)
tree4e93c1acf38e17aa478bcfa46812388f64246364
parent37a0dfc745351ee0ab673c0da36b0d5ffc189876 (diff)
downloadmullvadvpn-2f5dc7fd40898db547b4560d028774c9cc602630.tar.xz
mullvadvpn-2f5dc7fd40898db547b4560d028774c9cc602630.zip
Add relay list selector test for LWO
-rw-r--r--mullvad-relay-selector/src/relay_selector/query.rs22
-rw-r--r--mullvad-relay-selector/tests/relay_selector.rs29
2 files changed, 50 insertions, 1 deletions
diff --git a/mullvad-relay-selector/src/relay_selector/query.rs b/mullvad-relay-selector/src/relay_selector/query.rs
index a3fe4a24f9..4e4813a9dd 100644
--- a/mullvad-relay-selector/src/relay_selector/query.rs
+++ b/mullvad-relay-selector/src/relay_selector/query.rs
@@ -652,6 +652,12 @@ pub mod builder {
/// in the mullvad-types crate.
pub struct Quic;
+ /// LWO obfuscation.
+ ///
+ /// LWO does not have any user-configurable parameters, so there is no type defined
+ /// in the mullvad-types crate.
+ pub struct Lwo;
+
// This impl-block is quantified over all configurations
impl<Multihop, Obfuscation, Daita, QuantumResistant>
RelayQueryBuilder<Wireguard<Multihop, Obfuscation, Daita, QuantumResistant>>
@@ -825,6 +831,22 @@ pub mod builder {
},
}
}
+
+ /// Enable LWO obfuscation.
+ pub fn lwo(
+ mut self,
+ ) -> RelayQueryBuilder<Wireguard<Multihop, Lwo, Daita, QuantumResistant>> {
+ self.query.wireguard_constraints.obfuscation = ObfuscationQuery::Lwo;
+ RelayQueryBuilder {
+ query: self.query,
+ protocol: Wireguard {
+ multihop: self.protocol.multihop,
+ obfuscation: Lwo,
+ daita: self.protocol.daita,
+ quantum_resistant: self.protocol.quantum_resistant,
+ },
+ }
+ }
}
impl<Multihop, Daita, QuantumResistant>
diff --git a/mullvad-relay-selector/tests/relay_selector.rs b/mullvad-relay-selector/tests/relay_selector.rs
index 3e60e39e96..30115d136d 100644
--- a/mullvad-relay-selector/tests/relay_selector.rs
+++ b/mullvad-relay-selector/tests/relay_selector.rs
@@ -79,7 +79,8 @@ static RELAYS: LazyLock<RelayList> = LazyLock::new(|| RelayList {
],
"Bearer test".to_owned(),
"se9-wireguard.blockerad.eu".to_owned(),
- )),
+ ))
+ .set_lwo(true),
),
location: DUMMY_LOCATION.clone(),
},
@@ -925,6 +926,32 @@ fn test_selecting_openvpn_and_quic() {
.expect("OpenVPN should not be affected by QUIC");
}
+/// Test LWO relay selection
+#[test]
+fn test_selecting_wireguard_over_lwo() {
+ let relay_selector = RelaySelector::from_list(SelectorConfig::default(), RELAYS.clone());
+
+ let query = RelayQueryBuilder::wireguard().lwo().build();
+ assert!(!query.wireguard_constraints().multihop());
+
+ let relay = relay_selector.get_relay_by_query(query).unwrap();
+ match relay {
+ GetRelay::Wireguard {
+ obfuscator,
+ inner: WireguardConfig::Singlehop { .. },
+ ..
+ } => {
+ assert!(obfuscator.is_some_and(|obfuscator| matches!(
+ obfuscator.config,
+ Obfuscators::Single(ObfuscatorConfig::Lwo { .. }),
+ )))
+ }
+ wrong_relay => panic!(
+ "Relay selector should have picked a Wireguard relay with LWO, instead chose {wrong_relay:?}"
+ ),
+ }
+}
+
/// Selecting WG IPv6 should not affect OpenVPN
#[test]
fn test_selecting_openvpn_and_wg_ipv6() {