From 07e0d3f5400532ef371769527ba4477bc70a6483 Mon Sep 17 00:00:00 2001 From: Norbel AMBANUMBEN Date: Fri, 15 Nov 2024 00:23:20 +0100 Subject: finalize gateway manager --- .../se/leap/bitmaskclient/eip/GatewaysManager.java | 38 +++++++++++----------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'app/src/main/java/se/leap/bitmaskclient/eip') 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 getObfuscationTransportLayerProtocols() { - Set 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) { -- cgit v1.2.3