summaryrefslogtreecommitdiff
path: root/app/src/main/java/de
diff options
context:
space:
mode:
authorcyBerta <cyberta@riseup.net>2022-05-30 23:50:50 +0200
committercyBerta <cyberta@riseup.net>2022-07-19 00:03:41 +0200
commit61bfc6b6d3ad830a8a7569ea31399e93f48dd38d (patch)
tree1ad5a09f06981fe329e7ffa642d17f4d4f956d61 /app/src/main/java/de
parent71d1c34319b703d909c882c24a436cd74ed42cc0 (diff)
obfuscate vpn traffic using either shapeshfiter or obfsvpn
Diffstat (limited to 'app/src/main/java/de')
-rw-r--r--app/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java17
-rw-r--r--app/src/main/java/de/blinkt/openvpn/core/connection/Obfs4Connection.java23
2 files changed, 33 insertions, 7 deletions
diff --git a/app/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java b/app/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java
index d624af80..6edbbab4 100644
--- a/app/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java
+++ b/app/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java
@@ -43,10 +43,12 @@ import de.blinkt.openvpn.core.VpnStatus.ByteCountListener;
import de.blinkt.openvpn.core.VpnStatus.StateListener;
import de.blinkt.openvpn.core.connection.Connection;
import de.blinkt.openvpn.core.connection.Obfs4Connection;
+import se.leap.bitmaskclient.BuildConfig;
import se.leap.bitmaskclient.R;
import se.leap.bitmaskclient.eip.EipStatus;
import se.leap.bitmaskclient.eip.VpnNotificationManager;
import se.leap.bitmaskclient.firewall.FirewallManager;
+import se.leap.bitmaskclient.pluggableTransports.ObfsVpnClient;
import se.leap.bitmaskclient.pluggableTransports.Shapeshifter;
import static de.blinkt.openvpn.core.ConnectionStatus.LEVEL_CONNECTED;
@@ -89,6 +91,7 @@ public class OpenVPNService extends VpnService implements StateListener, Callbac
private Runnable mOpenVPNThread;
private VpnNotificationManager notificationManager;
private Shapeshifter shapeshifter;
+ private ObfsVpnClient obfsVpnClient;
private FirewallManager firewallManager;
private final IBinder mBinder = new IOpenVPNServiceInternal.Stub() {
@@ -241,6 +244,9 @@ public class OpenVPNService extends VpnService implements StateListener, Callbac
if (shapeshifter != null) {
shapeshifter.stop();
shapeshifter = null;
+ } else if (obfsVpnClient != null) {
+ obfsVpnClient.stop();
+ obfsVpnClient = null;
}
VpnStatus.updateStateString("NOPROCESS", "VPN STOPPED", R.string.state_noprocess, ConnectionStatus.LEVEL_NOTCONNECTED);
}
@@ -412,7 +418,12 @@ public class OpenVPNService extends VpnService implements StateListener, Callbac
if (mProfile.mUsePluggableTransports && connection instanceof Obfs4Connection) {
Obfs4Connection obfs4Connection = (Obfs4Connection) connection;
- if (shapeshifter == null) {
+ if (BuildConfig.use_obfsvpn) {
+ if (obfsVpnClient == null) {
+ obfsVpnClient = new ObfsVpnClient(obfs4Connection.getDispatcherOptions());
+ obfsVpnClient.start();
+ }
+ } else if (shapeshifter == null) {
shapeshifter = new Shapeshifter(obfs4Connection.getDispatcherOptions());
shapeshifter.start();
}
@@ -474,6 +485,10 @@ public class OpenVPNService extends VpnService implements StateListener, Callbac
Log.d(TAG, "-> stop shapeshifter");
shapeshifter.stop();
shapeshifter = null;
+ } else if (obfsVpnClient != null) {
+ Log.d(TAG, "-> stop obfsvpnClient");
+ obfsVpnClient.stop();
+ obfsVpnClient = null;
}
try {
Thread.sleep(1000);
diff --git a/app/src/main/java/de/blinkt/openvpn/core/connection/Obfs4Connection.java b/app/src/main/java/de/blinkt/openvpn/core/connection/Obfs4Connection.java
index 82a7a6aa..393afd94 100644
--- a/app/src/main/java/de/blinkt/openvpn/core/connection/Obfs4Connection.java
+++ b/app/src/main/java/de/blinkt/openvpn/core/connection/Obfs4Connection.java
@@ -1,6 +1,8 @@
package de.blinkt.openvpn.core.connection;
+import se.leap.bitmaskclient.BuildConfig;
import se.leap.bitmaskclient.pluggableTransports.Obfs4Options;
+import se.leap.bitmaskclient.pluggableTransports.ObfsVpnClient;
import static se.leap.bitmaskclient.pluggableTransports.Shapeshifter.DISPATCHER_IP;
import static se.leap.bitmaskclient.pluggableTransports.Shapeshifter.DISPATCHER_PORT;
@@ -16,14 +18,23 @@ public class Obfs4Connection extends Connection {
private Obfs4Options options;
public Obfs4Connection(Obfs4Options options) {
- setUseUdp(false);
- setServerName(DISPATCHER_IP);
- setServerPort(DISPATCHER_PORT);
- setProxyName("");
- setProxyPort("");
+ if (BuildConfig.use_obfsvpn) {
+ setUseUdp(options.udp);
+ setServerName(options.remoteIP);
+ setServerPort(options.remotePort);
+ setProxyName(ObfsVpnClient.SOCKS_IP);
+ setProxyPort(ObfsVpnClient.SOCKS_PORT);
+ setProxyType(ProxyType.SOCKS5);
+ } else {
+ setUseUdp(false);
+ setServerName(DISPATCHER_IP);
+ setServerPort(DISPATCHER_PORT);
+ setProxyName("");
+ setProxyPort("");
+ setProxyType(ProxyType.NONE);
+ }
setProxyAuthUser(null);
setProxyAuthPassword(null);
- setProxyType(ProxyType.NONE);
setUseProxyAuth(false);
this.options = options;
}