diff options
Diffstat (limited to 'app/src/main/java/se/leap/bitmaskclient/eip/VpnConfigGenerator.java')
-rw-r--r-- | app/src/main/java/se/leap/bitmaskclient/eip/VpnConfigGenerator.java | 19 |
1 files changed, 10 insertions, 9 deletions
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 18c557dc..6b76e8d9 100644 --- a/app/src/main/java/se/leap/bitmaskclient/eip/VpnConfigGenerator.java +++ b/app/src/main/java/se/leap/bitmaskclient/eip/VpnConfigGenerator.java @@ -22,6 +22,7 @@ import org.json.JSONObject; import java.io.IOException; import java.io.StringReader; +import java.util.HashMap; import java.util.Iterator; import de.blinkt.openvpn.VpnProfile; @@ -52,8 +53,6 @@ public class VpnConfigGenerator { private JSONObject obfs4Transport; private int apiVersion; - private ConfigParser icsOpenvpnConfigParser = new ConfigParser(); - public final static String TAG = VpnConfigGenerator.class.getSimpleName(); private final String newLine = System.getProperty("line.separator"); // Platform new line @@ -85,16 +84,17 @@ public class VpnConfigGenerator { } } - public VpnProfile generateVpnProfile() throws IllegalStateException, - IOException, + public HashMap<Connection.TransportType, VpnProfile> generateVpnProfiles() throws ConfigParser.ConfigParseError, - NumberFormatException, JSONException { - + NumberFormatException, + JSONException, + IOException { + HashMap<Connection.TransportType, VpnProfile> profiles = new HashMap<>(); + profiles.put(OPENVPN, createProfile(OPENVPN)); if (supportsObfs4()) { - return createProfile(OBFS4); + profiles.put(OBFS4, createProfile(OBFS4)); } - - return createProfile(OPENVPN); + return profiles; } private boolean supportsObfs4(){ @@ -113,6 +113,7 @@ public class VpnConfigGenerator { private VpnProfile createProfile(Connection.TransportType transportType) throws IOException, ConfigParser.ConfigParseError, JSONException { String configuration = getConfigurationString(transportType); + ConfigParser icsOpenvpnConfigParser = new ConfigParser(); icsOpenvpnConfigParser.parseConfig(new StringReader(configuration)); if (transportType == OBFS4) { icsOpenvpnConfigParser.setDispatcherOptions(getDispatcherOptions()); |