summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorSebastian Holmin <sebastian.holmin@mullvad.net>2024-10-07 09:32:48 +0200
committerSebastian Holmin <sebastian.holmin@mullvad.net>2024-10-07 15:40:36 +0200
commitb512af0b3afa7d709d229b44973a834c3340b971 (patch)
tree2bba6bc58a12629150f99b6f5b4b35b22c75617e
parente7e77cfc14291b4d06291a1fed73a0e56924a40b (diff)
downloadmullvadvpn-b512af0b3afa7d709d229b44973a834c3340b971.tar.xz
mullvadvpn-b512af0b3afa7d709d229b44973a834c3340b971.zip
Simplify the DAITA + multihop feature indicator logic
We now simply show the "multihop" indicator there is an entry endpoint, regardless of whether it was activated manually or through DAITA. This reflects the intent to base the feature indicators on the current connection and not the user settings. There is no special indicator for "smart routing" or "direct only".
-rw-r--r--android/lib/daemon-grpc/src/main/kotlin/net/mullvad/mullvadvpn/lib/daemon/grpc/mapper/ToDomain.kt1
-rw-r--r--android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/FeatureIndicator.kt1
-rw-r--r--mullvad-types/src/features.rs39
3 files changed, 6 insertions, 35 deletions
diff --git a/android/lib/daemon-grpc/src/main/kotlin/net/mullvad/mullvadvpn/lib/daemon/grpc/mapper/ToDomain.kt b/android/lib/daemon-grpc/src/main/kotlin/net/mullvad/mullvadvpn/lib/daemon/grpc/mapper/ToDomain.kt
index 4a8ee04683..2f6a08eede 100644
--- a/android/lib/daemon-grpc/src/main/kotlin/net/mullvad/mullvadvpn/lib/daemon/grpc/mapper/ToDomain.kt
+++ b/android/lib/daemon-grpc/src/main/kotlin/net/mullvad/mullvadvpn/lib/daemon/grpc/mapper/ToDomain.kt
@@ -621,7 +621,6 @@ internal fun ManagementInterface.FeatureIndicator.toDomain() =
ManagementInterface.FeatureIndicator.CUSTOM_MTU -> FeatureIndicator.CUSTOM_MTU
ManagementInterface.FeatureIndicator.DAITA -> FeatureIndicator.DAITA
ManagementInterface.FeatureIndicator.SHADOWSOCKS -> FeatureIndicator.SHADOWSOCKS
- ManagementInterface.FeatureIndicator.DAITA_SMART_ROUTING,
ManagementInterface.FeatureIndicator.LOCKDOWN_MODE,
ManagementInterface.FeatureIndicator.MULTIHOP,
ManagementInterface.FeatureIndicator.BRIDGE_MODE,
diff --git a/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/FeatureIndicator.kt b/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/FeatureIndicator.kt
index 74fea07326..3c8df824f4 100644
--- a/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/FeatureIndicator.kt
+++ b/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/FeatureIndicator.kt
@@ -3,7 +3,6 @@ package net.mullvad.mullvadvpn.lib.model
// The order of the variants match the priority order and can be sorted on.
enum class FeatureIndicator {
DAITA,
- // DAITA_SMART_ROUTING
QUANTUM_RESISTANCE,
// MULTIHOP,
SPLIT_TUNNELING,
diff --git a/mullvad-types/src/features.rs b/mullvad-types/src/features.rs
index cb6bb23f98..0e25f5a59c 100644
--- a/mullvad-types/src/features.rs
+++ b/mullvad-types/src/features.rs
@@ -3,10 +3,7 @@ use std::{
fmt::{Debug, Display},
};
-use crate::{
- relay_constraints::RelaySettings,
- settings::{DnsState, Settings},
-};
+use crate::settings::{DnsState, Settings};
use serde::{Deserialize, Serialize};
use talpid_types::net::{ObfuscationType, TunnelEndpoint, TunnelType};
@@ -175,35 +172,11 @@ pub fn compute_feature_indicators(
let mtu = settings.tunnel_options.wireguard.mtu.is_some();
let mut daita = false;
- let mut multihop = endpoint.entry_endpoint.is_some();
+ let multihop = endpoint.entry_endpoint.is_some();
#[cfg(daita)]
if endpoint.daita {
daita = true;
-
- let multihop_setting_enabled =
- if let RelaySettings::Normal(constraints) = &settings.relay_settings {
- constraints.wireguard_constraints.use_multihop
- } else {
- false
- };
-
- let daita_use_multihop_if_necessary = settings
- .tunnel_options
- .wireguard
- .daita
- .use_multihop_if_necessary;
-
- // If multihop is disabled in the settings, but enabled automatically by DAITA, we
- // will not show the multihop indicator.
- let multihop_enable_automatically = multihop && !multihop_setting_enabled;
- if multihop_enable_automatically {
- debug_assert!(
- daita_use_multihop_if_necessary,
- "Multihop can only be enabled automatically if DAITA is enabled"
- );
- multihop = false;
- }
}
vec![
@@ -419,8 +392,8 @@ mod tests {
// Here we mock that multihop was automatically enabled by DAITA.
// We enable `use_multihop_if_necessary` again and disable the multihop setting, while
- // keeping the entry relay In this scenario, we should not get a Multihop
- // indicator
+ // keeping the entry relay. In this scenario, we should still get a Multihop
+ // indicator.
settings
.tunnel_options
.wireguard
@@ -429,15 +402,15 @@ mod tests {
if let RelaySettings::Normal(constraints) = &mut settings.relay_settings {
constraints.wireguard_constraints.use_multihop = false;
};
- expected_indicators.0.remove(&FeatureIndicator::Multihop);
assert_eq!(
compute_feature_indicators(&settings, &endpoint, false),
expected_indicators,
"DaitaDirectOnly should be enabled"
);
- // If we also remove the entry relay, we should still not get a multihop indicator
+ // If we also remove the entry relay, we should not get a multihop indicator
endpoint.entry_endpoint = None;
+ expected_indicators.0.remove(&FeatureIndicator::Multihop);
assert_eq!(
compute_feature_indicators(&settings, &endpoint, false),
expected_indicators,