Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace "smart routing" with "direct only" #6935

Merged
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,13 @@ class ManagementService(
suspend fun setDaitaEnabled(enabled: Boolean): Either<SetDaitaSettingsError, Unit> =
Either.catch {
val daitaSettings =
ManagementInterface.DaitaSettings.newBuilder().setEnabled(enabled).build()
ManagementInterface.DaitaSettings.newBuilder()
.setEnabled(enabled)
// Before Multihop is supported on Android, calling `setDirectOnly` with
// false will cause undefined behaviour. Will be fixed by as part of
// DROID-1412.
.setDirectOnly(true)
.build()
grpc.setDaitaSettings(daitaSettings)
}
.mapLeft(SetDaitaSettingsError::Unknown)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
39 changes: 19 additions & 20 deletions gui/locales/messages.pot
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@ msgstr ""
msgid "%(amount)d more..."
msgstr ""

#. This refers to the Smart Routing setting in the VPN settings view.
#. This is displayed when both Smart Routing and DAITA features are on.
msgid "%(daita)s: Smart routing"
msgstr ""

msgid "%(duration)s was added, account paid until %(expiry)s."
msgstr ""

Expand Down Expand Up @@ -127,10 +122,10 @@ msgstr ""
msgid "Delete list"
msgstr ""

msgid "Disable"
msgid "Direct only"
msgstr ""

msgid "Disable anyway"
msgid "Disable"
msgstr ""

msgid "Disconnect"
Expand All @@ -157,6 +152,9 @@ msgstr ""
msgid "Enable"
msgstr ""

msgid "Enable \"Direct only\""
msgstr ""

msgid "Enable anyway"
msgstr ""

Expand Down Expand Up @@ -253,9 +251,6 @@ msgstr ""
msgid "Settings"
msgstr ""

msgid "Smart routing"
msgstr ""

msgid "System default"
msgstr ""

Expand Down Expand Up @@ -1956,13 +1951,13 @@ msgctxt "vpn-settings-view"
msgid "Lockdown mode"
msgstr ""

#. Label for settings that enables malware blocking.
msgctxt "vpn-settings-view"
msgid "Makes it possible to use %(daita)s with any server and is automatically enabled."
msgid "Malware"
msgstr ""

#. Label for settings that enables malware blocking.
msgctxt "vpn-settings-view"
msgid "Malware"
msgid "Manually choose which %(daita)s-enabled server to use."
msgstr ""

msgctxt "vpn-settings-view"
Expand Down Expand Up @@ -2071,7 +2066,15 @@ msgid "%(wireguard)s settings"
msgstr ""

msgctxt "wireguard-settings-view"
msgid "Can only be used with WireGuard. Since this increases your total network traffic, be cautious if you have a limited data plan. It can also negatively impact your network speed."
msgid "Attention: Be cautious if you have a limited data plan as this feature will increase your network traffic. This feature can only be used with WireGuard."
msgstr ""

msgctxt "wireguard-settings-view"
msgid "By enabling “Direct only” you will have to manually select a server that is %(daita)s-enabled. This can cause you to end up in a blocked state until you have selected a compatible server in the “Select location” view."
msgstr ""

msgctxt "wireguard-settings-view"
msgid "Cancel"
msgstr ""

msgctxt "wireguard-settings-view"
Expand Down Expand Up @@ -2104,11 +2107,11 @@ msgstr ""

#. Warning text in a dialog that is displayed after a setting is toggled.
msgctxt "wireguard-settings-view"
msgid "Not all our servers are %(daita)s-enabled. In order to use the internet, you might have to select a new location after disabling, or you can continue using %(daita)s with Smart routing."
msgid "Not all our servers are %(daita)s-enabled. In order to use the internet, you might have to select a new location after enabling."
msgstr ""

msgctxt "wireguard-settings-view"
msgid "Not all our servers are %(daita)s-enabled. Smart routing allows %(daita)s to be used at any location. It does this by using multihop in the background to route your traffic via the closest %(daita)s-enabled server first."
msgid "Not all our servers are %(daita)s-enabled. We use multihop automatically to use %(daita)s with any server."
msgstr ""

msgctxt "wireguard-settings-view"
Expand Down Expand Up @@ -2181,10 +2184,6 @@ msgctxt "wireguard-settings-view"
msgid "UDP-over-TCP port"
msgstr ""

msgctxt "wireguard-settings-view"
msgid "Use Smart routing"
msgstr ""

#. Text describing the valid port range for a port selector.
msgctxt "wireguard-settings-view"
msgid "Valid range: %(min)s - %(max)s"
Expand Down
4 changes: 2 additions & 2 deletions gui/src/main/daemon-rpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -464,8 +464,8 @@ export class DaemonRpc extends GrpcClient {
await this.callBool(this.client.setEnableDaita, value);
}

public async setDaitaSmartRouting(value: boolean): Promise<void> {
await this.callBool(this.client.setDaitaSmartRouting, value);
public async setDaitaDirectOnly(value: boolean): Promise<void> {
await this.callBool(this.client.setDaitaDirectOnly, value);
}

public async listDevices(accountNumber: AccountNumber): Promise<Array<IDevice>> {
Expand Down
2 changes: 0 additions & 2 deletions gui/src/main/grpc-type-convertions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -381,8 +381,6 @@ function convertFromFeatureIndicator(
return FeatureIndicator.customMssFix;
case grpcTypes.FeatureIndicator.DAITA:
return FeatureIndicator.daita;
case grpcTypes.FeatureIndicator.DAITA_SMART_ROUTING:
return FeatureIndicator.daitaSmartRouting;
case grpcTypes.FeatureIndicator.SHADOWSOCKS:
return FeatureIndicator.shadowsocks;
}
Expand Down
4 changes: 2 additions & 2 deletions gui/src/main/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ export default class Settings implements Readonly<ISettings> {
IpcMainEventChannel.settings.handleSetEnableDaita((value) => {
return this.daemonRpc.setEnableDaita(value);
});
IpcMainEventChannel.settings.handleSetDaitaSmartRouting((value) => {
return this.daemonRpc.setDaitaSmartRouting(value);
IpcMainEventChannel.settings.handleSetDaitaDirectOnly((value) => {
return this.daemonRpc.setDaitaDirectOnly(value);
});

IpcMainEventChannel.guiSettings.handleSetEnableSystemNotifications((flag: boolean) => {
Expand Down
4 changes: 2 additions & 2 deletions gui/src/renderer/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,8 @@ export default class AppRenderer {
IpcRendererEventChannel.settings.setObfuscationSettings(obfuscationSettings);
public setEnableDaita = (value: boolean) =>
IpcRendererEventChannel.settings.setEnableDaita(value);
public setDaitaSmartRouting = (value: boolean) =>
IpcRendererEventChannel.settings.setDaitaSmartRouting(value);
public setDaitaDirectOnly = (value: boolean) =>
IpcRendererEventChannel.settings.setDaitaDirectOnly(value);
public collectProblemReport = (toRedact: string | undefined) =>
IpcRendererEventChannel.problemReport.collectLogs(toRedact);
public viewLog = (path: string) => IpcRendererEventChannel.problemReport.viewLog(path);
Expand Down
47 changes: 27 additions & 20 deletions gui/src/renderer/components/DaitaSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,19 @@ export default function DaitaSettings() {
'It does this by carefully adding network noise and making all network packets the same size.',
)}
</StyledHeaderSubTitle>
<StyledHeaderSubTitle>
{sprintf(
messages.pgettext(
'wireguard-settings-view',
'Not all our servers are %(daita)s-enabled. We use multihop automatically to use %(daita)s with any server.',
),
{ daita: strings.daita, daitaFull: strings.daitaFull },
)}
</StyledHeaderSubTitle>
<StyledHeaderSubTitle>
{messages.pgettext(
'wireguard-settings-view',
'Can only be used with WireGuard. Since this increases your total network traffic, be cautious if you have a limited data plan. It can also negatively impact your network speed.',
'Attention: Be cautious if you have a limited data plan as this feature will increase your network traffic. This feature can only be used with WireGuard.',
)}
</StyledHeaderSubTitle>
</React.Fragment>,
Expand All @@ -119,12 +128,10 @@ export default function DaitaSettings() {
}

function DaitaToggle() {
const { setEnableDaita, setDaitaSmartRouting } = useAppContext();
const { setEnableDaita, setDaitaDirectOnly } = useAppContext();
const relaySettings = useSelector((state) => state.settings.relaySettings);
const daita = useSelector((state) => state.settings.wireguard.daita?.enabled ?? false);
const smartRouting = useSelector(
(state) => state.settings.wireguard.daita?.smartRouting ?? false,
);
const directOnly = useSelector((state) => state.settings.wireguard.daita?.directOnly ?? false);

const [confirmationDialogVisible, showConfirmationDialog, hideConfirmationDialog] = useBoolean();

Expand All @@ -135,16 +142,16 @@ function DaitaToggle() {
void setEnableDaita(value);
}, []);

const setSmartRouting = useCallback((value: boolean) => {
const setDirectOnly = useCallback((value: boolean) => {
if (value) {
void setDaitaSmartRouting(value);
} else {
showConfirmationDialog();
} else {
void setDaitaDirectOnly(value);
}
}, []);

const confirmDisableSmartRouting = useCallback(() => {
void setDaitaSmartRouting(false);
const confirmEnableDirectOnly = useCallback(() => {
void setDaitaDirectOnly(true);
hideConfirmationDialog();
}, []);

Expand All @@ -170,13 +177,13 @@ function DaitaToggle() {
<AriaInputGroup>
<Cell.Container disabled={!daita || unavailable}>
<AriaLabel>
<Cell.InputLabel>{messages.gettext('Smart routing')}</Cell.InputLabel>
<Cell.InputLabel>{messages.gettext('Direct only')}</Cell.InputLabel>
</AriaLabel>
<InfoButton>
<SmartRoutingModalMessage />
<DirectOnlyModalMessage />
</InfoButton>
<AriaInput>
<Cell.Switch isOn={smartRouting && !unavailable} onChange={setSmartRouting} />
<Cell.Switch isOn={directOnly && !unavailable} onChange={setDirectOnly} />
</AriaInput>
</Cell.Container>
<Cell.CellFooter>
Expand All @@ -185,7 +192,7 @@ function DaitaToggle() {
{sprintf(
messages.pgettext(
'vpn-settings-view',
'Makes it possible to use %(daita)s with any server and is automatically enabled.',
'Manually choose which %(daita)s-enabled server to use.',
),
{ daita: strings.daita },
)}
Expand All @@ -199,12 +206,12 @@ function DaitaToggle() {
gridButtons={[
<SmallButton
key="confirm"
onClick={confirmDisableSmartRouting}
onClick={confirmEnableDirectOnly}
color={SmallButtonColor.blue}>
{messages.gettext('Disable anyway')}
{messages.gettext('Enable "Direct only"')}
</SmallButton>,
<SmallButton key="cancel" onClick={hideConfirmationDialog} color={SmallButtonColor.blue}>
{messages.pgettext('wireguard-settings-view', 'Use Smart routing')}
{messages.pgettext('wireguard-settings-view', 'Cancel')}
</SmallButton>,
]}
close={hideConfirmationDialog}>
Expand All @@ -213,7 +220,7 @@ function DaitaToggle() {
// TRANSLATORS: Warning text in a dialog that is displayed after a setting is toggled.
messages.pgettext(
'wireguard-settings-view',
'Not all our servers are %(daita)s-enabled. In order to use the internet, you might have to select a new location after disabling, or you can continue using %(daita)s with Smart routing.',
'Not all our servers are %(daita)s-enabled. In order to use the internet, you might have to select a new location after enabling.',
),
{ daita: strings.daita },
)}
Expand All @@ -223,13 +230,13 @@ function DaitaToggle() {
);
}

export function SmartRoutingModalMessage() {
function DirectOnlyModalMessage() {
return (
<ModalMessage>
{sprintf(
messages.pgettext(
'wireguard-settings-view',
'Not all our servers are %(daita)s-enabled. Smart routing allows %(daita)s to be used at any location. It does this by using multihop in the background to route your traffic via the closest %(daita)s-enabled server first.',
'By enabling “Direct only” you will have to manually select a server that is %(daita)s-enabled. This can cause you to end up in a blocked state until you have selected a compatible server in the “Select location” view.',
),
{
daita: strings.daita,
Expand Down
35 changes: 2 additions & 33 deletions gui/src/renderer/components/main-view/FeatureIndicators.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,10 @@ import styled from 'styled-components';
import { colors, strings } from '../../../config.json';
import { FeatureIndicator } from '../../../shared/daemon-rpc-types';
import { messages } from '../../../shared/gettext';
import { useBoolean, useStyledRef } from '../../lib/utilityHooks';
import { useStyledRef } from '../../lib/utilityHooks';
import { useSelector } from '../../redux/store';
import { tinyText } from '../common-styles';
import { SmartRoutingModalMessage } from '../DaitaSettings';
import { InfoIcon } from '../InfoButton';
import { ModalAlert, ModalAlertType } from '../Modal';
import { SmallButton, SmallButtonColor } from '../SmallButton';
import { ConnectionPanelAccordion } from './styles';

const LINE_HEIGHT = 22;
Expand Down Expand Up @@ -102,11 +99,6 @@ interface FeatureIndicatorsProps {
// we can count those and add another ellipsis element which is visible and place it after the last
// visible indicator.
export default function FeatureIndicators(props: FeatureIndicatorsProps) {
const [
daitaSmartRoutingDialogueVisible,
showDaitaSmartRoutingDialogue,
hideDaitaSmartRoutingDialogue,
] = useBoolean();
const tunnelState = useSelector((state) => state.connection.status);
const ellipsisRef = useStyledRef<HTMLSpanElement>();
const ellipsisSpacerRef = useStyledRef<HTMLSpanElement>();
Expand All @@ -127,9 +119,8 @@ export default function FeatureIndicators(props: FeatureIndicatorsProps) {

// Returns an optional callback for clickable feature indicators, or undefined.
const getFeatureIndicatorOnClick = (indicator: FeatureIndicator) => {
// NOTE: With the "smart routing" feature indicator removed, this function now does nothing, should it be removed?
switch (indicator) {
case FeatureIndicator.daitaSmartRouting:
return showDaitaSmartRoutingDialogue;
default:
return undefined;
}
Expand Down Expand Up @@ -231,21 +222,6 @@ export default function FeatureIndicators(props: FeatureIndicatorsProps) {
/>
</StyledFeatureIndicators>
</StyledFeatureIndicatorsContainer>

<ModalAlert
isOpen={daitaSmartRoutingDialogueVisible}
type={ModalAlertType.info}
gridButtons={[
<SmallButton
key="dismiss"
onClick={hideDaitaSmartRoutingDialogue}
color={SmallButtonColor.blue}>
{messages.gettext('Got it!')}
</SmallButton>,
]}
close={hideDaitaSmartRoutingDialogue}>
<SmartRoutingModalMessage />
</ModalAlert>
</StyledAccordion>
);
}
Expand Down Expand Up @@ -276,13 +252,6 @@ function getFeatureIndicatorLabel(indicator: FeatureIndicator) {
switch (indicator) {
case FeatureIndicator.daita:
return strings.daita;
case FeatureIndicator.daitaSmartRouting:
return sprintf(
// TRANSLATORS: This refers to the Smart Routing setting in the VPN settings view.
// TRANSLATORS: This is displayed when both Smart Routing and DAITA features are on.
messages.gettext('%(daita)s: Smart routing'),
{ daita: strings.daita },
);
case FeatureIndicator.udp2tcp:
case FeatureIndicator.shadowsocks:
return messages.pgettext('wireguard-settings-view', 'Obfuscation');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,7 @@ interface RelayListContextProviderProps {
export function RelayListContextProvider(props: RelayListContextProviderProps) {
const { locationType, searchTerm } = useSelectLocationContext();
const daita = useSelector((state) => state.settings.wireguard.daita?.enabled ?? false);
const smartRouting = useSelector(
(state) => state.settings.wireguard.daita?.smartRouting ?? false,
);
const directOnly = useSelector((state) => state.settings.wireguard.daita?.directOnly ?? false);

const fullRelayList = useSelector((state) => state.settings.relayLocations);
const relaySettings = useNormalRelaySettings();
Expand All @@ -81,7 +79,7 @@ export function RelayListContextProvider(props: RelayListContextProviderProps) {
return filterLocationsByDaita(
relayListForEndpointType,
daita,
smartRouting,
directOnly,
locationType,
relaySettings?.tunnelProtocol ?? 'any',
relaySettings?.wireguard.useMultihop ?? false,
Expand Down
Loading
Loading