[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor-android-service/master] Bug 30318: Add snowflake support



commit ecc251d0a73f7e2034a271efd28036a0108b8688
Author: Georg Koppen <gk@xxxxxxxxxxxxxx>
Date:   Sat May 9 19:33:18 2020 +0000

    Bug 30318: Add snowflake support
---
 service/src/main/assets/common/bridges.txt             |  2 ++
 .../torproject/android/service/CustomTorInstaller.java | 18 ++++++++++++------
 .../org/torproject/android/service/TorService.java     |  8 +++++---
 3 files changed, 19 insertions(+), 9 deletions(-)

diff --git a/service/src/main/assets/common/bridges.txt b/service/src/main/assets/common/bridges.txt
index 9ab9098..a913c11 100644
--- a/service/src/main/assets/common/bridges.txt
+++ b/service/src/main/assets/common/bridges.txt
@@ -13,3 +13,5 @@ obfs4 146.57.248.225:22 10A6CD36A537FCE513A322361547444B393989F0 cert=K1gDtDAIcU
 obfs4 45.145.95.6:27015 C5B7CD6946FF10C5B3E89691A7D3F2C122D2117C cert=TD7PbUO0/0k6xYHMPW3vJxICfkMZNdkRrb63Zhl5j9dW3iRGiCx0A7mPhe5T2EDzQ35+Zw iat-mode=0
 obfs4 [2a0c:4d80:42:702::1]:27015 C5B7CD6946FF10C5B3E89691A7D3F2C122D2117C cert=TD7PbUO0/0k6xYHMPW3vJxICfkMZNdkRrb63Zhl5j9dW3iRGiCx0A7mPhe5T2EDzQ35+Zw iat-mode=0
 meek_lite 0.0.2.0:2 97700DFE9F483596DDA6264C4D7DF7641E1E39CE url=https://meek.azureedge.net/ front=ajax.aspnetcdn.com
+
+snowflake 0.0.3.0:1 2B280B23E1107BB62ABFC40DDCC8824814F80A72
diff --git a/service/src/main/java/org/torproject/android/service/CustomTorInstaller.java b/service/src/main/java/org/torproject/android/service/CustomTorInstaller.java
index 198c981..52bc4fe 100644
--- a/service/src/main/java/org/torproject/android/service/CustomTorInstaller.java
+++ b/service/src/main/java/org/torproject/android/service/CustomTorInstaller.java
@@ -40,14 +40,17 @@ public class CustomTorInstaller extends TorInstaller {
     @Override
     public InputStream openBridgesStream() throws IOException {
         /*
-            BridgesList is an overloaded field, which can cause some confusion. The list can be:
-            1) a filter like obfs4 or meek OR 2) it can be a custom bridge
-            For (1), we just pass back all bridges, the filter will occur elsewhere in the library.
-            For (2) we return the bridge list as a raw stream
-            If length is greater than 5, then we know this is a custom bridge
+            BridgesList is an overloaded field, which can cause some confusion.
+            The list can be:
+              1) a filter like obfs4, meek, or snowflake OR
+              2) it can be a custom bridge
+            For (1), we just pass back all bridges, the filter will occur
+              elsewhere in the library.
+            For (2) we return the bridge list as a raw stream.
+            If length is greater than 9, then we know this is a custom bridge
          */
         String userDefinedBridgeList = Prefs.getBridgesList();
-        byte bridgeType = (byte) (userDefinedBridgeList.length() > 5 ? 1 : 0);
+        byte bridgeType = (byte) (userDefinedBridgeList.length() > 9 ? 1 : 0);
         // Terrible hack. Must keep in sync with topl::addBridgesFromResources.
         if (bridgeType == 0) {
             switch (userDefinedBridgeList) {
@@ -57,6 +60,9 @@ public class CustomTorInstaller extends TorInstaller {
                 case "meek":
                     bridgeType = 3;
                     break;
+                case "snowflake":
+                    bridgeType = 4;
+                    break;
             }
         }
 
diff --git a/service/src/main/java/org/torproject/android/service/TorService.java b/service/src/main/java/org/torproject/android/service/TorService.java
index 16d2537..971c2e9 100644
--- a/service/src/main/java/org/torproject/android/service/TorService.java
+++ b/service/src/main/java/org/torproject/android/service/TorService.java
@@ -368,10 +368,12 @@ public final class TorService extends Service implements TorServiceConstants, Or
 
             //Check bridges to see if we need this
             File nativeDir = new File(getApplicationInfo().nativeLibraryDir);
-            File pluggableTransport = new File(nativeDir, "libObfs4proxy.so");
-            if(!pluggableTransport.canExecute()) pluggableTransport.setExecutable(true);
+            File pluggableTransportObfs = new File(nativeDir, "libObfs4proxy.so");
+            if(!pluggableTransportObfs.canExecute()) pluggableTransportObfs.setExecutable(true);
+            File pluggableTransportSnow = new File(nativeDir, "libSnowflake.so");
+            if(!pluggableTransportSnow.canExecute()) pluggableTransportSnow.setExecutable(true);
 
-            builder.configurePluggableTransportsFromSettings(pluggableTransport);
+            builder.configurePluggableTransportsFromSettings(pluggableTransportObfs, pluggableTransportSnow);
             mDataService.updateConfigBuilder(builder);
             onionProxyManager.getTorInstaller().updateTorConfigCustom
                     (builder.asString());

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits