diff options
Diffstat (limited to 'app/src')
-rw-r--r-- | app/src/custom/assets/ptdemo.bitmask.eip-service.json | 4 | ||||
-rw-r--r-- | app/src/main/java/se/leap/bitmaskclient/eip/VpnConfigGenerator.java | 12 |
2 files changed, 9 insertions, 7 deletions
diff --git a/app/src/custom/assets/ptdemo.bitmask.eip-service.json b/app/src/custom/assets/ptdemo.bitmask.eip-service.json index 05dc1447..590652d3 100644 --- a/app/src/custom/assets/ptdemo.bitmask.eip-service.json +++ b/app/src/custom/assets/ptdemo.bitmask.eip-service.json @@ -59,6 +59,6 @@ "key-direction" : "1", "verb" : "3" }, - "serial":2, - "version":2 + "serial":3, + "version":3 }
\ No newline at end of file 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 a131bdd8..2214b592 100644 --- a/app/src/main/java/se/leap/bitmaskclient/eip/VpnConfigGenerator.java +++ b/app/src/main/java/se/leap/bitmaskclient/eip/VpnConfigGenerator.java @@ -58,7 +58,7 @@ public class VpnConfigGenerator { public final static String TAG = VpnConfigGenerator.class.getSimpleName(); private final String newLine = System.getProperty("line.separator"); // Platform new line - public VpnConfigGenerator(JSONObject generalConfiguration, JSONObject secrets, JSONObject gateway, int apiVersion) { + public VpnConfigGenerator(JSONObject generalConfiguration, JSONObject secrets, JSONObject gateway, int apiVersion) throws ConfigParser.ConfigParseError { this.generalConfiguration = generalConfiguration; this.gateway = gateway; this.secrets = secrets; @@ -66,21 +66,22 @@ public class VpnConfigGenerator { checkCapabilities(); } - public void checkCapabilities() { + public void checkCapabilities() throws ConfigParser.ConfigParseError { try { - if (apiVersion == 2) { + if (apiVersion == 3) { JSONArray supportedTransports = gateway.getJSONObject(CAPABILITIES).getJSONArray(TRANSPORT); for (int i = 0; i < supportedTransports.length(); i++) { JSONObject transport = supportedTransports.getJSONObject(i); if (transport.getString(TYPE).equals(OBFS4.toString())) { obfs4Transport = transport; + break; } } } } catch (JSONException e) { - e.printStackTrace(); + throw new ConfigParser.ConfigParseError("Api version ("+ apiVersion +") did not match required JSON fields"); } } @@ -161,9 +162,10 @@ public class VpnConfigGenerator { switch (apiVersion) { default: case 1: + case 2: gatewayConfigApiv1(stringBuilder, ipAddress, capabilities); break; - case 2: + case 3: JSONArray transports = capabilities.getJSONArray(TRANSPORT); gatewayConfigApiv2(transportType, stringBuilder, ipAddress, transports); break; |