summaryrefslogtreecommitdiffhomepage
path: root/gui/src/renderer/lib
diff options
context:
space:
mode:
authorOskar Nyberg <oskar@mullvad.net>2023-12-14 08:42:23 +0100
committerDavid Lönnhager <david.l@mullvad.net>2024-04-16 14:43:19 +0200
commit424a519d6eb10be91971054733c8738715eb0906 (patch)
treebf35a67e8b8ee4be517af984ba5b550d4ba70f5d /gui/src/renderer/lib
parent52a2bed28a4360d9c0f98fed2898e713dc85371c (diff)
downloadmullvadvpn-424a519d6eb10be91971054733c8738715eb0906.tar.xz
mullvadvpn-424a519d6eb10be91971054733c8738715eb0906.zip
Only filter locations for first wg hop
Diffstat (limited to 'gui/src/renderer/lib')
-rw-r--r--gui/src/renderer/lib/filter-locations.ts26
1 files changed, 24 insertions, 2 deletions
diff --git a/gui/src/renderer/lib/filter-locations.ts b/gui/src/renderer/lib/filter-locations.ts
index 802748680a..78126f1fb4 100644
--- a/gui/src/renderer/lib/filter-locations.ts
+++ b/gui/src/renderer/lib/filter-locations.ts
@@ -1,6 +1,13 @@
-import { Ownership, RelayEndpointType, RelayLocation } from '../../shared/daemon-rpc-types';
+import {
+ LiftedConstraint,
+ Ownership,
+ RelayEndpointType,
+ RelayLocation,
+ TunnelProtocol,
+} from '../../shared/daemon-rpc-types';
import { relayLocations } from '../../shared/gettext';
import {
+ LocationType,
RelayLocationCityWithVisibility,
RelayLocationCountryWithVisibility,
RelayLocationRelayWithVisibility,
@@ -30,12 +37,27 @@ export function filterLocationsByEndPointType(
export function filterLocationsByDaita(
locations: IRelayLocationCountryRedux[],
daita: boolean,
+ locationType: LocationType,
+ tunnelProtocol: LiftedConstraint<TunnelProtocol>,
+ multihop: boolean,
): IRelayLocationCountryRedux[] {
- return daita
+ return daitaFilterActive(daita, locationType, tunnelProtocol, multihop)
? filterLocationsImpl(locations, (relay: IRelayLocationRelayRedux) => relay.daita)
: locations;
}
+export function daitaFilterActive(
+ daita: boolean,
+ locationType: LocationType,
+ tunnelProtocol: LiftedConstraint<TunnelProtocol>,
+ multihop: boolean,
+) {
+ const isEntry = multihop
+ ? locationType === LocationType.entry
+ : locationType === LocationType.exit;
+ return daita && isEntry && tunnelProtocol !== 'openvpn';
+}
+
export function filterLocations(
locations: IRelayLocationCountryRedux[],
ownership?: Ownership,