Skip to content

Commit 93dd4c5

Browse files
committed
Fix missing daemon event obfuscation type convertion
1 parent 059daff commit 93dd4c5

File tree

3 files changed

+20
-7
lines changed

3 files changed

+20
-7
lines changed

gui/src/main/daemon-rpc.ts

+12-6
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import {
2929
DeviceEvent,
3030
DeviceState,
3131
DirectMethod,
32+
EndpointObfuscationType,
3233
ErrorStateCause,
3334
ErrorStateDetails,
3435
FeatureIndicator,
@@ -1211,17 +1212,22 @@ function convertFromProxyEndpoint(proxyEndpoint: grpcTypes.ProxyEndpoint.AsObjec
12111212
function convertFromObfuscationEndpoint(
12121213
obfuscationEndpoint: grpcTypes.ObfuscationEndpoint.AsObject,
12131214
): IObfuscationEndpoint {
1214-
// TODO: Handle Shadowsocks (and other implemented protocols)
1215-
if (
1216-
obfuscationEndpoint.obfuscationType !== grpcTypes.ObfuscationEndpoint.ObfuscationType.UDP2TCP
1217-
) {
1218-
throw new Error('unsupported obfuscation protocol');
1215+
let obfuscationType: EndpointObfuscationType;
1216+
switch (obfuscationEndpoint.obfuscationType) {
1217+
case grpcTypes.ObfuscationEndpoint.ObfuscationType.UDP2TCP:
1218+
obfuscationType = 'udp2tcp';
1219+
break;
1220+
case grpcTypes.ObfuscationEndpoint.ObfuscationType.SHADOWSOCKS:
1221+
obfuscationType = 'shadowsocks';
1222+
break;
1223+
default:
1224+
throw new Error('unsupported obfuscation protocol');
12191225
}
12201226

12211227
return {
12221228
...obfuscationEndpoint,
12231229
protocol: convertFromTransportProtocol(obfuscationEndpoint.protocol),
1224-
obfuscationType: 'udp2tcp',
1230+
obfuscationType: obfuscationType,
12251231
};
12261232
}
12271233

gui/src/shared/daemon-rpc-types.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ export function tunnelTypeToString(tunnel: TunnelType): string {
112112
}
113113

114114
export type RelayProtocol = 'tcp' | 'udp';
115-
export type EndpointObfuscationType = 'udp2tcp';
115+
export type EndpointObfuscationType = 'udp2tcp' | 'shadowsocks';
116116

117117
export type Constraint<T> = 'any' | { only: T };
118118
export type LiftedConstraint<T> = 'any' | T;

gui/test/e2e/installed/state-dependent/tunnel-state.spec.ts

+7
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,13 @@ test('App should show correct WireGuard transport protocol', async () => {
9090
await expect(inData).toContainText(new RegExp('UDP$'));
9191
});
9292

93+
test('App should connect with Shadowsocks', async () => {
94+
await exec('mullvad obfuscation set mode shadowsocks');
95+
await expectConnected(page);
96+
await exec('mullvad obfuscation set mode off');
97+
await expectConnected(page);
98+
});
99+
93100
test('App should show correct tunnel protocol', async () => {
94101
const tunnelProtocol = page.getByTestId('tunnel-protocol');
95102
await expect(tunnelProtocol).toHaveText('WireGuard');

0 commit comments

Comments
 (0)