diff options
Diffstat (limited to 'app/src/main/java/de/blinkt')
-rw-r--r-- | app/src/main/java/de/blinkt/openvpn/VpnProfile.java | 25 | ||||
-rw-r--r-- | app/src/main/java/de/blinkt/openvpn/core/connection/Connection.java | 21 |
2 files changed, 27 insertions, 19 deletions
diff --git a/app/src/main/java/de/blinkt/openvpn/VpnProfile.java b/app/src/main/java/de/blinkt/openvpn/VpnProfile.java index 83cde85e..3428e0c4 100644 --- a/app/src/main/java/de/blinkt/openvpn/VpnProfile.java +++ b/app/src/main/java/de/blinkt/openvpn/VpnProfile.java @@ -5,6 +5,11 @@ package de.blinkt.openvpn; +import static de.blinkt.openvpn.core.connection.Connection.TransportType.OBFS4; +import static de.blinkt.openvpn.core.connection.Connection.TransportType.OPENVPN; +import static se.leap.bitmaskclient.base.models.Constants.PROVIDER_PROFILE; +import static se.leap.bitmaskclient.base.utils.ConfigHelper.stringEqual; + import android.annotation.SuppressLint; import android.content.Context; import android.content.Intent; @@ -34,8 +39,6 @@ import java.io.FileWriter; import java.io.IOException; import java.io.Serializable; import java.io.StringWriter; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; import java.security.InvalidKeyException; import java.security.NoSuchAlgorithmException; import java.security.PrivateKey; @@ -69,12 +72,6 @@ import de.blinkt.openvpn.core.connection.ConnectionAdapter; import se.leap.bitmaskclient.BuildConfig; import se.leap.bitmaskclient.R; -import static de.blinkt.openvpn.core.connection.Connection.TransportType.OBFS4; -import static de.blinkt.openvpn.core.connection.Connection.TransportType.OBFS4_KCP; -import static de.blinkt.openvpn.core.connection.Connection.TransportType.OPENVPN; -import static se.leap.bitmaskclient.base.models.Constants.PROVIDER_PROFILE; -import static se.leap.bitmaskclient.base.utils.ConfigHelper.stringEqual; - public class VpnProfile implements Serializable, Cloneable { // Note that this class cannot be moved to core where it belongs since // the profile loading depends on it being here @@ -184,6 +181,7 @@ public class VpnProfile implements Serializable, Cloneable { /* Options no longer used in new profiles */ public String mServerName = "openvpn.example.com"; public String mServerPort = "1194"; + @Deprecated public boolean mUseUdp = true; public boolean mTemporaryProfile = false; private transient PrivateKey mPrivateKey; @@ -193,8 +191,7 @@ public class VpnProfile implements Serializable, Cloneable { private int mProfileVersion; public boolean mBlockUnusedAddressFamilies = true; public String mGatewayIp; - private boolean mUseObfs4; - private boolean mUseObfs4Kcp; + private final boolean mUseObfs4; public VpnProfile(String name, Connection.TransportType transportType) { mUuid = UUID.randomUUID(); @@ -204,7 +201,6 @@ public class VpnProfile implements Serializable, Cloneable { mConnections = new Connection[1]; mLastUsed = System.currentTimeMillis(); mUseObfs4 = transportType == OBFS4; - mUseObfs4Kcp = transportType == OBFS4_KCP; } public static String openVpnEscape(String unescaped) { @@ -270,8 +266,7 @@ public class VpnProfile implements Serializable, Cloneable { if (obj instanceof VpnProfile) { VpnProfile vp = (VpnProfile) obj; return stringEqual(vp.mGatewayIp, mGatewayIp) && - vp.mUseObfs4 == mUseObfs4 && - vp.mUseObfs4Kcp == mUseObfs4Kcp; + vp.mUseObfs4 == mUseObfs4; } return false; } @@ -302,14 +297,12 @@ public class VpnProfile implements Serializable, Cloneable { } public boolean usePluggableTransports() { - return mUseObfs4Kcp || mUseObfs4; + return mUseObfs4; } public Connection.TransportType getTransportType() { if (mUseObfs4) { return OBFS4; - } else if (mUseObfs4Kcp) { - return OBFS4_KCP; } else { return OPENVPN; } diff --git a/app/src/main/java/de/blinkt/openvpn/core/connection/Connection.java b/app/src/main/java/de/blinkt/openvpn/core/connection/Connection.java index f60e7333..137b3f16 100644 --- a/app/src/main/java/de/blinkt/openvpn/core/connection/Connection.java +++ b/app/src/main/java/de/blinkt/openvpn/core/connection/Connection.java @@ -37,10 +37,25 @@ public abstract class Connection implements Serializable, Cloneable { ORBOT } + public enum TransportProtocol { + UDP("udp"), + TCP("tcp"), + KCP("kcp"); + + String protocol; + + TransportProtocol(String transportProtocol) { + this.protocol = transportProtocol; + } + + @Override + public String toString() { + return protocol; + } + } public enum TransportType { OBFS4("obfs4"), OPENVPN("openvpn"), - OBFS4_KCP("obfs4-1"), PT("metaTransport"); @@ -56,11 +71,11 @@ public abstract class Connection implements Serializable, Cloneable { } public boolean isPluggableTransport() { - return this == OBFS4 || this == OBFS4_KCP || this == PT; + return this == OBFS4 || this == PT; } public TransportType getMetaType() { - if (this == OBFS4 || this == OBFS4_KCP || this == PT) { + if (this == OBFS4 || this == PT) { return PT; } return OPENVPN; |