Skip to content

Commit d63c6f3

Browse files
committed
chore: remove libn2t [broken]
1 parent b1ad7ec commit d63c6f3

File tree

5 files changed

+5
-95
lines changed

5 files changed

+5
-95
lines changed

.gitmodules

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,3 @@
44
[submodule "app/src/main/cpp/libs"]
55
path = app/src/main/cpp/libs
66
url = https://github.com/trojan-gfw/igniter-libs.git
7-
[submodule "app/src/main/cpp/libn2t"]
8-
path = app/src/main/cpp/libn2t
9-
url = https://github.com/trojan-gfw/libn2t.git

app/src/main/cpp/CMakeLists.txt

Lines changed: 1 addition & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -34,62 +34,10 @@ target_link_libraries(trojan
3434
${CMAKE_SOURCE_DIR}/libs/lib/${ANDROID_ABI}/libssl.a
3535
${CMAKE_SOURCE_DIR}/libs/lib/${ANDROID_ABI}/libcrypto.a
3636
${androidLogLib})
37-
add_library(n2t
38-
libn2t/src/n2t/n2s.cpp
39-
libn2t/src/n2t/n2t.cpp
40-
libn2t/src/n2t/socket.cpp
41-
libn2t/src/n2t/tcpsession.cpp
42-
libn2t/src/n2t/udpsession.cpp
43-
libn2t/src/n2t/utils.cpp
44-
libn2t/src/custom/sys_arch.c
45-
libn2t/src/lwip/src/core/init.c
46-
libn2t/src/lwip/src/core/def.c
47-
libn2t/src/lwip/src/core/dns.c
48-
libn2t/src/lwip/src/core/inet_chksum.c
49-
libn2t/src/lwip/src/core/ip.c
50-
libn2t/src/lwip/src/core/mem.c
51-
libn2t/src/lwip/src/core/memp.c
52-
libn2t/src/lwip/src/core/netif.c
53-
libn2t/src/lwip/src/core/pbuf.c
54-
libn2t/src/lwip/src/core/raw.c
55-
libn2t/src/lwip/src/core/stats.c
56-
libn2t/src/lwip/src/core/sys.c
57-
libn2t/src/lwip/src/core/altcp.c
58-
libn2t/src/lwip/src/core/altcp_alloc.c
59-
libn2t/src/lwip/src/core/altcp_tcp.c
60-
libn2t/src/lwip/src/core/tcp.c
61-
libn2t/src/lwip/src/core/tcp_in.c
62-
libn2t/src/lwip/src/core/tcp_out.c
63-
libn2t/src/lwip/src/core/timeouts.c
64-
libn2t/src/lwip/src/core/udp.c
65-
libn2t/src/lwip/src/core/ipv4/autoip.c
66-
libn2t/src/lwip/src/core/ipv4/dhcp.c
67-
libn2t/src/lwip/src/core/ipv4/etharp.c
68-
libn2t/src/lwip/src/core/ipv4/icmp.c
69-
libn2t/src/lwip/src/core/ipv4/igmp.c
70-
libn2t/src/lwip/src/core/ipv4/ip4_frag.c
71-
libn2t/src/lwip/src/core/ipv4/ip4.c
72-
libn2t/src/lwip/src/core/ipv4/ip4_addr.c
73-
libn2t/src/lwip/src/core/ipv6/dhcp6.c
74-
libn2t/src/lwip/src/core/ipv6/ethip6.c
75-
libn2t/src/lwip/src/core/ipv6/icmp6.c
76-
libn2t/src/lwip/src/core/ipv6/inet6.c
77-
libn2t/src/lwip/src/core/ipv6/ip6.c
78-
libn2t/src/lwip/src/core/ipv6/ip6_addr.c
79-
libn2t/src/lwip/src/core/ipv6/ip6_frag.c
80-
libn2t/src/lwip/src/core/ipv6/mld6.c
81-
libn2t/src/lwip/src/core/ipv6/nd6.c)
82-
target_include_directories(n2t PRIVATE
83-
${CMAKE_SOURCE_DIR}/libn2t/src/custom
84-
${CMAKE_SOURCE_DIR}/libn2t/src/lwip/src/include
85-
${CMAKE_SOURCE_DIR}/libs/include)
86-
target_link_libraries(n2t
87-
${CMAKE_SOURCE_DIR}/libs/lib/${ANDROID_ABI}/libboost_system.a
88-
${androidLogLib})
8937
add_library(jni-helper SHARED jni-helper.cpp)
9038
target_include_directories(jni-helper PRIVATE
9139
${CMAKE_SOURCE_DIR}/trojan/src
9240
${CMAKE_SOURCE_DIR}/libn2t/src
9341
${CMAKE_SOURCE_DIR}/libs/include
9442
${CMAKE_SOURCE_DIR}/libs/include/${ANDROID_ABI})
95-
target_link_libraries(jni-helper trojan n2t)
43+
target_link_libraries(jni-helper trojan)

