diff options
author | cyBerta <cyberta@riseup.net> | 2019-08-02 00:46:10 +0200 |
---|---|---|
committer | cyBerta <cyberta@riseup.net> | 2019-08-02 01:49:37 +0200 |
commit | 5144166172e3620a5bd9f6df7436222afeb4d133 (patch) | |
tree | 8c4c958f3ff24a42dc8fe3a9452bf9b3d76677f4 /app/src/main/java | |
parent | 032b687c79fb4b6e8004db342286cb9e9c119142 (diff) |
rename DispatcherOptions to Obfs4Options
Diffstat (limited to 'app/src/main/java')
-rw-r--r-- | app/src/main/java/de/blinkt/openvpn/core/ConfigParser.java | 10 | ||||
-rw-r--r-- | app/src/main/java/de/blinkt/openvpn/core/connection/Obfs4Connection.java | 8 | ||||
-rw-r--r-- | app/src/main/java/se/leap/bitmaskclient/eip/VpnConfigGenerator.java | 8 | ||||
-rw-r--r-- | app/src/main/java/se/leap/bitmaskclient/pluggableTransports/Dispatcher.java | 10 | ||||
-rw-r--r-- | app/src/main/java/se/leap/bitmaskclient/pluggableTransports/Obfs4Options.java (renamed from app/src/main/java/se/leap/bitmaskclient/pluggableTransports/DispatcherOptions.java) | 4 | ||||
-rw-r--r-- | app/src/main/java/se/leap/bitmaskclient/pluggableTransports/Shapeshifter.java | 19 |
6 files changed, 38 insertions, 21 deletions
diff --git a/app/src/main/java/de/blinkt/openvpn/core/ConfigParser.java b/app/src/main/java/de/blinkt/openvpn/core/ConfigParser.java index 4c53087f..5ccd83dd 100644 --- a/app/src/main/java/de/blinkt/openvpn/core/ConfigParser.java +++ b/app/src/main/java/de/blinkt/openvpn/core/ConfigParser.java @@ -25,7 +25,7 @@ import de.blinkt.openvpn.VpnProfile; import de.blinkt.openvpn.core.connection.Connection; import de.blinkt.openvpn.core.connection.Obfs4Connection; import de.blinkt.openvpn.core.connection.OpenvpnConnection; -import se.leap.bitmaskclient.pluggableTransports.DispatcherOptions; +import se.leap.bitmaskclient.pluggableTransports.Obfs4Options; import static de.blinkt.openvpn.core.connection.Connection.TransportType.OBFS4; @@ -140,7 +140,7 @@ public class ConfigParser { private HashMap<String, Vector<Vector<String>>> options = new HashMap<>(); private HashMap<String, Vector<String>> meta = new HashMap<String, Vector<String>>(); private String auth_user_pass_file; - private DispatcherOptions dispatcherOptions; + private Obfs4Options obfs4Options; static public void useEmbbedUserAuth(VpnProfile np, String inlinedata) { String data = VpnProfile.getEmbeddedContent(inlinedata); @@ -752,8 +752,8 @@ public class ConfigParser { return TextUtils.join(s, str); } - public void setDispatcherOptions(DispatcherOptions dispatcherOptions) { - this.dispatcherOptions = dispatcherOptions; + public void setObfs4Options(Obfs4Options obfs4Options) { + this.obfs4Options = obfs4Options; } private Pair<Connection, Connection[]> parseConnection(String connection, Connection defaultValues) throws IOException, ConfigParseError { @@ -776,7 +776,7 @@ public class ConfigParser { return null; } else - conn = transportType == OBFS4 ? new Obfs4Connection(dispatcherOptions) : new OpenvpnConnection(); + conn = transportType == OBFS4 ? new Obfs4Connection(obfs4Options) : new OpenvpnConnection(); Vector<String> port = getOption("port", 1, 1); if (port != null) { 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 4f6be276..a2f86e05 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,6 @@ package de.blinkt.openvpn.core.connection; -import se.leap.bitmaskclient.pluggableTransports.DispatcherOptions; +import se.leap.bitmaskclient.pluggableTransports.Obfs4Options; import static se.leap.bitmaskclient.pluggableTransports.Dispatcher.DISPATCHER_IP; import static se.leap.bitmaskclient.pluggableTransports.Dispatcher.DISPATCHER_PORT; @@ -12,9 +12,9 @@ import static se.leap.bitmaskclient.pluggableTransports.Dispatcher.DISPATCHER_PO public class Obfs4Connection extends Connection { private static final String TAG = Obfs4Connection.class.getName(); - private DispatcherOptions options; + private Obfs4Options options; - public Obfs4Connection(DispatcherOptions options) { + public Obfs4Connection(Obfs4Options options) { setUseUdp(false); setServerName(DISPATCHER_IP); setServerPort(DISPATCHER_PORT); @@ -52,7 +52,7 @@ public class Obfs4Connection extends Connection { } - public DispatcherOptions getDispatcherOptions() { + public Obfs4Options getDispatcherOptions() { return options; } diff --git a/app/src/main/java/se/leap/bitmaskclient/eip/VpnConfigGenerator.java b/app/src/main/java/se/leap/bitmaskclient/eip/VpnConfigGenerator.java index 6b76e8d9..d9bf5dd3 100644 --- a/app/src/main/java/se/leap/bitmaskclient/eip/VpnConfigGenerator.java +++ b/app/src/main/java/se/leap/bitmaskclient/eip/VpnConfigGenerator.java @@ -29,7 +29,7 @@ import de.blinkt.openvpn.VpnProfile; import de.blinkt.openvpn.core.ConfigParser; import de.blinkt.openvpn.core.connection.Connection; import se.leap.bitmaskclient.Provider; -import se.leap.bitmaskclient.pluggableTransports.DispatcherOptions; +import se.leap.bitmaskclient.pluggableTransports.Obfs4Options; import static de.blinkt.openvpn.core.connection.Connection.TransportType.OBFS4; import static de.blinkt.openvpn.core.connection.Connection.TransportType.OPENVPN; @@ -116,18 +116,18 @@ public class VpnConfigGenerator { ConfigParser icsOpenvpnConfigParser = new ConfigParser(); icsOpenvpnConfigParser.parseConfig(new StringReader(configuration)); if (transportType == OBFS4) { - icsOpenvpnConfigParser.setDispatcherOptions(getDispatcherOptions()); + icsOpenvpnConfigParser.setObfs4Options(getObfs4Options()); } return icsOpenvpnConfigParser.convertProfile(transportType); } - private DispatcherOptions getDispatcherOptions() throws JSONException { + private Obfs4Options getObfs4Options() throws JSONException { JSONObject transportOptions = obfs4Transport.getJSONObject(OPTIONS); String iatMode = transportOptions.getString("iat-mode"); String cert = transportOptions.getString("cert"); String port = obfs4Transport.getJSONArray(PORTS).getString(0); String ip = gateway.getString(IP_ADDRESS); - return new DispatcherOptions(ip, port, cert, iatMode); + return new Obfs4Options(ip, port, cert, iatMode); } private String generalConfiguration() { diff --git a/app/src/main/java/se/leap/bitmaskclient/pluggableTransports/Dispatcher.java b/app/src/main/java/se/leap/bitmaskclient/pluggableTransports/Dispatcher.java index 240dae75..8e787b57 100644 --- a/app/src/main/java/se/leap/bitmaskclient/pluggableTransports/Dispatcher.java +++ b/app/src/main/java/se/leap/bitmaskclient/pluggableTransports/Dispatcher.java @@ -46,12 +46,12 @@ public class Dispatcher { private Thread dispatcherThread = null; private int dispatcherPid = -1; - public Dispatcher(Context context, DispatcherOptions dispatcherOptions) { + public Dispatcher(Context context, Obfs4Options obfs4Options) { this.context = context.getApplicationContext(); - this.remoteIP = dispatcherOptions.remoteIP; - this.remotePort = dispatcherOptions.remotePort; - this.certificate = dispatcherOptions.cert; - this.iatMode = dispatcherOptions.iatMode; + this.remoteIP = obfs4Options.remoteIP; + this.remotePort = obfs4Options.remotePort; + this.certificate = obfs4Options.cert; + this.iatMode = obfs4Options.iatMode; } @WorkerThread diff --git a/app/src/main/java/se/leap/bitmaskclient/pluggableTransports/DispatcherOptions.java b/app/src/main/java/se/leap/bitmaskclient/pluggableTransports/Obfs4Options.java index 76ccbd79..2f9cb732 100644 --- a/app/src/main/java/se/leap/bitmaskclient/pluggableTransports/DispatcherOptions.java +++ b/app/src/main/java/se/leap/bitmaskclient/pluggableTransports/Obfs4Options.java @@ -2,13 +2,13 @@ package se.leap.bitmaskclient.pluggableTransports; import java.io.Serializable; -public class DispatcherOptions implements Serializable { +public class Obfs4Options implements Serializable { public String cert; public String iatMode; public String remoteIP; public String remotePort; - public DispatcherOptions(String remoteIP, String remotePort, String cert, String iatMode) { + public Obfs4Options(String remoteIP, String remotePort, String cert, String iatMode) { this.cert = cert; this.iatMode = iatMode; this.remoteIP = remoteIP; diff --git a/app/src/main/java/se/leap/bitmaskclient/pluggableTransports/Shapeshifter.java b/app/src/main/java/se/leap/bitmaskclient/pluggableTransports/Shapeshifter.java index 513a310e..175e236a 100644 --- a/app/src/main/java/se/leap/bitmaskclient/pluggableTransports/Shapeshifter.java +++ b/app/src/main/java/se/leap/bitmaskclient/pluggableTransports/Shapeshifter.java @@ -1,3 +1,20 @@ +/** + * Copyright (c) 2019 LEAP Encryption Access Project and contributors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + package se.leap.bitmaskclient.pluggableTransports; import android.util.Log; @@ -12,7 +29,7 @@ public class Shapeshifter { ShapeShifter shapeShifter; - public Shapeshifter(DispatcherOptions options) { + public Shapeshifter(Obfs4Options options) { shapeShifter = new ShapeShifter(); shapeShifter.setIatMode(Long.valueOf(options.iatMode)); shapeShifter.setSocksAddr(DISPATCHER_IP+":"+DISPATCHER_PORT); |