diff options
| author | Tobias Järvelöv <tobias.jarvelov@mullvad.net> | 2025-03-06 15:08:33 +0100 |
|---|---|---|
| committer | Markus Pettersson <markus.pettersson@mullvad.net> | 2025-03-10 10:14:20 +0100 |
| commit | d0ba4c809f24ed6b83a5ecf6a17a8bf93a25328d (patch) | |
| tree | fe4289d7bcf2c724d1d4ab839fd2ea6272db50cc | |
| parent | 0c0d94cf964361760334c9a9b436006aa4fcfd80 (diff) | |
| download | mullvadvpn-d0ba4c809f24ed6b83a5ecf6a17a8bf93a25328d.tar.xz mullvadvpn-d0ba4c809f24ed6b83a5ecf6a17a8bf93a25328d.zip | |
Remove constraint for TunnelProtocol
8 files changed, 14 insertions, 17 deletions
diff --git a/desktop/packages/mullvad-vpn/src/main/grpc-type-convertions.ts b/desktop/packages/mullvad-vpn/src/main/grpc-type-convertions.ts index 0403e66d18..2fb3c66114 100644 --- a/desktop/packages/mullvad-vpn/src/main/grpc-type-convertions.ts +++ b/desktop/packages/mullvad-vpn/src/main/grpc-type-convertions.ts @@ -850,9 +850,7 @@ export function convertToRelayConstraints( ): grpcTypes.NormalRelaySettings { const relayConstraints = new grpcTypes.NormalRelaySettings(); - if (constraints.tunnelProtocol !== 'any') { - relayConstraints.setTunnelType(convertToTunnelType(constraints.tunnelProtocol.only)); - } + relayConstraints.setTunnelType(convertToTunnelType(constraints.tunnelProtocol)); relayConstraints.setLocation(convertToLocation(unwrapConstraint(constraints.location))); relayConstraints.setWireguardConstraints( convertToWireguardConstraints(constraints.wireguardConstraints), diff --git a/desktop/packages/mullvad-vpn/src/renderer/app.tsx b/desktop/packages/mullvad-vpn/src/renderer/app.tsx index 14fdd537b0..b519b1b381 100644 --- a/desktop/packages/mullvad-vpn/src/renderer/app.tsx +++ b/desktop/packages/mullvad-vpn/src/renderer/app.tsx @@ -650,7 +650,7 @@ export default class AppRenderer { useMultihop: wireguardConstraints.useMultihop, entryLocation: liftConstraint(wireguardConstraints.entryLocation), }, - tunnelProtocol: liftConstraint(tunnelProtocol), + tunnelProtocol, }, }); } else if ('customTunnelEndpoint' in relaySettings) { diff --git a/desktop/packages/mullvad-vpn/src/renderer/components/VpnSettings.tsx b/desktop/packages/mullvad-vpn/src/renderer/components/VpnSettings.tsx index 545508adf0..4b4c019da3 100644 --- a/desktop/packages/mullvad-vpn/src/renderer/components/VpnSettings.tsx +++ b/desktop/packages/mullvad-vpn/src/renderer/components/VpnSettings.tsx @@ -3,7 +3,7 @@ import { sprintf } from 'sprintf-js'; import styled from 'styled-components'; import { strings } from '../../shared/constants'; -import { IDnsOptions, TunnelProtocol, wrapConstraint } from '../../shared/daemon-rpc-types'; +import { IDnsOptions, TunnelProtocol } from '../../shared/daemon-rpc-types'; import { messages } from '../../shared/gettext'; import log from '../../shared/logging'; import { useAppContext } from '../context'; @@ -689,11 +689,11 @@ function TunnelProtocolSetting() { } const setTunnelProtocol = useCallback( - async (tunnelProtocol: TunnelProtocol | null) => { + async (tunnelProtocol: TunnelProtocol) => { try { await relaySettingsUpdater((settings) => ({ ...settings, - tunnelProtocol: wrapConstraint(tunnelProtocol), + tunnelProtocol, })); } catch (e) { const error = e as Error; diff --git a/desktop/packages/mullvad-vpn/src/renderer/lib/constraint-updater.ts b/desktop/packages/mullvad-vpn/src/renderer/lib/constraint-updater.ts index 6f6a7b0850..78d9de93c1 100644 --- a/desktop/packages/mullvad-vpn/src/renderer/lib/constraint-updater.ts +++ b/desktop/packages/mullvad-vpn/src/renderer/lib/constraint-updater.ts @@ -29,7 +29,7 @@ export function wrapRelaySettingsOrDefault( const wgIpVersion = wrapConstraint(relaySettings.wireguard.ipVersion); const wgEntryLocation = wrapConstraint(relaySettings.wireguard.entryLocation); const location = wrapConstraint(relaySettings.location); - const tunnelProtocol = wrapConstraint(relaySettings.tunnelProtocol); + const tunnelProtocol = relaySettings.tunnelProtocol; return { providers: [...relaySettings.providers], diff --git a/desktop/packages/mullvad-vpn/src/renderer/lib/filter-locations.ts b/desktop/packages/mullvad-vpn/src/renderer/lib/filter-locations.ts index c3a0f7feb9..3b55639a8d 100644 --- a/desktop/packages/mullvad-vpn/src/renderer/lib/filter-locations.ts +++ b/desktop/packages/mullvad-vpn/src/renderer/lib/filter-locations.ts @@ -1,5 +1,4 @@ import { - LiftedConstraint, Ownership, RelayEndpointType, RelayLocation, @@ -29,7 +28,7 @@ export enum EndpointType { export function filterLocationsByEndPointType( locations: IRelayLocationCountryRedux[], endpointType: EndpointType, - tunnelProtocol: LiftedConstraint<TunnelProtocol>, + tunnelProtocol: TunnelProtocol, relaySettings?: NormalRelaySettingsRedux, ): IRelayLocationCountryRedux[] { return filterLocationsImpl( @@ -43,7 +42,7 @@ export function filterLocationsByDaita( daita: boolean, directOnly: boolean, locationType: LocationType, - tunnelProtocol: LiftedConstraint<TunnelProtocol>, + tunnelProtocol: TunnelProtocol, multihop: boolean, ): IRelayLocationCountryRedux[] { return daitaFilterActive(daita, directOnly, locationType, tunnelProtocol, multihop) @@ -55,7 +54,7 @@ export function daitaFilterActive( daita: boolean, directOnly: boolean, locationType: LocationType, - tunnelProtocol: LiftedConstraint<TunnelProtocol>, + tunnelProtocol: TunnelProtocol, multihop: boolean, ) { const isEntry = multihop @@ -78,7 +77,7 @@ export function filterLocations( function getTunnelProtocolFilter( endpointType: EndpointType, - tunnelProtocol: LiftedConstraint<TunnelProtocol>, + tunnelProtocol: TunnelProtocol, relaySettings?: NormalRelaySettingsRedux, ): (relay: IRelayLocationRelayRedux) => boolean { const endpointTypes: Array<RelayEndpointType> = []; diff --git a/desktop/packages/mullvad-vpn/src/renderer/lib/relay-settings-hooks.ts b/desktop/packages/mullvad-vpn/src/renderer/lib/relay-settings-hooks.ts index 14fe99849d..14457ab6b5 100644 --- a/desktop/packages/mullvad-vpn/src/renderer/lib/relay-settings-hooks.ts +++ b/desktop/packages/mullvad-vpn/src/renderer/lib/relay-settings-hooks.ts @@ -1,4 +1,4 @@ -import { LiftedConstraint, TunnelProtocol } from '../../shared/daemon-rpc-types'; +import { TunnelProtocol } from '../../shared/daemon-rpc-types'; import { useSelector } from '../redux/store'; export function useNormalRelaySettings() { @@ -9,7 +9,7 @@ export function useNormalRelaySettings() { // Some features are considered core privacy features and when enabled prevent OpenVPN from being // used. This hook returns the tunnelprotocol with the exception that it always returns WireGuard // when any of those features are enabled. -export function useTunnelProtocol(): LiftedConstraint<TunnelProtocol> { +export function useTunnelProtocol(): TunnelProtocol { const relaySettings = useNormalRelaySettings(); const multihop = relaySettings?.wireguard.useMultihop ?? false; const daita = useSelector((state) => state.settings.wireguard.daita?.enabled ?? false); diff --git a/desktop/packages/mullvad-vpn/src/renderer/redux/settings/reducers.ts b/desktop/packages/mullvad-vpn/src/renderer/redux/settings/reducers.ts index 4e8ee65c88..1540179289 100644 --- a/desktop/packages/mullvad-vpn/src/renderer/redux/settings/reducers.ts +++ b/desktop/packages/mullvad-vpn/src/renderer/redux/settings/reducers.ts @@ -25,7 +25,7 @@ import { IGuiSettingsState } from '../../../shared/gui-settings-state'; import { ReduxAction } from '../store'; export type NormalRelaySettingsRedux = { - tunnelProtocol: LiftedConstraint<TunnelProtocol>; + tunnelProtocol: TunnelProtocol; location: LiftedConstraint<RelayLocation>; providers: string[]; ownership: Ownership; diff --git a/desktop/packages/mullvad-vpn/src/shared/daemon-rpc-types.ts b/desktop/packages/mullvad-vpn/src/shared/daemon-rpc-types.ts index 5faacf3963..00228667c9 100644 --- a/desktop/packages/mullvad-vpn/src/shared/daemon-rpc-types.ts +++ b/desktop/packages/mullvad-vpn/src/shared/daemon-rpc-types.ts @@ -262,7 +262,7 @@ export type IpVersion = 'ipv4' | 'ipv6'; export interface IRelaySettingsNormal<OpenVpn, Wireguard> { location: Constraint<RelayLocation>; - tunnelProtocol: Constraint<TunnelProtocol>; + tunnelProtocol: TunnelProtocol; providers: string[]; ownership: Ownership; openvpnConstraints: OpenVpn; |