app/src/main/cpp/jni-helper.cpp

Lines changed: 4 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,13 @@
44
#include <thread>
55
#include <core/config.h>
66
#include <core/service.h>
7-
#include <n2t/n2t.h>
8-
#include <n2t/n2s.h>
97
using namespace std;
10-
using namespace Net2Tr;
8+
119

1210
static thread *trojanThread = nullptr;
13-
static thread *n2sThread = nullptr;
1411
static Config *trojanConfig = nullptr;
1512
static Service *trojanService = nullptr;
16-
static N2T *n2tService = nullptr;
17-
static N2S *n2sService = nullptr;
13+
1814

1915
static void startTrojan(const string &config)
2016
{
@@ -24,12 +20,7 @@ static void startTrojan(const string &config)
2420
trojanService->run();
2521
}
2622

27-
static void startN2S(int tun_fd, const string &ip_addr, const string &netmask, const string &ip6_addr, uint16_t mtu, const string &socks5_addr, uint16_t socks5_port)
28-
{
29-
n2tService = new N2T(ip_addr, netmask, ip6_addr, mtu);
30-
n2sService = new N2S(tun_fd, *n2tService, socks5_addr, socks5_port);
31-
n2sService->start();
32-
}
23+
3324

3425
extern "C" {
3526
JNIEXPORT void JNICALL Java_io_github_trojan_1gfw_igniter_JNIHelper_trojan(JNIEnv *env, jclass, jstring config) {
@@ -41,33 +32,9 @@ extern "C" {
4132
trojanThread = new thread(startTrojan, a);
4233
}
4334

44-
JNIEXPORT void JNICALL Java_io_github_trojan_1gfw_igniter_JNIHelper_n2s(JNIEnv *env, jclass, jint tun_fd, jstring ip_addr, jstring netmask, jstring ip6_addr, jint mtu, jstring socks5_addr, jint socks5_port) {
45-
if (n2sThread != nullptr)
46-
return;
47-
const char *s1 = env->GetStringUTFChars(ip_addr, 0);
48-
const char *s2 = env->GetStringUTFChars(netmask, 0);
49-
const char *s3 = env->GetStringUTFChars(ip6_addr, 0);
50-
const char *s4 = env->GetStringUTFChars(socks5_addr, 0);
51-
string a(s1);
52-
string b(s2);
53-
string c(s3);
54-
string d(s4);
55-
env->ReleaseStringUTFChars(socks5_addr, s4);
56-
env->ReleaseStringUTFChars(ip6_addr, s3);
57-
env->ReleaseStringUTFChars(netmask, s2);
58-
env->ReleaseStringUTFChars(ip_addr, s1);
59-
n2sThread = new thread(startN2S, tun_fd, a, b, c, uint16_t(mtu), d, uint16_t(socks5_port));
60-
}
6135

6236
JNIEXPORT void JNICALL Java_io_github_trojan_1gfw_igniter_JNIHelper_stop(JNIEnv *env, jclass) {
63-
if (n2sThread != nullptr) {
64-
n2sService->stop();
65-
n2sThread->join();
66-
delete n2sService;
67-
delete n2tService;
68-
delete n2sThread;
69-
n2sThread = nullptr;
70-
}
37+
7138
if (trojanThread != nullptr) {
7239
trojanService->stop();
7340
trojanThread->join();

app/src/main/cpp/libn2t

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

app/src/main/java/io/github/trojan_gfw/igniter/JNIHelper.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,5 @@ public class JNIHelper {
55
System.loadLibrary("jni-helper");
66
}
77
public static native void trojan(String config);
8-
public static native void n2s(int tun_fd, String ip_addr, String netmask, String ip6_addr, int mtu, String socks5_addr, int socks5_port);
98
public static native void stop();
109
}

0 commit comments

Comments
 (0)