diff options
author | Norbel AMBANUMBEN <aanorbel@gmail.com> | 2024-11-15 00:23:20 +0100 |
---|---|---|
committer | cyBerta <cyberta@riseup.net> | 2024-11-28 22:53:30 +0100 |
commit | 07e0d3f5400532ef371769527ba4477bc70a6483 (patch) | |
tree | eaeab7055fb2094e8af90da5cfd0bfbbe7b31d62 /app/src/main/java/se/leap/bitmaskclient/eip | |
parent | 8c8897ef78a2dfc5bef10c08a965b70a5431cf73 (diff) |
finalize gateway manager
Diffstat (limited to 'app/src/main/java/se/leap/bitmaskclient/eip')
-rw-r--r-- | app/src/main/java/se/leap/bitmaskclient/eip/GatewaysManager.java | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/eip/GatewaysManager.java b/app/src/main/java/se/leap/bitmaskclient/eip/GatewaysManager.java index 063d2341..37360f81 100644 --- a/app/src/main/java/se/leap/bitmaskclient/eip/GatewaysManager.java +++ b/app/src/main/java/se/leap/bitmaskclient/eip/GatewaysManager.java @@ -166,35 +166,35 @@ public class GatewaysManager { } private TransportType[] determineTransportTypes() { - if (getUseBridges() && !usesSpecificTunnel()) { - return new TransportType[]{OBFS4, OBFS4_HOP}; - } else if (getUseBridges() && getUseObfs4()) { - return new TransportType[]{OBFS4}; - } else if (getUseBridges() && getUseObfs4Kcp()) { - return new TransportType[]{OBFS4}; - } else if (getUseBridges() && usesSpecificTunnel() && getUsePortHopping()) { + if (!getUseBridges()){ + return new TransportType[]{OPENVPN}; + } + + if (getUsePortHopping()) { return new TransportType[]{OBFS4_HOP}; + } else if (getUseObfs4() || getUseObfs4Kcp()) { + return new TransportType[]{OBFS4}; } else { - return new TransportType[]{OPENVPN}; + return new TransportType[]{OBFS4, OBFS4_HOP}; } } @Nullable private static Set<String> getObfuscationTransportLayerProtocols() { - Set<String> transportProtocols = null; - - if (getUseBridges()) { - if (getUseObfs4Kcp()) { - transportProtocols = Set.of(KCP); - } else if (getUseObfs4()) { - transportProtocols = Set.of(TCP); - } else { - transportProtocols = Set.of(TCP, KCP); - } + if (!getUseBridges()) { + return null; } - return transportProtocols; + if (getUseObfs4()) { + return Set.of(TCP); + } else if (getUseObfs4Kcp()) { + return Set.of(KCP); + } else { + // If neither Obf4 nor Obf4Kcp are used, and bridges are enabled, + // then use both TCP and KCP (based on the original logic). + return Set.of(TCP, KCP); + } } public void updateTransport(TransportType transportType) { |