Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
From 3a6f835e8089dd15f5cd6487b5cfbdfafe7422f8 Mon Sep 17 00:00:00 2001
From: Shelikhoo <xiaokangwang@outlook.com>
Date: Tue, 14 Feb 2023 16:59:59 +0000
Subject: [PATCH] add WebTunnel Support
---
android/build.gradle | 3 +++
.../thali/toronionproxy/TorConfigBuilder.java | 19 +++++++++++++++----
2 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/android/build.gradle b/android/build.gradle
index e107e8e..acd92c1 100644
--- a/android/build.gradle
+++ b/android/build.gradle
@@ -102,6 +102,9 @@ task copyPluggableTransports(type: Copy) {
rename { filename ->
filename.replace 'conjure-client', 'libConjure.so'
}
+ rename { filename ->
+ filename.replace 'webtunnel-client', 'libWebtunnel.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 b87993d..5e6d6c5 100644
--- a/universal/src/main/java/com/msopentech/thali/toronionproxy/TorConfigBuilder.java
+++ b/universal/src/main/java/com/msopentech/thali/toronionproxy/TorConfigBuilder.java
@@ -109,8 +109,8 @@ public final class TorConfigBuilder {
return this;
}
- public TorConfigBuilder configurePluggableTransportsFromSettings(File pluggableTransportObfs, File pluggableTransportSnow, File pluggableTransportConjure) throws IOException {
- if (pluggableTransportObfs == null || pluggableTransportSnow == null || pluggableTransportConjure == null) {
+ public TorConfigBuilder configurePluggableTransportsFromSettings(File pluggableTransportObfs, File pluggableTransportSnow, File pluggableTransportConjure, File pluggableTransportWebtunnel) throws IOException {
+ if (pluggableTransportObfs == null || pluggableTransportSnow == null || pluggableTransportConjure == null || pluggableTransportWebtunnel == null) {
return this;
}
@@ -144,7 +144,17 @@ public final class TorConfigBuilder {
.getCanonicalPath());
}
- transportPlugin(pluggableTransportObfs.getCanonicalPath(), pluggableTransportSnow.getCanonicalPath(), pluggableTransportConjure.getCanonicalPath());
+ if (!pluggableTransportWebtunnel.exists()) {
+ throw new IOException("Webtunnel binary does not exist: " + pluggableTransportWebtunnel
+ .getCanonicalPath());
+ }
+
+ if (!pluggableTransportWebtunnel.canExecute()) {
+ throw new IOException("Webtunnel binary is not executable: " + pluggableTransportWebtunnel
+ .getCanonicalPath());
+ }
+
+ transportPlugin(pluggableTransportObfs.getCanonicalPath(), pluggableTransportSnow.getCanonicalPath(), pluggableTransportConjure.getCanonicalPath(), pluggableTransportWebtunnel.getCanonicalPath());
return this;
}
@@ -511,10 +521,11 @@ public final class TorConfigBuilder {
return transPort(settings.transPort());
}
- public TorConfigBuilder transportPlugin(String obfsPath, String snowPath, String conjurePath) {
+ public TorConfigBuilder transportPlugin(String obfsPath, String snowPath, String conjurePath, String webtunnelPath) {
buffer.append("ClientTransportPlugin meek_lite,obfs3,obfs4 exec ").append(obfsPath).append('\n');
buffer.append("ClientTransportPlugin snowflake exec ").append(snowPath).append('\n');
buffer.append("ClientTransportPlugin conjure exec ").append(conjurePath).append(" -registerURL https://registration.refraction.network/api\n");
+ buffer.append("ClientTransportPlugin webtunnel exec ").append(webtunnelPath).append('\n');
return this;
}
--
2.34.1