diff options
| author | Oskar <oskar@mullvad.net> | 2024-08-30 10:46:43 +0200 |
|---|---|---|
| committer | Oskar <oskar@mullvad.net> | 2024-08-30 20:04:00 +0200 |
| commit | 93dd4c574ca0f7bae46b9ab8a259e465ab856069 (patch) | |
| tree | 4da22da638555f86a666d7007302b99c8b8260a6 | |
| parent | 059dafffdfd6d8c7825da4f8d518e3c82b943abf (diff) | |
| download | mullvadvpn-93dd4c574ca0f7bae46b9ab8a259e465ab856069.tar.xz mullvadvpn-93dd4c574ca0f7bae46b9ab8a259e465ab856069.zip | |
Fix missing daemon event obfuscation type convertion
| -rw-r--r-- | gui/src/main/daemon-rpc.ts | 18 | ||||
| -rw-r--r-- | gui/src/shared/daemon-rpc-types.ts | 2 | ||||
| -rw-r--r-- | gui/test/e2e/installed/state-dependent/tunnel-state.spec.ts | 7 |
3 files changed, 20 insertions, 7 deletions
diff --git a/gui/src/main/daemon-rpc.ts b/gui/src/main/daemon-rpc.ts index e264ef75e3..c85189cea7 100644 --- a/gui/src/main/daemon-rpc.ts +++ b/gui/src/main/daemon-rpc.ts @@ -29,6 +29,7 @@ import { DeviceEvent, DeviceState, DirectMethod, + EndpointObfuscationType, ErrorStateCause, ErrorStateDetails, FeatureIndicator, @@ -1211,17 +1212,22 @@ function convertFromProxyEndpoint(proxyEndpoint: grpcTypes.ProxyEndpoint.AsObjec function convertFromObfuscationEndpoint( obfuscationEndpoint: grpcTypes.ObfuscationEndpoint.AsObject, ): IObfuscationEndpoint { - // TODO: Handle Shadowsocks (and other implemented protocols) - if ( - obfuscationEndpoint.obfuscationType !== grpcTypes.ObfuscationEndpoint.ObfuscationType.UDP2TCP - ) { - throw new Error('unsupported obfuscation protocol'); + let obfuscationType: EndpointObfuscationType; + switch (obfuscationEndpoint.obfuscationType) { + case grpcTypes.ObfuscationEndpoint.ObfuscationType.UDP2TCP: + obfuscationType = 'udp2tcp'; + break; + case grpcTypes.ObfuscationEndpoint.ObfuscationType.SHADOWSOCKS: + obfuscationType = 'shadowsocks'; + break; + default: + throw new Error('unsupported obfuscation protocol'); } return { ...obfuscationEndpoint, protocol: convertFromTransportProtocol(obfuscationEndpoint.protocol), - obfuscationType: 'udp2tcp', + obfuscationType: obfuscationType, }; } diff --git a/gui/src/shared/daemon-rpc-types.ts b/gui/src/shared/daemon-rpc-types.ts index 40c692e1ba..b84ee8a72e 100644 --- a/gui/src/shared/daemon-rpc-types.ts +++ b/gui/src/shared/daemon-rpc-types.ts @@ -112,7 +112,7 @@ export function tunnelTypeToString(tunnel: TunnelType): string { } export type RelayProtocol = 'tcp' | 'udp'; -export type EndpointObfuscationType = 'udp2tcp'; +export type EndpointObfuscationType = 'udp2tcp' | 'shadowsocks'; export type Constraint<T> = 'any' | { only: T }; export type LiftedConstraint<T> = 'any' | T; diff --git a/gui/test/e2e/installed/state-dependent/tunnel-state.spec.ts b/gui/test/e2e/installed/state-dependent/tunnel-state.spec.ts index af32668efb..53332ee6ab 100644 --- a/gui/test/e2e/installed/state-dependent/tunnel-state.spec.ts +++ b/gui/test/e2e/installed/state-dependent/tunnel-state.spec.ts @@ -90,6 +90,13 @@ test('App should show correct WireGuard transport protocol', async () => { await expect(inData).toContainText(new RegExp('UDP$')); }); +test('App should connect with Shadowsocks', async () => { + await exec('mullvad obfuscation set mode shadowsocks'); + await expectConnected(page); + await exec('mullvad obfuscation set mode off'); + await expectConnected(page); +}); + test('App should show correct tunnel protocol', async () => { const tunnelProtocol = page.getByTestId('tunnel-protocol'); await expect(tunnelProtocol).toHaveText('WireGuard'); |
