0001-Bug-41361-Add-conjure-support.patch 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. From edf4337158df11da3b6ef6d30050e2441cfeafeb Mon Sep 17 00:00:00 2001
  2. From: Cecylia Bocovich <cohosh@torproject.org>
  3. Date: Thu, 13 Oct 2022 10:20:59 -0400
  4. Subject: [PATCH] Bug 41361: Add conjure support
  5. ---
  6. android/build.gradle | 3 +++
  7. .../thali/toronionproxy/TorConfigBuilder.java | 18 ++++++++++++++----
  8. 2 files changed, 17 insertions(+), 4 deletions(-)
  9. diff --git a/android/build.gradle b/android/build.gradle
  10. index 2392731..b1aca0a 100644
  11. --- a/android/build.gradle
  12. +++ b/android/build.gradle
  13. @@ -96,6 +96,9 @@ task copyPluggableTransports(type: Copy) {
  14. rename { filename ->
  15. filename.replace 'snowflake-client', 'libSnowflake.so'
  16. }
  17. + rename { filename ->
  18. + filename.replace 'conjure-client', 'libConjure.so'
  19. + }
  20. }
  21. gradle.projectsEvaluated {
  22. diff --git a/universal/src/main/java/com/msopentech/thali/toronionproxy/TorConfigBuilder.java b/universal/src/main/java/com/msopentech/thali/toronionproxy/TorConfigBuilder.java
  23. index cc10783..c7e20c0 100644
  24. --- a/universal/src/main/java/com/msopentech/thali/toronionproxy/TorConfigBuilder.java
  25. +++ b/universal/src/main/java/com/msopentech/thali/toronionproxy/TorConfigBuilder.java
  26. @@ -109,8 +109,8 @@ public final class TorConfigBuilder {
  27. return this;
  28. }
  29. - public TorConfigBuilder configurePluggableTransportsFromSettings(File pluggableTransportObfs, File pluggableTransportSnow) throws IOException {
  30. - if (pluggableTransportObfs == null || pluggableTransportSnow == null) {
  31. + public TorConfigBuilder configurePluggableTransportsFromSettings(File pluggableTransportObfs, File pluggableTransportSnow, File pluggableTransportConjure) throws IOException {
  32. + if (pluggableTransportObfs == null || pluggableTransportSnow == null || pluggableTransportConjure == null) {
  33. return this;
  34. }
  35. @@ -124,6 +124,11 @@ public final class TorConfigBuilder {
  36. .getCanonicalPath());
  37. }
  38. + if (!pluggableTransportConjure.exists()) {
  39. + throw new IOException("Conjure binary does not exist: " + pluggableTransportConjure
  40. + .getCanonicalPath());
  41. + }
  42. +
  43. if (!pluggableTransportObfs.canExecute()) {
  44. throw new IOException("Obfs4proxy binary is not executable: " + pluggableTransportObfs
  45. .getCanonicalPath());
  46. @@ -134,8 +139,12 @@ public final class TorConfigBuilder {
  47. .getCanonicalPath());
  48. }
  49. + if (!pluggableTransportConjure.canExecute()) {
  50. + throw new IOException("Conjure binary is not executable: " + pluggableTransportConjure
  51. + .getCanonicalPath());
  52. + }
  53. - transportPlugin(pluggableTransportObfs.getCanonicalPath(), pluggableTransportSnow.getCanonicalPath());
  54. + transportPlugin(pluggableTransportObfs.getCanonicalPath(), pluggableTransportSnow.getCanonicalPath(), pluggableTransportConjure.getCanonicalPath());
  55. return this;
  56. }
  57. @@ -502,9 +511,10 @@ public final class TorConfigBuilder {
  58. return transPort(settings.transPort());
  59. }
  60. - public TorConfigBuilder transportPlugin(String obfsPath, String snowPath) {
  61. + public TorConfigBuilder transportPlugin(String obfsPath, String snowPath, String conjurePath) {
  62. buffer.append("ClientTransportPlugin meek_lite,obfs3,obfs4 exec ").append(obfsPath).append('\n');
  63. buffer.append("ClientTransportPlugin snowflake exec ").append(snowPath).append(" -url https://snowflake-broker.torproject.net.global.prod.fastly.net/ -front cdn.sstatic.net -ice stun:stun.l.google.com:19302,stun:stun.voip.blackberry.com:3478,stun:stun.altar.com.pl:3478,stun:stun.antisip.com:3478,stun:stun.bluesip.net:3478,stun:stun.dus.net:3478,stun:stun.epygi.com:3478,stun:stun.sonetel.com:3478,stun:stun.sonetel.net:3478,stun:stun.stunprotocol.org:3478,stun:stun.uls.co.za:3478,stun:stun.voipgate.com:3478,stun:stun.voys.nl:3478\n");
  64. + buffer.append("ClientTransportPlugin conjure exec ").append(conjurePath).append(" -registerURL https://registration.refraction.network/api\n");
  65. return this;
  66. }
  67. --
  68. 2.37.2