diff options
4 files changed, 90 insertions, 65 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 7229f7ff..853082be 100644 --- a/app/src/main/java/se/leap/bitmaskclient/eip/VpnConfigGenerator.java +++ b/app/src/main/java/se/leap/bitmaskclient/eip/VpnConfigGenerator.java @@ -418,7 +418,9 @@ public class VpnConfigGenerator { } Transport openvpnTransport = transports.get(OPENVPN); if (openvpnTransport == null) { - return false; + // the bridge seems to be to be decoupled from the gateway, we can't say if the openvpn gateway + // will support this PT and hope the admins configured the gateway correctly + return true; } String[] protocols = openvpnTransport.getProtocols(); diff --git a/app/src/test/java/se/leap/bitmaskclient/eip/GatewaysManagerTest.java b/app/src/test/java/se/leap/bitmaskclient/eip/GatewaysManagerTest.java index 1b42b5d2..913a023a 100644 --- a/app/src/test/java/se/leap/bitmaskclient/eip/GatewaysManagerTest.java +++ b/app/src/test/java/se/leap/bitmaskclient/eip/GatewaysManagerTest.java @@ -93,14 +93,6 @@ public class GatewaysManagerTest { } @Test - public void testGatewayManagerFromCurrentProvider_misconfiguredProvider_noGateways() throws IOException, NullPointerException { - Provider provider = getProvider(null, null, null, null, null, null, "ptdemo_misconfigured_gateway.json", null); - MockHelper.mockProviderObservable(provider); - GatewaysManager gatewaysManager = new GatewaysManager(mockContext); - assertEquals(0, gatewaysManager.size()); - } - - @Test public void testGatewayManagerFromCurrentProvider_threeGateways() { Provider provider = getProvider(null, null, null, null,null, null, "ptdemo_three_mixed_gateways.json", null); MockHelper.mockProviderObservable(provider); @@ -551,8 +543,6 @@ public class GatewaysManagerTest { assertEquals(0.3, gatewaysManager.getLocation("Amsterdam").getAverageLoad(OPENVPN)); } - - @Test public void testGetLoadForLocation_() { MockHelper.mockProviderObservable(null); @@ -560,6 +550,14 @@ public class GatewaysManagerTest { assertEquals(GatewaysManager.Load.UNKNOWN, gatewaysManager.getLoadForLocation("unknown city", OPENVPN)); } + @Test + public void testGatewayManagerFromCurrentProvider_decoupledBridges_twoGateways() throws IOException, NullPointerException { + Provider provider = getProvider(null, null, null, null, null, null, "decoupled_pt.eip-service.json", null); + MockHelper.mockProviderObservable(provider); + GatewaysManager gatewaysManager = new GatewaysManager(mockContext); + assertEquals(2, gatewaysManager.size()); + } + private String getJsonStringFor(String filename) throws IOException { return TestSetupHelper.getInputAsString(getClass().getClassLoader().getResourceAsStream(filename)); } diff --git a/app/src/test/resources/decoupled_pt.eip-service.json b/app/src/test/resources/decoupled_pt.eip-service.json new file mode 100644 index 00000000..62dd0cf2 --- /dev/null +++ b/app/src/test/resources/decoupled_pt.eip-service.json @@ -0,0 +1,79 @@ +{ + "gateways":[ + { + "capabilities":{ + "adblock":false, + "filter_dns":false, + "limited":false, + "transport":[ + { + "ports":[ + "53", + "80", + "1194" + ], + "protocols":[ + "tcp", + "udp" + ], + "type":"openvpn" + } + ] + }, + "host":"gateway-nyc1-01.bitmask-dev.leapvpn.net", + "ip_address":"67.205.131.206", + "location":"NYC" + }, + { + "capabilities":{ + "adblock":false, + "filter_dns":false, + "limited":false, + "transport":[ + { + "options":{ + "cert":"pIp+etK+ud3aKAa3Uujbc3q3kwQOBQgW1UUIXXkeQ+i24WFnSzTT1Q69F0x8EXpcq5jyGg", + "iatMode":"0" + }, + "ports":[ + "443" + ], + "protocols":[ + "tcp" + ], + "type":"obfs4" + } + ] + }, + "host":"bridge-nyc1-01.bitmask-dev.leapvpn.net", + "ip_address":"104.248.232.240", + "location":"NYC" + } + ], + "locations":{ + "NYC":{ + "country_code":"US", + "hemisphere":"N", + "name":"New York City", + "timezone":"-4" + } + }, + "openvpn_configuration":{ + "auth":"SHA512", + "cipher":"AES-256-GCM", + "data-ciphers":"AES-256-GCM", + "dev":"tun", + "float":"", + "keepalive":"10 30", + "key-direction":"1", + "nobind":true, + "persist-key":true, + "rcvbuf":"0", + "sndbuf":"0", + "tls-cipher":"TLS-ECDHE-ECDSA-WITH-AES-256-GCM-SHA384", + "tls-version-min":"1.2", + "verb":"3" + }, + "serial":3, + "version":3 +}
\ No newline at end of file diff --git a/app/src/test/resources/ptdemo_misconfigured_gateway.json b/app/src/test/resources/ptdemo_misconfigured_gateway.json deleted file mode 100644 index 38008880..00000000 --- a/app/src/test/resources/ptdemo_misconfigured_gateway.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "gateways":[ - { - "capabilities":{ - "adblock":false, - "filter_dns":false, - "limited":false, - "transport":[ - { - "type":"obfs4", - "protocols":[ - "tcp" - ], - "ports":[ - "443" - ], - "options": { - "cert": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX2", - "iat-mode": "0" - } - } - ], - "user_ips":false - }, - "host":"moscow.bitmask.net", - "ip_address":"3.21.247.89", - "location":"moscow" - } - ], - "locations":{ - "Amsterdam":{ - "country_code":"NL", - "hemisphere":"N", - "name":"Amsterdam", - "timezone":"-1" - } - }, - "openvpn_configuration":{ - "auth":"SHA1", - "cipher":"AES-256-CBC", - "keepalive":"10 30", - "tls-cipher":"DHE-RSA-AES128-SHA", - "tun-ipv6":true, - "dev" : "tun", - "sndbuf" : "0", - "rcvbuf" : "0", - "nobind" : true, - "persist-key" : true, - "key-direction" : "1", - "verb" : "3" - }, - "serial":2, - "version":3 -}
\ No newline at end of file |