0001-Bug-30318-Add-snowflake-support.patch 3.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. From e006e215b274b1b834e098b199ea2697bc11b0f1 Mon Sep 17 00:00:00 2001
  2. From: Georg Koppen <gk@torproject.org>
  3. Date: Sun, 10 May 2020 08:29:10 +0000
  4. Subject: [PATCH] Bug 30318: Add snowflake support
  5. diff --git a/android/build.gradle b/android/build.gradle
  6. index a8d9bdc..2392731 100644
  7. --- a/android/build.gradle
  8. +++ b/android/build.gradle
  9. @@ -93,6 +93,9 @@ task copyPluggableTransports(type: Copy) {
  10. rename { filename ->
  11. filename.replace 'obfs4proxy', 'libObfs4proxy.so'
  12. }
  13. + rename { filename ->
  14. + filename.replace 'snowflake-client', 'libSnowflake.so'
  15. + }
  16. }
  17. gradle.projectsEvaluated {
  18. diff --git a/universal/src/main/java/com/msopentech/thali/toronionproxy/TorConfigBuilder.java b/universal/src/main/java/com/msopentech/thali/toronionproxy/TorConfigBuilder.java
  19. index 2405097..bcb6a37 100644
  20. --- a/universal/src/main/java/com/msopentech/thali/toronionproxy/TorConfigBuilder.java
  21. +++ b/universal/src/main/java/com/msopentech/thali/toronionproxy/TorConfigBuilder.java
  22. @@ -109,22 +109,33 @@ public final class TorConfigBuilder {
  23. return this;
  24. }
  25. - public TorConfigBuilder configurePluggableTransportsFromSettings(File pluggableTransportClient) throws IOException {
  26. - if (pluggableTransportClient == null) {
  27. + public TorConfigBuilder configurePluggableTransportsFromSettings(File pluggableTransportObfs, File pluggableTransportSnow) throws IOException {
  28. + if (pluggableTransportObfs == null || pluggableTransportSnow == null) {
  29. return this;
  30. }
  31. - if (!pluggableTransportClient.exists()) {
  32. - throw new IOException("Bridge binary does not exist: " + pluggableTransportClient
  33. + if (!pluggableTransportObfs.exists()) {
  34. + throw new IOException("Obfs4proxy binary does not exist: " + pluggableTransportObfs
  35. .getCanonicalPath());
  36. }
  37. - if (!pluggableTransportClient.canExecute()) {
  38. - throw new IOException("Bridge binary is not executable: " + pluggableTransportClient
  39. + if (!pluggableTransportSnow.exists()) {
  40. + throw new IOException("Snowflake binary does not exist: " + pluggableTransportSnow
  41. .getCanonicalPath());
  42. }
  43. - transportPlugin(pluggableTransportClient.getCanonicalPath());
  44. + if (!pluggableTransportObfs.canExecute()) {
  45. + throw new IOException("Obfs4proxy binary is not executable: " + pluggableTransportObfs
  46. + .getCanonicalPath());
  47. + }
  48. +
  49. + if (!pluggableTransportSnow.canExecute()) {
  50. + throw new IOException("Snowflake binary is not executable: " + pluggableTransportSnow
  51. + .getCanonicalPath());
  52. + }
  53. +
  54. +
  55. + transportPlugin(pluggableTransportObfs.getCanonicalPath(), pluggableTransportSnow.getCanonicalPath());
  56. return this;
  57. }
  58. @@ -491,8 +502,9 @@ public final class TorConfigBuilder {
  59. return transPort(settings.transPort());
  60. }
  61. - public TorConfigBuilder transportPlugin(String clientPath) {
  62. - buffer.append("ClientTransportPlugin meek_lite,obfs3,obfs4 exec ").append(clientPath).append('\n');
  63. + public TorConfigBuilder transportPlugin(String obfsPath, String snowPath) {
  64. + buffer.append("ClientTransportPlugin meek_lite,obfs3,obfs4 exec ").append(obfsPath).append('\n');
  65. + 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");
  66. return this;
  67. }
  68. @@ -557,6 +569,9 @@ public final class TorConfigBuilder {
  69. case 3:
  70. reqBridgeType = "meek_lite";
  71. break;
  72. + case 4:
  73. + reqBridgeType = "snowflake";
  74. + break;
  75. default:
  76. throw new IOException("Requested unknown transport type: " + bridgesType);
  77. }
  78. --
  79. 2.26.2