diff options
| author | David Lönnhager <david.l@mullvad.net> | 2025-05-05 13:22:53 +0200 |
|---|---|---|
| committer | David Lönnhager <david.l@mullvad.net> | 2025-05-08 09:23:55 +0200 |
| commit | 9fcc4a4643f70d610e2da0d9883416f44550ad08 (patch) | |
| tree | b818bc01fafccafe0280e67cafeccd62f4e4c57c | |
| parent | 488ee9131c76e2792c79caf497e2d387ba477229 (diff) | |
| download | mullvadvpn-9fcc4a4643f70d610e2da0d9883416f44550ad08.tar.xz mullvadvpn-9fcc4a4643f70d610e2da0d9883416f44550ad08.zip | |
Simplify conversion to ObfuscationEndpoint
| -rw-r--r-- | talpid-types/src/net/mod.rs | 30 |
1 files changed, 5 insertions, 25 deletions
diff --git a/talpid-types/src/net/mod.rs b/talpid-types/src/net/mod.rs index fc89cdc43f..091a3f869a 100644 --- a/talpid-types/src/net/mod.rs +++ b/talpid-types/src/net/mod.rs @@ -261,31 +261,11 @@ pub struct ObfuscationEndpoint { impl From<&ObfuscatorConfig> for ObfuscationEndpoint { fn from(config: &ObfuscatorConfig) -> ObfuscationEndpoint { - let (endpoint, obfuscation_type) = match config { - ObfuscatorConfig::Udp2Tcp { endpoint } => ( - Endpoint { - address: *endpoint, - protocol: TransportProtocol::Tcp, - }, - ObfuscationType::Udp2Tcp, - ), - ObfuscatorConfig::Shadowsocks { endpoint } => ( - Endpoint { - address: *endpoint, - protocol: TransportProtocol::Udp, - }, - ObfuscationType::Shadowsocks, - ), - ObfuscatorConfig::Quic { - hostname: _, - endpoint, - } => ( - Endpoint { - address: *endpoint, - protocol: TransportProtocol::Udp, - }, - ObfuscationType::Quic, - ), + let endpoint = config.get_obfuscator_endpoint(); + let obfuscation_type = match config { + ObfuscatorConfig::Udp2Tcp { .. } => ObfuscationType::Udp2Tcp, + ObfuscatorConfig::Shadowsocks { .. } => ObfuscationType::Shadowsocks, + ObfuscatorConfig::Quic { .. } => ObfuscationType::Quic, }; ObfuscationEndpoint { |
