Skip to content

Commit 3348531

Browse files
authored
Merge pull request #1352 from guardianproject/hevsocks
Replace go-tun2socks with hev-socks5-tunnel C library
2 parents 5af1733 + 9891061 commit 3348531

20 files changed

+111
-230
lines changed

.gitignore

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,6 @@ obj/
3131

3232
# Orbot libs
3333
libs/jtorctl.jar
34-
app/src/main/jniLibs/
35-
app/src/main/libs/
36-
orbotservice/src/main/libs/
37-
OrbotLib/OrbotIPtProxy
3834

3935
# Fastlane
4036
/fastlane/report.xml

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "app/src/main/jni/hev-socks5-tunnel"]
2+
path = app/src/main/jni/hev-socks5-tunnel
3+
url = https://github.com/heiher/hev-socks5-tunnel.git

OrbotLib/.gitignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

OrbotLib/OrbotLib-sources.jar

-11.7 KB
Binary file not shown.

OrbotLib/OrbotLib.aar

-27.7 MB
Binary file not shown.

OrbotLib/build-orbotlib.sh

Lines changed: 0 additions & 11 deletions
This file was deleted.

OrbotLib/build.gradle.kts

Lines changed: 0 additions & 2 deletions
This file was deleted.

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,24 @@ learn to configure it properly. Learn more: <https://torproject.org/>
4444
</div>
4545

4646
***********************************************
47+
48+
49+
### Build Instructions
50+
51+
Orbot is built with [hev-socks5-tunnel](https://github.com/heiher/hev-socks5-tunnel). Before you can build Orbot, you'll need to clone the submodule
52+
for this dependency. Once cloned, Android Studio + Gradle will take care of building the C code.
53+
54+
```sh
55+
git clone --recursive https://github.com/guardianproject/orbot-android
56+
```
57+
58+
Or, if you already cloned the repo:
59+
60+
```sh
61+
cd orbot-android
62+
git pull
63+
git submodule update --init --recursive
64+
```
65+
66+
4767
**Copyright &#169; 2009-2025, Nathan Freitas, The Guardian Project**

app/build.gradle.kts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,13 @@ android {
8383
}
8484
}
8585

86+
ndkVersion = "28.2.13676358"
87+
externalNativeBuild {
88+
ndkBuild {
89+
path = file("src/main/jni/Android.mk")
90+
}
91+
}
92+
8693
productFlavors {
8794
create("fullperm") {
8895
dimension = "free"
@@ -129,7 +136,6 @@ android.applicationVariants.all {
129136
}
130137

131138
dependencies {
132-
implementation(project(":OrbotLib"))
133139
implementation(libs.android.material)
134140
implementation(libs.android.volley)
135141
implementation(libs.androidx.activity)
@@ -150,8 +156,7 @@ dependencies {
150156
implementation(libs.appiconnamechanger)
151157
implementation(libs.androidx.work.kotlin)
152158
implementation(libs.upnp)
153-
implementation(libs.pcap.core)
154-
implementation(libs.pcap.factory)
159+
implementation(libs.iptproxy)
155160
implementation(files("../libs/geoip.jar"))
156161
api(libs.guardian.jtorctl)
157162
api(libs.tor.android)
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package org.torproject.android.service;
2+
3+
public class TProxyService {
4+
public static native void TProxyStartService(String config_path, int fd);
5+
public static native void TProxyStopService();
6+
public static native long[] TProxyGetStats();
7+
8+
static {
9+
System.loadLibrary("hev-socks5-tunnel");
10+
}
11+
12+
public static final String VIRTUAL_GATEWAY_IPV4 = "198.18.0.1";
13+
public static final String VIRTUAL_GATEWAY_IPV6 = "fc00::1";
14+
public final static String FAKE_DNS = "198.18.0.2";
15+
16+
public static final int TASK_SIZE = 81920;
17+
public static final int TUNNEL_MTU = 8500;
18+
}

0 commit comments

Comments
 (0)