Skip to content

Commit 854c9ba

Browse files
committed
Add Shadowsocks feature indicator
1 parent 97db97d commit 854c9ba

File tree

6 files changed

+41
-20
lines changed

6 files changed

+41
-20
lines changed

gui/src/main/daemon-rpc.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1137,9 +1137,9 @@ function convertFromTunnelType(tunnelType: grpcTypes.TunnelType): TunnelType {
11371137
}
11381138

11391139
function convertFromProxyEndpoint(proxyEndpoint: grpcTypes.ProxyEndpoint.AsObject): IProxyEndpoint {
1140-
const proxyTypeMap: Record<grpcTypes.ProxyType, ProxyType> = {
1141-
[grpcTypes.ProxyType.CUSTOM]: 'custom',
1142-
[grpcTypes.ProxyType.SHADOWSOCKS]: 'shadowsocks',
1140+
const proxyTypeMap: Record<grpcTypes.ProxyEndpoint.ProxyType, ProxyType> = {
1141+
[grpcTypes.ProxyEndpoint.ProxyType.CUSTOM]: 'custom',
1142+
[grpcTypes.ProxyEndpoint.ProxyType.SHADOWSOCKS]: 'shadowsocks',
11431143
};
11441144

11451145
return {

mullvad-daemon/src/lib.rs

+8
Original file line numberDiff line numberDiff line change
@@ -2931,6 +2931,13 @@ impl Daemon {
29312931
.as_ref()
29322932
.filter(|obfuscation| obfuscation.obfuscation_type == ObfuscationType::Udp2Tcp)
29332933
.is_some();
2934+
let shadowsocks = endpoint
2935+
.obfuscation
2936+
.as_ref()
2937+
.filter(|obfuscation| {
2938+
obfuscation.obfuscation_type == ObfuscationType::Shadowsocks
2939+
})
2940+
.is_some();
29342941

29352942
let mtu = settings.tunnel_options.wireguard.mtu.is_some();
29362943

@@ -2941,6 +2948,7 @@ impl Daemon {
29412948
(quantum_resistant, FeatureIndicator::QuantumResistance),
29422949
(multihop, FeatureIndicator::Multihop),
29432950
(udp_tcp, FeatureIndicator::Udp2Tcp),
2951+
(shadowsocks, FeatureIndicator::Shadowsocks),
29442952
(mtu, FeatureIndicator::CustomMtu),
29452953
#[cfg(daita)]
29462954
(daita, FeatureIndicator::Daita),

mullvad-management-interface/proto/management_interface.proto

+13-12
Original file line numberDiff line numberDiff line change
@@ -254,13 +254,14 @@ enum FeatureIndicator {
254254
SPLIT_TUNNELING = 3;
255255
LOCKDOWN_MODE = 4;
256256
UDP_2_TCP = 5;
257-
LAN_SHARING = 6;
258-
DNS_CONTENT_BLOCKERS = 7;
259-
CUSTOM_DNS = 8;
260-
SERVER_IP_OVERRIDE = 9;
261-
CUSTOM_MTU = 10;
262-
CUSTOM_MSS_FIX = 11;
263-
DAITA = 12;
257+
SHADOWSOCKS = 6;
258+
LAN_SHARING = 7;
259+
DNS_CONTENT_BLOCKERS = 8;
260+
CUSTOM_DNS = 9;
261+
SERVER_IP_OVERRIDE = 10;
262+
CUSTOM_MTU = 11;
263+
CUSTOM_MSS_FIX = 12;
264+
DAITA = 13;
264265
}
265266

266267
message ObfuscationEndpoint {
@@ -275,17 +276,17 @@ message ObfuscationEndpoint {
275276
ObfuscationType obfuscation_type = 4;
276277
}
277278

278-
enum ProxyType {
279-
SHADOWSOCKS = 0;
280-
CUSTOM = 1;
281-
}
282-
283279
message Endpoint {
284280
string address = 1;
285281
TransportProtocol protocol = 2;
286282
}
287283

288284
message ProxyEndpoint {
285+
enum ProxyType {
286+
SHADOWSOCKS = 0;
287+
CUSTOM = 1;
288+
}
289+
289290
string address = 1;
290291
TransportProtocol protocol = 2;
291292
ProxyType proxy_type = 3;

mullvad-management-interface/src/types/conversions/features.rs

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ impl From<mullvad_types::features::FeatureIndicator> for proto::FeatureIndicator
1010
mullvad_types::features::FeatureIndicator::SplitTunneling => SplitTunneling,
1111
mullvad_types::features::FeatureIndicator::LockdownMode => LockdownMode,
1212
mullvad_types::features::FeatureIndicator::Udp2Tcp => Udp2Tcp,
13+
mullvad_types::features::FeatureIndicator::Shadowsocks => Shadowsocks,
1314
mullvad_types::features::FeatureIndicator::LanSharing => LanSharing,
1415
mullvad_types::features::FeatureIndicator::DnsContentBlockers => DnsContentBlockers,
1516
mullvad_types::features::FeatureIndicator::CustomDns => CustomDns,
@@ -30,6 +31,7 @@ impl From<proto::FeatureIndicator> for mullvad_types::features::FeatureIndicator
3031
proto::FeatureIndicator::SplitTunneling => Self::SplitTunneling,
3132
proto::FeatureIndicator::LockdownMode => Self::LockdownMode,
3233
proto::FeatureIndicator::Udp2Tcp => Self::Udp2Tcp,
34+
proto::FeatureIndicator::Shadowsocks => Self::Shadowsocks,
3335
proto::FeatureIndicator::LanSharing => Self::LanSharing,
3436
proto::FeatureIndicator::DnsContentBlockers => Self::DnsContentBlockers,
3537
proto::FeatureIndicator::CustomDns => Self::CustomDns,

mullvad-management-interface/src/types/conversions/net.rs

+13-5
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,12 @@ impl From<talpid_types::net::TunnelEndpoint> for proto::TunnelEndpoint {
1717
address: proxy_ep.endpoint.address.to_string(),
1818
protocol: i32::from(proto::TransportProtocol::from(proxy_ep.endpoint.protocol)),
1919
proxy_type: match proxy_ep.proxy_type {
20-
net::proxy::ProxyType::Shadowsocks => i32::from(proto::ProxyType::Shadowsocks),
21-
net::proxy::ProxyType::Custom => i32::from(proto::ProxyType::Custom),
20+
net::proxy::ProxyType::Shadowsocks => {
21+
i32::from(proto::proxy_endpoint::ProxyType::Shadowsocks)
22+
}
23+
net::proxy::ProxyType::Custom => {
24+
i32::from(proto::proxy_endpoint::ProxyType::Custom)
25+
}
2226
},
2327
}),
2428
obfuscation: endpoint.obfuscation.map(|obfuscation_endpoint| {
@@ -77,11 +81,15 @@ impl TryFrom<proto::TunnelEndpoint> for talpid_types::net::TunnelEndpoint {
7781
)?,
7882
protocol: try_transport_protocol_from_i32(proxy_ep.protocol)?,
7983
},
80-
proxy_type: match proto::ProxyType::try_from(proxy_ep.proxy_type) {
81-
Ok(proto::ProxyType::Shadowsocks) => {
84+
proxy_type: match proto::proxy_endpoint::ProxyType::try_from(
85+
proxy_ep.proxy_type,
86+
) {
87+
Ok(proto::proxy_endpoint::ProxyType::Shadowsocks) => {
8288
talpid_net::proxy::ProxyType::Shadowsocks
8389
}
84-
Ok(proto::ProxyType::Custom) => talpid_net::proxy::ProxyType::Custom,
90+
Ok(proto::proxy_endpoint::ProxyType::Custom) => {
91+
talpid_net::proxy::ProxyType::Custom
92+
}
8593
Err(_) => {
8694
return Err(FromProtobufTypeError::InvalidArgument(
8795
"unknown proxy type",

mullvad-types/src/features.rs

+2
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ pub enum FeatureIndicator {
3131
SplitTunneling,
3232
LockdownMode,
3333
Udp2Tcp,
34+
Shadowsocks,
3435
LanSharing,
3536
DnsContentBlockers,
3637
CustomDns,
@@ -49,6 +50,7 @@ impl std::fmt::Display for FeatureIndicator {
4950
FeatureIndicator::SplitTunneling => "Split Tunneling",
5051
FeatureIndicator::LockdownMode => "Lockdown Mode",
5152
FeatureIndicator::Udp2Tcp => "Udp2Tcp",
53+
FeatureIndicator::Shadowsocks => "Shadowsocks",
5254
FeatureIndicator::LanSharing => "LAN Sharing",
5355
FeatureIndicator::DnsContentBlockers => "Dns Content Blocker",
5456
FeatureIndicator::CustomDns => "Custom Dns",

0 commit comments

Comments
 (0)