summaryrefslogtreecommitdiff
path: root/app/src/main/java/de/blinkt
diff options
context:
space:
mode:
authorcyBerta <cyberta@riseup.net>2023-03-31 15:46:09 +0200
committercyBerta <cyberta@riseup.net>2023-04-13 16:47:13 +0200
commitf6017ab12d0c472ab4f22e81d9a768ad2510b134 (patch)
tree8a38157b4218b54a12f3990beaa2852917f4de1d /app/src/main/java/de/blinkt
parenta4deca391ce064510002e24ba9f18d965f0dee59 (diff)
don't handle obfs4 over kcp as a separate pluggable transport, instead 'tcp' and 'kcp' become valid protocols for obfs4
Diffstat (limited to 'app/src/main/java/de/blinkt')
-rw-r--r--app/src/main/java/de/blinkt/openvpn/VpnProfile.java25
-rw-r--r--app/src/main/java/de/blinkt/openvpn/core/connection/Connection.java21
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;