commit 4d57755506496d02107e4dc2adf38252032df383 Author: Matthew Finkel sysrqb@torproject.org Date: Fri May 29 20:26:19 2020 +0000
Bug 30318 - Integrate snowflake on Android --- projects/tor-android-service/config | 2 +- .../0001-Bug-30318-Add-snowflake-support.patch | 90 ++++++++++++++++++++++ projects/tor-onion-proxy-library/build | 1 + projects/tor-onion-proxy-library/config | 1 + 4 files changed, 93 insertions(+), 1 deletion(-)
diff --git a/projects/tor-android-service/config b/projects/tor-android-service/config index 800fc47..7ab3ca7 100644 --- a/projects/tor-android-service/config +++ b/projects/tor-android-service/config @@ -1,7 +1,7 @@ # vim: filetype=yaml sw=2 version: '[% c("abbrev") %]' filename: '[% project %]-[% c("version") %]-[% c("var/build_id") %]' -git_hash: ed2e1479eeddede01b1d510ef79dc5ec798b39c0 +git_hash: ecc251d0a73f7e2034a271efd28036a0108b8688 git_url: https://git.torproject.org/tor-android-service.git git_submodule: 1
diff --git a/projects/tor-onion-proxy-library/0001-Bug-30318-Add-snowflake-support.patch b/projects/tor-onion-proxy-library/0001-Bug-30318-Add-snowflake-support.patch new file mode 100644 index 0000000..03e06aa --- /dev/null +++ b/projects/tor-onion-proxy-library/0001-Bug-30318-Add-snowflake-support.patch @@ -0,0 +1,90 @@ +From e006e215b274b1b834e098b199ea2697bc11b0f1 Mon Sep 17 00:00:00 2001 +From: Georg Koppen gk@torproject.org +Date: Sun, 10 May 2020 08:29:10 +0000 +Subject: [PATCH] Bug 30318: Add snowflake support + + +diff --git a/android/build.gradle b/android/build.gradle +index a8d9bdc..2392731 100644 +--- a/android/build.gradle ++++ b/android/build.gradle +@@ -93,6 +93,9 @@ task copyPluggableTransports(type: Copy) { + rename { filename -> + filename.replace 'obfs4proxy', 'libObfs4proxy.so' + } ++ rename { filename -> ++ filename.replace 'snowflake-client', 'libSnowflake.so' ++ } + } + + gradle.projectsEvaluated { +diff --git a/universal/src/main/java/com/msopentech/thali/toronionproxy/TorConfigBuilder.java b/universal/src/main/java/com/msopentech/thali/toronionproxy/TorConfigBuilder.java +index 2405097..bcb6a37 100644 +--- a/universal/src/main/java/com/msopentech/thali/toronionproxy/TorConfigBuilder.java ++++ b/universal/src/main/java/com/msopentech/thali/toronionproxy/TorConfigBuilder.java +@@ -109,22 +109,33 @@ public final class TorConfigBuilder { + return this; + } + +- public TorConfigBuilder configurePluggableTransportsFromSettings(File pluggableTransportClient) throws IOException { +- if (pluggableTransportClient == null) { ++ public TorConfigBuilder configurePluggableTransportsFromSettings(File pluggableTransportObfs, File pluggableTransportSnow) throws IOException { ++ if (pluggableTransportObfs == null || pluggableTransportSnow == null) { + return this; + } + +- if (!pluggableTransportClient.exists()) { +- throw new IOException("Bridge binary does not exist: " + pluggableTransportClient ++ if (!pluggableTransportObfs.exists()) { ++ throw new IOException("Obfs4proxy binary does not exist: " + pluggableTransportObfs + .getCanonicalPath()); + } + +- if (!pluggableTransportClient.canExecute()) { +- throw new IOException("Bridge binary is not executable: " + pluggableTransportClient ++ if (!pluggableTransportSnow.exists()) { ++ throw new IOException("Snowflake binary does not exist: " + pluggableTransportSnow + .getCanonicalPath()); + } + +- transportPlugin(pluggableTransportClient.getCanonicalPath()); ++ if (!pluggableTransportObfs.canExecute()) { ++ throw new IOException("Obfs4proxy binary is not executable: " + pluggableTransportObfs ++ .getCanonicalPath()); ++ } ++ ++ if (!pluggableTransportSnow.canExecute()) { ++ throw new IOException("Snowflake binary is not executable: " + pluggableTransportSnow ++ .getCanonicalPath()); ++ } ++ ++ ++ transportPlugin(pluggableTransportObfs.getCanonicalPath(), pluggableTransportSnow.getCanonicalPath()); + return this; + } + +@@ -491,8 +502,9 @@ public final class TorConfigBuilder { + return transPort(settings.transPort()); + } + +- public TorConfigBuilder transportPlugin(String clientPath) { +- buffer.append("ClientTransportPlugin meek_lite,obfs3,obfs4 exec ").append(clientPath).append('\n'); ++ public TorConfigBuilder transportPlugin(String obfsPath, String snowPath) { ++ buffer.append("ClientTransportPlugin meek_lite,obfs3,obfs4 exec ").append(obfsPath).append('\n'); ++ buffer.append("ClientTransportPlugin snowflake exec ").append(snowPath).append(" -url https://snowflake-broker.azureedge.net/ -front ajax.aspnetcdn.com -ice stun:stun.l.google.com:19302\n"); + return this; + } + +@@ -557,6 +569,9 @@ public final class TorConfigBuilder { + case 3: + reqBridgeType = "meek_lite"; + break; ++ case 4: ++ reqBridgeType = "snowflake"; ++ break; + default: + throw new IOException("Requested unknown transport type: " + bridgesType); + } +-- +2.26.2 + diff --git a/projects/tor-onion-proxy-library/build b/projects/tor-onion-proxy-library/build index dfe1837..937c72f 100644 --- a/projects/tor-onion-proxy-library/build +++ b/projects/tor-onion-proxy-library/build @@ -22,6 +22,7 @@ cd /var/tmp/build/[% project %]-[% c('version') %] patch -p1 < $rootdir/gradle.patch
patch -p1 < $rootdir/0001-Bug-33931-Filter-bridges-in-stream-by-type.patch +patch -p1 < $rootdir/0001-Bug-30318-Add-snowflake-support.patch
# Extract obfs4proxy from TorBrowser/Tor/PluggableTransports/obfs4proxy tar --strip-components=4 -xf $rootdir/[% c('input_files_by_name/obfs4') %] diff --git a/projects/tor-onion-proxy-library/config b/projects/tor-onion-proxy-library/config index cffcdd0..98bb93c 100644 --- a/projects/tor-onion-proxy-library/config +++ b/projects/tor-onion-proxy-library/config @@ -28,3 +28,4 @@ input_files: exec: '[% INCLUDE "fetch-gradle-dependencies" %]' - filename: gradle.patch - filename: 0001-Bug-33931-Filter-bridges-in-stream-by-type.patch + - filename: 0001-Bug-30318-Add-snowflake-support.patch