diff options
| -rw-r--r-- | app/src/main/java/se/leap/bitmaskclient/tor/ClientTransportPlugin.java | 40 | ||||
| m--------- | bitmask-core-android | 0 | ||||
| -rw-r--r-- | docker/android-emulator/Dockerfile | 2 | ||||
| -rw-r--r-- | docker/android-ndk/Dockerfile | 2 | ||||
| -rw-r--r-- | docker/android-sdk/Dockerfile | 2 | ||||
| -rwxr-xr-x | scripts/build_deps.sh | 4 |
6 files changed, 41 insertions, 9 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/tor/ClientTransportPlugin.java b/app/src/main/java/se/leap/bitmaskclient/tor/ClientTransportPlugin.java index b7909865..ca71a6e2 100644 --- a/app/src/main/java/se/leap/bitmaskclient/tor/ClientTransportPlugin.java +++ b/app/src/main/java/se/leap/bitmaskclient/tor/ClientTransportPlugin.java @@ -38,6 +38,7 @@ import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStreamReader; import java.lang.ref.WeakReference; +import java.net.URL; import java.util.Collection; import java.util.HashMap; import java.util.Random; @@ -47,7 +48,9 @@ import java.util.concurrent.TimeoutException; import java.util.regex.Matcher; import java.util.regex.Pattern; +import IPtProxy.Controller; import IPtProxy.IPtProxy; +import IPtProxy.OnTransportEvents; public class ClientTransportPlugin implements ClientTransportPluginInterface, PropertyChangeListener { public static String TAG = ClientTransportPlugin.class.getSimpleName(); @@ -61,12 +64,27 @@ public class ClientTransportPlugin implements ClientTransportPluginInterface, Pr private String logfilePath; Handler handler; HandlerThread handlerThread; + Controller controller; public ClientTransportPlugin(Context context) { this.contextRef = new WeakReference<>(context); handlerThread = new HandlerThread("clientTransportPlugin", Thread.MIN_PRIORITY); loadCdnFronts(context); - IPtProxy.setStateLocation(context.getApplicationContext().getCacheDir() + "/pt_state"); + controller = initializeController(context.getApplicationContext()); + } + + private Controller initializeController(Context context) { + File ptDir = new File(context.getApplicationContext().getCacheDir(), "/pt_state"); + return IPtProxy.newController(ptDir.getAbsolutePath(), true, false, "DEBUG", new OnTransportEvents() { + @Override + public void connected(String s) { } + + @Override + public void error(String s, Exception e) { } + + @Override + public void stopped(String s, Exception e) { } + }); } @Override @@ -127,7 +145,19 @@ public class ClientTransportPlugin implements ClientTransportPluginInterface, Pr @return Port number where Snowflake will listen on, if no error happens during start up. */ private long startSnowflake(String ice, String url, String fronts, String ampCache, String sqsQueueURL, String sqsCredsStr, String logFile, boolean logToStateDir, boolean keepLocalAddresses, boolean unsafeLogging, long maxPeers) { - return IPtProxy.startSnowflake(ice, url, fronts, ampCache, sqsQueueURL, sqsCredsStr, logFile, logToStateDir, keepLocalAddresses, unsafeLogging, maxPeers); + try { + if (ice != null) controller.setSnowflakeIceServers(ice); + if (url != null) controller.setSnowflakeBrokerUrl(url); + if (fronts != null) controller.setSnowflakeFrontDomains(fronts); + if (ampCache != null) controller.setSnowflakeAmpCacheUrl(ampCache); + if (sqsQueueURL != null) controller.setSnowflakeSqsUrl(sqsQueueURL); + if (sqsCredsStr != null) controller.setSnowflakeSqsCreds(sqsCredsStr); + controller.setSnowflakeMaxPeers(5); + controller.start(IPtProxy.Snowflake, ""); + return new URL("https://"+controller.localAddress(IPtProxy.Snowflake)).getPort(); + } catch (Exception e) { + return -1; + } } private void retryConnectionAttempt(boolean useAmpCache) { @@ -173,13 +203,15 @@ public class ClientTransportPlugin implements ClientTransportPluginInterface, Pr logFileObserver = null; } TorStatusObservable.getInstance().deleteObserver(this); + controller.stop(IPtProxy.Snowflake); + controller = null; handlerThread.quit(); handler = null; handlerThread = null; } private void stopConnectionAttempt() { - IPtProxy.stopSnowflake(); + controller.stop(IPtProxy.Snowflake); try { TorStatusObservable.waitUntil(this::isSnowflakeOff, 10); } catch (InterruptedException | TimeoutException e) { @@ -231,7 +263,7 @@ public class ClientTransportPlugin implements ClientTransportPluginInterface, Pr if (matcher.matches()) { try { String strippedString = matcher.group(3).trim(); - if (strippedString.length() > 0) { + if (!strippedString.isEmpty()) { TorStatusObservable.logSnowflakeMessage(contextRef.get(), strippedString); } } catch (IndexOutOfBoundsException | IllegalStateException | NullPointerException e) { diff --git a/bitmask-core-android b/bitmask-core-android -Subproject 64fab2f1727d147d473d33761eeb7be94a354ea +Subproject 2977b7402b5338677a716e08f5418cfc5d2e929 diff --git a/docker/android-emulator/Dockerfile b/docker/android-emulator/Dockerfile index 572fc2c0..66ff8549 100644 --- a/docker/android-emulator/Dockerfile +++ b/docker/android-emulator/Dockerfile @@ -1,6 +1,6 @@ FROM registry.0xacab.org/leap/bitmask_android/android-sdk:latest -MAINTAINER LEAP Encryption Access Project <info@leap.se> +LABEL Author="LEAP Encryption Access Project <info@leap.se>"" LABEL Description="Android SDK baseimage based on debian:bullseye" Vendor="LEAP" Version="34" # Make sure debconf doesn't complain about lack of interactivity diff --git a/docker/android-ndk/Dockerfile b/docker/android-ndk/Dockerfile index c88c38b6..535607c5 100644 --- a/docker/android-ndk/Dockerfile +++ b/docker/android-ndk/Dockerfile @@ -1,6 +1,6 @@ FROM registry.0xacab.org/leap/bitmask_android/android-sdk:latest -MAINTAINER LEAP Encryption Access Project <info@leap.se> +LABEL Author="LEAP Encryption Access Project <info@leap.se>" LABEL Description="Android NDK image based on android-sdk baseimage" Vendor="LEAP" Version="r21e" # Make sure debconf doesn't complain about lack of interactivity diff --git a/docker/android-sdk/Dockerfile b/docker/android-sdk/Dockerfile index f146a085..59f6a9a4 100644 --- a/docker/android-sdk/Dockerfile +++ b/docker/android-sdk/Dockerfile @@ -1,6 +1,6 @@ FROM 0xacab.org:4567/leap/docker/debian:bullseye_amd64 -MAINTAINER LEAP Encryption Access Project <info@leap.se> +LABEL Author="LEAP Encryption Access Project <info@leap.se>" LABEL Description="Android SDK baseimage based on debian:bullseye" Vendor="LEAP" Version="33.0.0" # ------------------------------------------------------ diff --git a/scripts/build_deps.sh b/scripts/build_deps.sh index dd75ccae..9ffab018 100755 --- a/scripts/build_deps.sh +++ b/scripts/build_deps.sh @@ -13,8 +13,8 @@ DIR_GOLIBS=./bitmask-core-android/lib/ #FILE_X86=./go/out/x86/piedispatcherlib #FILE_ARM=./go/out/armeabi-v7a/piedispatcherlib DIR_TORLIBS=./tor-android/external/lib -EXPECTED_NDK_VERSION="21.4.7075529" -EXPECTED_ANDROID_NDK_RELEASE_VERSION="r21e" +EXPECTED_NDK_VERSION="28.2.13676358" +EXPECTED_ANDROID_NDK_RELEASE_VERSION="r28c" if [[ -z $BUILD_TOR ]]; then BUILD_TOR=true; fi if [[ -z $BUILD_OPENVPN_LIBS ]]; then BUILD_OPENVPN_LIBS=true; fi |
