commit d567f0f9fc3cebd4f57ee928b6b2c185137403d5 Author: sisbell shane.isbell@gmail.com Date: Mon Feb 17 21:56:11 2020 -0800
Bug 33359: Use latest Version of TOPL and Remove Patches --- ...ustom-obfs4-bridge-does-not-work-on-Tor-B.patch | 146 --------------------- projects/tor-onion-proxy-library/build | 2 - .../tor-onion-proxy-library/canceldormant.patch | 46 ------- projects/tor-onion-proxy-library/config | 4 +- 4 files changed, 1 insertion(+), 197 deletions(-)
diff --git a/projects/tor-onion-proxy-library/0001-Bug-30767-Custom-obfs4-bridge-does-not-work-on-Tor-B.patch b/projects/tor-onion-proxy-library/0001-Bug-30767-Custom-obfs4-bridge-does-not-work-on-Tor-B.patch deleted file mode 100644 index 2d1bc51..0000000 --- a/projects/tor-onion-proxy-library/0001-Bug-30767-Custom-obfs4-bridge-does-not-work-on-Tor-B.patch +++ /dev/null @@ -1,146 +0,0 @@ -From 0a482a749fd770827d3d6c71debb112a07e7fae3 Mon Sep 17 00:00:00 2001 -From: sisbell shane.isbell@gmail.com -Date: Thu, 14 Nov 2019 13:43:09 -0800 -Subject: [PATCH] Bug 30767: Custom obfs4 bridge does not work on Tor Browser - for Android - -TOPL fixes #134 ---- - .../thali/toronionproxy/TorConfigBuilder.java | 63 ++++++++----------- - 1 file changed, 26 insertions(+), 37 deletions(-) - -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 e324d9f..da9a6a2 100644 ---- a/universal/src/main/java/com/msopentech/thali/toronionproxy/TorConfigBuilder.java -+++ b/universal/src/main/java/com/msopentech/thali/toronionproxy/TorConfigBuilder.java -@@ -99,25 +99,32 @@ public final class TorConfigBuilder { - return this; - } - -+ @SettingsConfig -+ public TorConfigBuilder bridgesFromSettings() { -+ try { -+ addBridgesFromResources(); -+ } catch (IOException e) { -+ e.printStackTrace(); -+ } -+ return this; -+ } -+ - public TorConfigBuilder configurePluggableTransportsFromSettings(File pluggableTransportClient) throws IOException { -- List<String> supportedBridges = settings.getListOfSupportedBridges(); -- if (pluggableTransportClient == null || !settings.hasBridges() || supportedBridges.size() < 1) { -+ if (pluggableTransportClient == null) { - return this; - } - -- if (!pluggableTransportClient.exists() || !pluggableTransportClient.canExecute()) { -+ if (!pluggableTransportClient.exists()) { - throw new IOException("Bridge binary does not exist: " + pluggableTransportClient - .getCanonicalPath()); - } - -- if (supportedBridges.contains("obfs3") || supportedBridges.contains("obfs4")) { -- transportPluginObfs(pluggableTransportClient.getCanonicalPath()); -- } -- if (supportedBridges.contains("meek")) { -- transportPluginMeek(pluggableTransportClient.getCanonicalPath()); -+ if (!pluggableTransportClient.canExecute()) { -+ throw new IOException("Bridge binary is not executable: " + pluggableTransportClient -+ .getCanonicalPath()); - } -- String type = supportedBridges.contains("meek") ? "meek_lite" : "obfs4"; -- addBridgesFromResources(type, 2); -+ -+ transportPlugin(pluggableTransportClient.getCanonicalPath()); - return this; - } - -@@ -471,14 +478,8 @@ public final class TorConfigBuilder { - return transPort(settings.transPort()); - } - -- public TorConfigBuilder transportPluginMeek(String clientPath) { -- buffer.append("ClientTransportPlugin meek_lite exec ").append(clientPath).append('\n'); -- return this; -- } -- -- public TorConfigBuilder transportPluginObfs(String clientPath) { -- buffer.append("ClientTransportPlugin obfs3 exec ").append(clientPath).append('\n'); -- buffer.append("ClientTransportPlugin obfs4 exec ").append(clientPath).append('\n'); -+ public TorConfigBuilder transportPlugin(String clientPath) { -+ buffer.append("ClientTransportPlugin meek_lite,obfs3,obfs4 exec ").append(clientPath).append('\n'); - return this; - } - -@@ -489,7 +490,7 @@ public final class TorConfigBuilder { - - @SettingsConfig - public TorConfigBuilder useBridgesFromSettings() { -- return !settings.hasBridges() ? dontUseBridges() : this; -+ return settings.hasBridges() ? useBridges() : this; - } - - public TorConfigBuilder virtualAddressNetwork(String address) { -@@ -518,12 +519,12 @@ public final class TorConfigBuilder { - * </code> - * - */ -- TorConfigBuilder addBridgesFromResources(String type, int maxBridges) throws IOException { -+ TorConfigBuilder addBridgesFromResources() throws IOException { - if(settings.hasBridges()) { - InputStream bridgesStream = context.getInstaller().openBridgesStream(); - int formatType = bridgesStream.read(); -- if(formatType == 0) { -- addBridges(bridgesStream, type, maxBridges); -+ if (formatType == 0) { -+ addBridges(bridgesStream); - } else { - addCustomBridges(bridgesStream); - } -@@ -534,23 +535,14 @@ public final class TorConfigBuilder { - /** - * Add bridges from bridges.txt file. - */ -- private void addBridges(InputStream input, String bridgeType, int maxBridges) { -- if (input == null || isNullOrEmpty(bridgeType) || maxBridges < 1) { -+ private void addBridges(InputStream input) { -+ if (input == null) { - return; - } -- boolean hasAddedBridge = false; - List<Bridge> bridges = readBridgesFromStream(input); -- Collections.shuffle(bridges, new Random(System.nanoTime())); -- int bridgeCount = 0; - for (Bridge b : bridges) { -- if (b.type.equals(bridgeType)) { -- bridge(b.type, b.config); -- hasAddedBridge = true; -- if (++bridgeCount > maxBridges) -- break; -- } -+ bridge(b.type, b.config); - } -- if(hasAddedBridge) useBridges(); - } - - /** -@@ -560,15 +552,12 @@ public final class TorConfigBuilder { - if (input == null) { - return; - } -- boolean hasAddedBridge = false; - List<Bridge> bridges = readCustomBridgesFromStream(input); - for (Bridge b : bridges) { - if (b.type.equals("custom")) { - bridgeCustom(b.config); -- hasAddedBridge = true; - } - } -- if(hasAddedBridge) useBridges(); - } - - private static List<Bridge> readBridgesFromStream(InputStream input) { --- -2.20.1 - diff --git a/projects/tor-onion-proxy-library/build b/projects/tor-onion-proxy-library/build index 9a8b31e..21c8f7a 100644 --- a/projects/tor-onion-proxy-library/build +++ b/projects/tor-onion-proxy-library/build @@ -20,8 +20,6 @@ cd /var/tmp/build/[% project %]-[% c('version') %] # Gradle patch provided so that when generating a gradle dependency list, the # build will pull down the correct android tool versions patch -p1 < $rootdir/gradle.patch -patch -p1 < $rootdir/canceldormant.patch -patch -p1 < $rootdir/0001-Bug-30767-Custom-obfs4-bridge-does-not-work-on-Tor-B.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/canceldormant.patch b/projects/tor-onion-proxy-library/canceldormant.patch deleted file mode 100644 index 8d48af1..0000000 --- a/projects/tor-onion-proxy-library/canceldormant.patch +++ /dev/null @@ -1,46 +0,0 @@ -diff --git a/universal/src/main/java/com/msopentech/thali/toronionproxy/DefaultSettings.java b/universal/src/main/java/com/msopentech/thali/toronionproxy/DefaultSettings.java -index 5f5adac..da6747f 100644 ---- a/universal/src/main/java/com/msopentech/thali/toronionproxy/DefaultSettings.java -+++ b/universal/src/main/java/com/msopentech/thali/toronionproxy/DefaultSettings.java -@@ -187,4 +187,9 @@ public class DefaultSettings implements TorSettings { - public boolean useSocks5() { - return false; - } -+ -+ @Override -+ public boolean hasDormantCanceledByStartup() { -+ return false; -+ } - } -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 e324d9f..99e5693 100644 ---- a/universal/src/main/java/com/msopentech/thali/toronionproxy/TorConfigBuilder.java -+++ b/universal/src/main/java/com/msopentech/thali/toronionproxy/TorConfigBuilder.java -@@ -503,6 +503,16 @@ public final class TorConfigBuilder { - return virtualAddressNetwork(settings.getVirtualAddressNetwork()); - } - -+ public TorConfigBuilder dormantCanceledByStartup() { -+ buffer.append("DormantCanceledByStartup 1").append('\n'); -+ return this; -+ } -+ -+ @SettingsConfig -+ public TorConfigBuilder domantCanceledByStartupFromSettings() { -+ return settings.hasDormantCanceledByStartup() ? dormantCanceledByStartup() : this; -+ } -+ - /** - * Adds bridges from a resource stream. This relies on the TorInstaller to know how to obtain this stream. - * These entries may be type-specified like: -diff --git a/universal/src/main/java/com/msopentech/thali/toronionproxy/TorSettings.java b/universal/src/main/java/com/msopentech/thali/toronionproxy/TorSettings.java -index 2d515d1..43f01ef 100644 ---- a/universal/src/main/java/com/msopentech/thali/toronionproxy/TorSettings.java -+++ b/universal/src/main/java/com/msopentech/thali/toronionproxy/TorSettings.java -@@ -77,4 +77,6 @@ public interface TorSettings { - String transPort(); - - boolean useSocks5(); -+ -+ boolean hasDormantCanceledByStartup(); - } diff --git a/projects/tor-onion-proxy-library/config b/projects/tor-onion-proxy-library/config index c682078..080f0c2 100644 --- a/projects/tor-onion-proxy-library/config +++ b/projects/tor-onion-proxy-library/config @@ -1,7 +1,7 @@ # vim: filetype=yaml sw=2 version: '[% c("abbrev") %]' filename: '[% project %]-[% c("version") %]-[% c("var/build_id") %]' -git_hash: a720e25bcdada2e6ba5c8cb1f566a6b633b79dc5 +git_hash: aeb63ebd079b646a3ec1b7b84d755653baa467d7 git_url: https://github.com/thaliproject/Tor_Onion_Proxy_Library.git git_submodule: 1
@@ -25,5 +25,3 @@ input_files: name: gradle-dependencies exec: '[% INCLUDE "fetch-gradle-dependencies" %]' - filename: gradle.patch - - filename: canceldormant.patch - - filename: 0001-Bug-30767-Custom-obfs4-bridge-does-not-work-on-Tor-B.patch