heiher / hev-socks5-tunnel Goto Github PK
View Code? Open in Web Editor NEWA high-performance tun2socks for Linux/Android/FreeBSD/macOS/iOS/WSL2 (IPv4/IPv6/TCP/UDP)
License: MIT License
A high-performance tun2socks for Linux/Android/FreeBSD/macOS/iOS/WSL2 (IPv4/IPv6/TCP/UDP)
License: MIT License
Cloudflare warp proxy mode listening on socks://127.0.0.1:40000, warp tunnel is connected via vps's ipv6.
Purpose: convert socks proxy to tun0, make vps access ipv4 network through socks proxy.
Fact: ipv4 network is unaccessable.
curl -4 http://cloudflare.com/cdn-cgi/trace
curl: (56) Recv failure: Connection reset by peer
$ traceroute 8.8.8.8
traceroute to 8.8.8.8 (8.8.8.8), 64 hops max
1 * * *
2 * * *
^C
$ ping 10.18.0.1
PING 10.18.0.1 (10.18.0.1) 56(84) bytes of data.
64 bytes from 10.18.0.1: icmp_seq=1 ttl=64 time=0.043 ms
64 bytes from 10.18.0.1: icmp_seq=2 ttl=64 time=0.052 ms
64 bytes from 10.18.0.1: icmp_seq=3 ttl=64 time=0.064 ms
Confirm socks proxy is working
$ curl -x socks://127.0.0.1:40000 myip.ipip.net
当前 IP:104.28.*.* 来自于:CLOUDFLARE.COM CLOUDFLARE.COM cloudflare.com
Error message
$ sudo hev-socks5-tunnel config.yml
[2023-04-21 08:01:58] [E] 0xf7d5a0c8 socks5 client read response
[2023-04-21 08:01:58] [E] 0xf7d5a0c8 socks5 session handshake
[2023-04-21 08:01:59] [E] 0xf7d5a158 socks5 client read response
[2023-04-21 08:01:59] [E] 0xf7d5a158 socks5 session handshake
[2023-04-21 08:02:08] [E] 0xf7d26158 socks5 client read response
[2023-04-21 08:02:08] [E] 0xf7d26158 socks5 session handshake
[2023-04-21 08:02:18] [E] 0xf7cba4a8 socks5 client read response
[2023-04-21 08:02:18] [E] 0xf7cba4a8 socks5 session handshake
[2023-04-21 08:02:21] [E] 0xf7bda148 socks5 client read response
[2023-04-21 08:02:21] [E] 0xf7bda148 socks5 session handshake
[2023-04-21 08:02:24] [E] 0xf7cbad18 socks5 client read response
[2023-04-21 08:02:24] [E] 0xf7cbad18 socks5 session handshake
[2023-04-21 08:02:26] [E] 0xf7c56e38 socks5 client read response
[2023-04-21 08:02:26] [E] 0xf7c56e38 socks5 session handshake
[2023-04-21 08:02:28] [E] 0xf7bda658 socks5 client read response
[2023-04-21 08:02:28] [E] 0xf7bda658 socks5 session handshake
[2023-04-21 08:02:38] [E] 0xf7bc7888 socks5 client read response
[2023-04-21 08:02:38] [E] 0xf7bc7888 socks5 session handshake
Configuration file
tunnel:
# Interface name
name: tun0
# Interface MTU
mtu: 8500
# Multi-queue
multi-queue: false
# IPv4 address
ipv4: 10.18.0.1
# IPv6 address
#ipv6: 'fc00::1'
socks5:
# Socks5 server port
port: 40000
# Socks5 server address (ipv4/ipv6)
address: 127.0.0.1
# Socks5 UDP relay mode (tcp|udp)
udp: 'tcp'
# Socks5 server username
# username: 'username'
# Socks5 server password
# password: 'password'
Route table
$ ip route
default dev tun0 scope link metric 20
default via 10.64.12.48 dev ens2 proto dhcp src 10.64.12.49 metric 100
10.64.12.48 dev ens2 proto dhcp scope link src 10.64.12.49 metric 100
10.64.12.48/31 dev ens2 proto kernel scope link src 10.64.12.49
$ ip -6 route
::1 dev lo proto kernel metric 256 pref medium
2001::/64 dev ens2 proto kernel metric 256 pref medium
fd7a:115c:a1e0:ab12:4843:cd96:625e:e62b dev tailscale0 proto kernel metric 256 pref medium
fe80::/64 dev ens2 proto kernel metric 256 pref medium
fe80::/64 dev tailscale0 proto kernel metric 256 pref medium
fe80::/64 dev tun0 proto kernel metric 256 pref medium
default via 2001:: dev ens2 proto static metric 1024 pref medium
debian os got issues like this:
127.0.0.1:59752 => No route to host (os error 113)
and I setup routes with the following commands:
sudo ip route add SOCKS5_SERVER dev DEFAULT_IFACE metric 10
sudo ip -6 route add SOCKS5_SERVER dev DEFAULT_IFACE metric 10
sudo ip route add default dev tun0 metric 20
sudo ip -6 route add default dev tun0 metric 20
i want to use your project for public socks ip
so i just copy and paste command it seems i have some problem
my public ip address is 5.78.92.184:1080
my config:
tunnel:
# Interface name
name: tun0
# Interface MTU
mtu: 8500
# Multi-queue
multi-queue: false
# IPv4 address
ipv4: 198.18.0.1
# IPv6 address
ipv6: 'fc00::1'
socks5:
port: 1080
address: 5.78.92.184
udp: 'tcp'
and last
sudo ip route add 5.78.92.184 dev eth0 metric 10
sudo ip route add default dev tun0 metric 20
but have problem and i cant do ping or curl or ...
what should i do?
苹果对广播包收发存在限制,需要额外申请权限。之前运行在iOS上时会出现Can't assign requested address错误。可能是因为苹果限制导致?所以来求证一下。
运行 bin/hev-socks5-tunnel conf/main.yml
报错 [E] socks5 tunnel open
macOS 13.0.1 (22A400)
配置文件:
tunnel:
# Interface name
name: tun0
# Interface MTU
mtu: 8500
# Multi-queue
multi-queue: false
# IPv4 address
ipv4: 198.18.0.1
# IPv6 address
ipv6: 'fc00::1'
socks5:
# Socks5 server port
port: 1080
# Socks5 server address (ipv4/ipv6)
address: 127.0.0.1
# Socks5 UDP relay mode (tcp|udp)
udp: 'tcp'
Hi, i've linked this library to my project, just adding this to gradle:
externalNativeBuild { ndkBuild { path file('../../../hev-socks5-tunnel-master/jni/Android.mk') } }
Now when building it it throws the below error, could you please help me out with it ?
In file included from C:\Users\User\Downloads\hev-socks5-tunnel-master\jni\src\hev-socks5-session.c:14: C:\Users\User\Downloads\hev-socks5-tunnel-master\jni\third-part\hev-task-system\include\hev-task.h:1:1: error: expected identifier or '('
Any Help would be kindly appreciated,
Thanks
because when I using hev-sock5 in developer id it print this error and macos packet tunnel not starting
NESMVPNSession[Primary Tunnel:zVPN Xray :(null)]: failed to set the MTU to 9000
fatal error: lwip/init.h: No such file or directory
15 | #include "lwip/init.h"
| ^~~~~~~~~~~~~
compilation terminated.
make: *** [Makefile:103: build/hev-main.o] Error 1
I'am using Arch linux and i can't build it
please help!
in the readme section Run
said set DEFAULT_IFACE
what is it and how to set it ?
my linux -> ip route
command:
default via 192.168.1.1 dev wlp0s20f3 proto dhcp metric 600
169.254.0.0/16 dev wlp0s20f3 scope link metric 1000
192.168.1.0/24 dev wlp0s20f3 proto kernel scope link src 192.168.1.6 metric 600
my tunnel Config:
tunnel:
name: tun0
mtu: 9000
multi-queue: false
ipv4: 198.18.0.1
socks5:
port: 10801
address: 127.0.0.1
udp: 'udp'
misc:
task-stack-size: 20480
connect-timeout: 5000
read-write-timeout: 60000
log-file: stderr
log-level: debug
limit-nofile: 65535
I starting xray core after tunnel on server 127.0.0.1 and port 10801
but it show me a loop of message:
[2023-06-27 13:32:18] [D] 0x55d40bb18b90 socks5 session tcp destruct
[2023-06-27 13:32:18] [D] 0x55d40bb18b90 socks5 client tcp destruct
[2023-06-27 13:32:18] [D] 0x55d40bb18b90 socks5 client destruct
[2023-06-27 13:32:18] [D] 0x55d40bb18b90 socks5 destruct
[2023-06-27 13:32:18] [I] 0x55d40bb193d0 io timeout
[2023-06-27 13:32:18] [D] 0x55d40bb193d0 socks5 session tcp destruct
[2023-06-27 13:32:18] [D] 0x55d40bb193d0 socks5 client tcp destruct
[2023-06-27 13:32:18] [D] 0x55d40bb193d0 socks5 client destruct
[2023-06-27 13:32:18] [D] 0x55d40bb193d0 socks5 destruct
hello dear i can't compile in cenots 6 32bit . giving me error src/echo_server.c:7:18: fatal error: lwip.h: No such file or directory
#include "lwip.h"
Hello, I would like to ask whether this library can be compiled for mobile client use @daemooon
Currently, I've modified ToyVPN source ( Provided by Android team ) to make it works as
Step 1. Capturing all packets from Tun interface by VPNService ( Interface IP 10.0.0.1 )
Step 2. Encrypt received packets ( without any modification ) then pass them to VPN server through HTTPS protocol
Step 3. On server side decrypt received packet then send it to a tunnel device with exact IP of 10.0.0.1
This rule also is required on server side. iptables -t nat -A POSTROUTING -s 10.0.0.0/8 -o eth0 -j MASQUERADE
As this behavior I've made a client and server working. Of course it is very slow.
Lets back to main questions.
could we use vpn mode with this project ?
i wanna use it on ios application but with VPN mode ( full tunnel )
环境:
hyperv虚拟机, centos7 内核3.10
配置:
tunnel:
# Interface name
name: tun0
# Interface MTU
mtu: 4096
# IPv4 address
ipv4:
address: 198.18.0.2
gateway: 198.18.0.1
prefix: 15
# IPv6 address
ipv6:
address: 'fc00::2'
gateway: 'fc00::1'
prefix: 126
socks5:
# Socks5 server port
port: 7890
# Socks5 server address (ipv4/ipv6)
address: 127.0.0.1
# Socks5 server username
# username: 'username'
# Socks5 server password
# password: 'password'
#misc:
# task stack size (bytes)
# task-stack-size: 20480
# connect timeout (ms)
# connect-timeout: 5000
# read-write timeout (ms)
# read-write-timeout: 60000
# stdout, stderr or file-path
# log-file: stderr
# debug, info, warn or error
# log-level: warn
# If present, run as a daemon with this pid file
# pid-file: /run/hev-socks5-tunnel.pid
# If present, set rlimit nofile; else use default value
# limit-nofile: 1024
执行
❯ sudo ./hev-socks5-tunnel ./conf.yml
[2023-02-01 00:50:27] [E] 0x7f9d7e915240 socks5 client read response
[2023-02-01 00:50:27] [E] 0x7f9d7e915240 socks5 session handshake
[2023-02-01 00:50:28] [E] 0x7f9d7e915240 socks5 client read response
[2023-02-01 00:50:28] [E] 0x7f9d7e915240 socks5 session handshake
[2023-02-01 00:50:30] [E] 0x7f9d7e915240 socks5 client read response
[2023-02-01 00:50:30] [E] 0x7f9d7e915240 socks5 session handshake
[2023-02-01 00:50:31] [E] 0x7f9d7e915240 socks5 client read response
[2023-02-01 00:50:31] [E] 0x7f9d7e915240 socks5 session handshake
^C[2023-02-01 00:50:32] [E] socks5 tunnel read
在另外的窗口执行
idx in 🌐 k3s in ~
❯ sudo ip route add default dev tun0 metric 1
idx in 🌐 k3s in ~
❯ curl google.com
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>301 Moved</TITLE></HEAD><BODY>
<H1>301 Moved</H1>
The document has moved
<A HREF="http://www.google.com/">[here](http://www.google.com/)</A>.
</BODY></HTML>
综上, 简单的执行了一下, 确定是通的, 能访问
[2023-02-01 00:50:27] [E] 0x7f9d7e915240 socks5 client read response
[2023-02-01 00:50:27] [E] 0x7f9d7e915240 socks5 session handshake
Hello friend. Does exist the way to calculate traffic speed?
Hello, dear creators for fast and powerful lib. I have faced another issue with the android 13. Here's stack trace. This happen almost all time when disconnect.
`ndk-stack -sym obj/local/x86_64 -dump crashstack.txt
********** Crash dump: **********
Build fingerprint: 'google/sdk_gphone64_x86_64/emu64x:13/TE1A.220922.012/9302419:userdebug/dev-keys'
Abort message: 'Scudo ERROR: corrupted chunk header at address 0x71257225bb00'
#00 0x000000000005f6ff /apex/com.android.runtime/lib64/bionic/libc.so (abort+191) (BuildId: 007cb2313464df63debf8020e631c990)
#1 0x0000000000048dd5 /apex/com.android.runtime/lib64/bionic/libc.so (scudo::die()+5) (BuildId: 007cb2313464df63debf8020e631c990)
#2 0x00000000000493c8 /apex/com.android.runtime/lib64/bionic/libc.so (scudo::ScopedErrorReport::~ScopedErrorReport()+24) (BuildId: 007cb2313464df63debf8020e631c990)
#3 0x00000000000494b2 /apex/com.android.runtime/lib64/bionic/libc.so (scudo::reportHeaderCorruption(void*)+66) (BuildId: 007cb2313464df63debf8020e631c990)
#4 0x000000000004acd9 /apex/com.android.runtime/lib64/bionic/libc.so (scudo::Allocator<scudo::AndroidConfig, &(scudo_malloc_postinit)>::deallocate(void*, scudo::Chunk::Origin, unsigned long, unsigned long)+313) (BuildId: 007cb2313464df63debf8020e631c990)
#5 0x000000000003dbf7 /data/app/~~SG1GNAAPvj0sUTcOl8YTqA==/com.-AzossUaucGeKM6Qliwd4mQ==/lib/x86_64/libhev-socks5-tunnel.so (pbuf_free+119) (BuildId: 0735365fce0eeb8285dacd2245c0900a62323e56)
pbuf_free
/Users/evgenybozhko/Projects//app/src/main/jni/hev-socks5-tunnel/third-part/lwip/src/core/pbuf.c:780:11
#6 0x00000000000413f5 /data/app/~~SG1GNAAPvj0sUTcOl8YTqA==/com.-AzossUaucGeKM6Qliwd4mQ==/lib/x86_64/libhev-socks5-tunnel.so (tcp_pcb_purge+309) (BuildId: 0735365fce0eeb8285dacd2245c0900a62323e56)
tcp_seg_free
/Users/evgenybozhko/Projects//app/src/main/jni/hev-socks5-tunnel/third-part/lwip/src/core/tcp.c:1646:7
tcp_segs_free
/Users/evgenybozhko/Projects//app/src/main/jni/hev-socks5-tunnel/third-part/lwip/src/core/tcp.c:1631:5
tcp_pcb_purge
/Users/evgenybozhko/Projects//app/src/main/jni/hev-socks5-tunnel/third-part/lwip/src/core/tcp.c:2184:5
#7 0x00000000000400bb /data/app/~~SG1GNAAPvj0sUTcOl8YTqA==/com..-AzossUaucGeKM6Qliwd4mQ==/lib/x86_64/libhev-socks5-tunnel.so (tcp_pcb_remove+75) (BuildId: 0735365fce0eeb8285dacd2245c0900a62323e56)
tcp_pcb_remove
/Users/evgenybozhko/Projects//app/src/main/jni/hev-socks5-tunnel/third-part/lwip/src/core/tcp.c:2206:3
#8 0x000000000003fdf2 /data/app/~~SG1GNAAPvj0sUTcOl8YTqA==/com..-AzossUaucGeKM6Qliwd4mQ==/lib/x86_64/libhev-socks5-tunnel.so (tcp_abandon+114) (BuildId: 0735365fce0eeb8285dacd2245c0900a62323e56)
tcp_abandon
/Users/evgenybozhko/Projects//app/src/main/jni/hev-socks5-tunnel/third-part/lwip/src/core/tcp.c:602:7
#9 0x000000000001c7a8 /data/app/~~SG1GNAAPvj0sUTcOl8YTqA==/com..-AzossUaucGeKM6Qliwd4mQ==/lib/x86_64/libhev-socks5-tunnel.so (hev_socks5_tunnel_main+392) (BuildId: 0735365fce0eeb8285dacd2245c0900a62323e56)
lwip_fini
/Users/evgenybozhko/Projects//app/src/main/jni/hev-socks5-tunnel//src/hev-main.c:84:13
hev_socks5_tunnel_main
/Users/evgenybozhko/Projects//app/src/main/jni/hev-socks5-tunnel//src/hev-main.c:139:5
#10 0x000000000001c5ce /data/app/~~SG1GNAAPvj0sUTcOl8YTqA==/com..-AzossUaucGeKM6Qliwd4mQ==/lib/x86_64/libhev-socks5-tunnel.so (BuildId: 0735365fce0eeb8285dacd2245c0900a62323e56)
thread_handler
/Users/evgenybozhko/Projects//app/src/main/jni/hev-socks5-tunnel//src/hev-jni.c:68:5
#11 0x00000000000ccd2a /apex/com.android.runtime/lib64/bionic/libc.so (__pthread_start(void*)+58) (BuildId: 007cb2313464df63debf8020e631c990)
#12 0x0000000000060d37 /apex/com.android.runtime/lib64/bionic/libc.so (__start_thread+55) (BuildId: 007cb2313464df63debf8020e631c990)
Crash dump is completed
`
我想交叉编绎到padavan上,但是这个需要yaml库来着
After call
HevSocks5Tunnel.hev_socks5_tunnel_main(path, self.currentTunnelFileDescriptor!))
Tunnel is starting and all is working. But thread is blocked, code doesn't going next.
But after trying to call Stop
SIGABRT crash, on hev_socks5_tunnel_main
line.
Some time before all was ok.
Issue reproduce with 2.4.0 and with your latest changes in this repository.
Hello sir.
Can you create a apk , please ?
i am not a programmer , but i want to use hev-socks5-tunnel.
i want to install it on a ubuntu VPS for server and use android like client.
我想在ios项目中集成hev-sock5-tunnel代码,在编译过程中出现了报错
/third-part/hev-task-system/src/arch/arm/hev-task-execute-arm.s:12:25: error: unexpected token in directive
.globl _hev_task_execute%% .p2align 2%% _hev_task_execute:
请求帮助如何解决这个问题?
Hi,有时间帮忙看下。由于我本地没有macOS x86_64环境,这里是github action构建的输出。
我希望构建Tun2SocksKit支持 iOS(真机、模拟器) 及 macOS(x86_64、arm64)。iOS 模拟器构建使用的是hev-socks5-tunnel-iphonesimulator,仅仅实现hev-socks5-tunnel
的接口。其他使用的是hev-socks5-tunnel
来构建。
macOS x86_64架构的构建命令:
make PP=g++ \
CC=gcc \
CFLAGS="-arch x86_64 -mmacosx-version-min=12.0" \
LFLAGS="-arch x86_64 -mmacosx-version-min=12.0 -Wl,-Bsymbolic-functions" static
构建输出
BUILD src/api/api_lib.c
[67](https://github.com/daemooon/Tun2SocksKit/actions/runs/4463695354/jobs/7839154811#step:5:68)
BUILD src/api/api_msg.c
[68](https://github.com/daemooon/Tun2SocksKit/actions/runs/4463695354/jobs/7839154811#step:5:69)
BUILD src/api/err.c
[69](https://github.com/daemooon/Tun2SocksKit/actions/runs/4463695354/jobs/7839154811#step:5:70)
BUILD src/api/if_api.c
[70](https://github.com/daemooon/Tun2SocksKit/actions/runs/4463695354/jobs/7839154811#step:5:71)
BUILD src/api/netbuf.c
[71](https://github.com/daemooon/Tun2SocksKit/actions/runs/4463695354/jobs/7839154811#step:5:72)
BUILD src/api/netdb.c
[72](https://github.com/daemooon/Tun2SocksKit/actions/runs/4463695354/jobs/7839154811#step:5:73)
BUILD src/api/netifapi.c
[73](https://github.com/daemooon/Tun2SocksKit/actions/runs/4463695354/jobs/7839154811#step:5:74)
BUILD src/api/sockets.c
[74](https://github.com/daemooon/Tun2SocksKit/actions/runs/4463695354/jobs/7839154811#step:5:75)
BUILD src/api/tcpip.c
[75](https://github.com/daemooon/Tun2SocksKit/actions/runs/4463695354/jobs/7839154811#step:5:76)
BUILD src/core/altcp.c
[76](https://github.com/daemooon/Tun2SocksKit/actions/runs/4463695354/jobs/7839154811#step:5:77)
BUILD src/core/altcp_alloc.c
[77](https://github.com/daemooon/Tun2SocksKit/actions/runs/4463695354/jobs/7839154811#step:5:78)
BUILD src/core/altcp_tcp.c
[78](https://github.com/daemooon/Tun2SocksKit/actions/runs/4463695354/jobs/7839154811#step:5:79)
BUILD src/core/def.c
[79](https://github.com/daemooon/Tun2SocksKit/actions/runs/4463695354/jobs/7839154811#step:5:80)
BUILD src/core/dns.c
[80](https://github.com/daemooon/Tun2SocksKit/actions/runs/4463695354/jobs/7839154811#step:5:81)
BUILD src/core/inet_chksum.c
[81](https://github.com/daemooon/Tun2SocksKit/actions/runs/4463695354/jobs/7839154811#step:5:82)
BUILD src/core/init.c
[82](https://github.com/daemooon/Tun2SocksKit/actions/runs/4463695354/jobs/7839154811#step:5:83)
BUILD src/core/ip.c
[83](https://github.com/daemooon/Tun2SocksKit/actions/runs/4463695354/jobs/7839154811#step:5:84)
BUILD src/core/ipv4/autoip.c
[84](https://github.com/daemooon/Tun2SocksKit/actions/runs/4463695354/jobs/7839154811#step:5:85)
BUILD src/core/ipv4/dhcp.c
[85](https://github.com/daemooon/Tun2SocksKit/actions/runs/4463695354/jobs/7839154811#step:5:86)
BUILD src/core/ipv4/etharp.c
[86](https://github.com/daemooon/Tun2SocksKit/actions/runs/4463695354/jobs/7839154811#step:5:87)
BUILD src/core/ipv4/icmp.c
[87](https://github.com/daemooon/Tun2SocksKit/actions/runs/4463695354/jobs/7839154811#step:5:88)
BUILD src/core/ipv4/igmp.c
[88](https://github.com/daemooon/Tun2SocksKit/actions/runs/4463695354/jobs/7839154811#step:5:89)
BUILD src/core/ipv4/ip4.c
[89](https://github.com/daemooon/Tun2SocksKit/actions/runs/4463695354/jobs/7839154811#step:5:90)
BUILD src/core/ipv4/ip4_addr.c
[90](https://github.com/daemooon/Tun2SocksKit/actions/runs/4463695354/jobs/7839154811#step:5:91)
BUILD src/core/ipv4/ip4_frag.c
[91](https://github.com/daemooon/Tun2SocksKit/actions/runs/4463695354/jobs/7839154811#step:5:92)
BUILD src/core/ipv6/dhcp6.c
[92](https://github.com/daemooon/Tun2SocksKit/actions/runs/4463695354/jobs/7839154811#step:5:93)
BUILD src/core/ipv6/ethip6.c
[93](https://github.com/daemooon/Tun2SocksKit/actions/runs/4463695354/jobs/7839154811#step:5:94)
BUILD src/core/ipv6/icmp6.c
[94](https://github.com/daemooon/Tun2SocksKit/actions/runs/4463695354/jobs/7839154811#step:5:95)
BUILD src/core/ipv6/inet6.c
[95](https://github.com/daemooon/Tun2SocksKit/actions/runs/4463695354/jobs/7839154811#step:5:96)
BUILD src/core/ipv6/ip6.c
[96](https://github.com/daemooon/Tun2SocksKit/actions/runs/4463695354/jobs/7839154811#step:5:97)
BUILD src/core/ipv6/ip6_addr.c
[97](https://github.com/daemooon/Tun2SocksKit/actions/runs/4463695354/jobs/7839154811#step:5:98)
BUILD src/core/ipv6/ip6_frag.c
[98](https://github.com/daemooon/Tun2SocksKit/actions/runs/4463695354/jobs/7839154811#step:5:99)
BUILD src/core/ipv6/mld6.c
[99](https://github.com/daemooon/Tun2SocksKit/actions/runs/4463695354/jobs/7839154811#step:5:100)
BUILD src/core/ipv6/nd6.c
[200](https://github.com/daemooon/Tun2SocksKit/actions/runs/4463695354/jobs/7839154811#step:5:201)
/Applications/Xcode_14.2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: bin/liblwip.a(des.o) has no symbols
[201](https://github.com/daemooon/Tun2SocksKit/actions/runs/4463695354/jobs/7839154811#step:5:202)
/Applications/Xcode_14.2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: bin/liblwip.a(md4.o) has no symbols
[202](https://github.com/daemooon/Tun2SocksKit/actions/runs/4463695354/jobs/7839154811#step:5:203)
/Applications/Xcode_14.2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: bin/liblwip.a(md5.o) has no symbols
[203](https://github.com/daemooon/Tun2SocksKit/actions/runs/4463695354/jobs/7839154811#step:5:204)
/Applications/Xcode_14.2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: bin/liblwip.a(sha1.o) has no symbols
[204](https://github.com/daemooon/Tun2SocksKit/actions/runs/4463695354/jobs/7839154811#step:5:205)
/Applications/Xcode_14.2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: bin/liblwip.a(ppp.o) has no symbols
[205](https://github.com/daemooon/Tun2SocksKit/actions/runs/4463695354/jobs/7839154811#step:5:206)
/Applications/Xcode_14.2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: bin/liblwip.a(pppapi.o) has no symbols
[206](https://github.com/daemooon/Tun2SocksKit/actions/runs/4463695354/jobs/7839154811#step:5:207)
/Applications/Xcode_14.2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: bin/liblwip.a(pppcrypt.o) has no symbols
[207](https://github.com/daemooon/Tun2SocksKit/actions/runs/4463695354/jobs/7839154811#step:5:208)
/Applications/Xcode_14.2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: bin/liblwip.a(pppoe.o) has no symbols
[208](https://github.com/daemooon/Tun2SocksKit/actions/runs/4463695354/jobs/7839154811#step:5:209)
/Applications/Xcode_14.2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: bin/liblwip.a(pppol2tp.o) has no symbols
[209](https://github.com/daemooon/Tun2SocksKit/actions/runs/4463695354/jobs/7839154811#step:5:210)
/Applications/Xcode_14.2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: bin/liblwip.a(pppos.o) has no symbols
[210](https://github.com/daemooon/Tun2SocksKit/actions/runs/4463695354/jobs/7839154811#step:5:211)
/Applications/Xcode_14.2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: bin/liblwip.a(upap.o) has no symbols
[211](https://github.com/daemooon/Tun2SocksKit/actions/runs/4463695354/jobs/7839154811#step:5:212)
/Applications/Xcode_14.2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: bin/liblwip.a(utils.o) has no symbols
[212](https://github.com/daemooon/Tun2SocksKit/actions/runs/4463695354/jobs/7839154811#step:5:213)
/Applications/Xcode_14.2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: bin/liblwip.a(vj.o) has no symbols
[213](https://github.com/daemooon/Tun2SocksKit/actions/runs/4463695354/jobs/7839154811#step:5:214)
/Applications/Xcode_14.2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: bin/liblwip.a(pcapif.o) has no symbols
Job:https://github.com/daemooon/Tun2SocksKit/actions/runs/4463695354/jobs/7839154811
Step:build macOS arm4_x86_64
I'm trying to run the proxy on arch.
a socks proxy is running on 1080
this is the log:
[~/Downloads]$ sudo ./hev-socks5-tunnel-linux-x86_32 main.yml
[2023-04-11 15:45:07] [E] 0xf7deaa38 socks5 client res.rep 7
[2023-04-11 15:45:07] [E] 0xf7deaa38 socks5 session handshake
[2023-04-11 15:45:07] [E] 0xf7deaa38 socks5 client res.rep 7
[2023-04-11 15:45:07] [E] 0xf7deaa38 socks5 session handshake
[2023-04-11 15:45:08] [E] 0xf7deaa38 socks5 client res.rep 7
[2023-04-11 15:45:08] [E] 0xf7deaa38 socks5 session handshake
config file:
tunnel:
name: tun1
mtu: 4500
multi-queue: false
ipv4: 10.192.0.1
ipv6: 'fc00::1'
socks5:
port: 1080
address: 127.0.0.1
udp: 'tcp'
where is the problem?
Hello, dear creators for fast and powerful lib. I have experience with Android and got a crash when trying to disconnect VPN via call
native_stop_service()
. Also, I have opened a browser with a large site page where some connections are active. And then the lib crashes with 100% reproducibility. I will attache the stack crash here. Maybe you will let me understand what the issue is it.
`$ ndk-stack -sym obj/local/armeabi-v7a -dump logcatstack.txt
********** Crash dump: **********
Build fingerprint: 'samsung/a10dd/a10:11/RP1A.200720.012/A105FDDS9CWB2:user/release-keys'
#00 0x00062de8 /apex/com.android.runtime/lib/bionic/libc.so (abort+172) (BuildId: fef5b751123147ea65bf3f4f798c9518)
#1 0x000317e3 /data/app/~~0m7d9dyDY21u6PRAD8qSXw==/com.packagename-C_NZmKME9tYhCufO9j1fmQ==/lib/arm/libhev-socks5-tunnel.so (BuildId: 46d445c04ee2ce60954873d03fcfdc580fcad3ac)
hev_task_system_wakeup_task_with_context
/Users/evgenybozhko/Projects/AppName/app/src/main/jni/hev-socks5-tunnel/third-part/hev-task-system/src/kern/core/hev-task-system-schedule.c:152:9
hev_task_system_io_poll
/Users/evgenybozhko/Projects/AppName/app/src/main/jni/hev-socks5-tunnel/third-part/hev-task-system/src/kern/core/hev-task-system-schedule.c:170:9
hev_task_system_pick_current_task
/Users/evgenybozhko/Projects/AppName/app/src/main/jni/hev-socks5-tunnel/third-part/hev-task-system/src/kern/core/hev-task-system-schedule.c:181:13
#2 0x000315dd /data/app/~~0m7d9dyDY21u6PRAD8qSXw==/com.packagename-C_NZmKME9tYhCufO9j1fmQ==/lib/arm/libhev-socks5-tunnel.so (BuildId: 46d445c04ee2ce60954873d03fcfdc580fcad3ac)
hev_task_system_schedule
/Users/evgenybozhko/Projects/AppName/app/src/main/jni/hev-socks5-tunnel/third-part/hev-task-system/src/kern/core/hev-task-system-schedule.c:234:5
#3 0x00012785 /data/app/~~0m7d9dyDY21u6PRAD8qSXw==/com.packagename-C_NZmKME9tYhCufO9j1fmQ==/lib/arm/libhev-socks5-tunnel.so (hev_socks5_tunnel_run+76) (BuildId: 46d445c04ee2ce60954873d03fcfdc580fcad3ac)
hev_socks5_tunnel_run
/Users/evgenybozhko/Projects/AppName/app/src/main/jni/hev-socks5-tunnel//src/hev-socks5-tunnel.c:192:5
#4 0x0001145b /data/app/~~0m7d9dyDY21u6PRAD8qSXw==/com.packagename-C_NZmKME9tYhCufO9j1fmQ==/lib/arm/libhev-socks5-tunnel.so (hev_socks5_tunnel_main+170) (BuildId: 46d445c04ee2ce60954873d03fcfdc580fcad3ac)
hev_socks5_tunnel_main
/Users/evgenybozhko/Projects/AppName/app/src/main/jni/hev-socks5-tunnel//src/hev-main.c:132:5
#5 0x0001139b /data/app/~~0m7d9dyDY21u6PRAD8qSXw==/com.packagename-C_NZmKME9tYhCufO9j1fmQ==/lib/arm/libhev-socks5-tunnel.so (BuildId: 46d445c04ee2ce60954873d03fcfdc580fcad3ac)
thread_handler
/Users/evgenybozhko/Projects/AppName/app/src/main/jni/hev-socks5-tunnel//src/hev-jni.c:88:5
#6 0x000aaf33 /apex/com.android.runtime/lib/bionic/libc.so (__pthread_start(void*)+40) (BuildId: fef5b751123147ea65bf3f4f798c9518)
Crash dump is completed
$
`
Hi!
I've compiled and installed everything correctly. The utility seems to be working just fine and I have created a service for it.
But when I try to IP route all of the traffic to tun0 there is no network connection.
When I run "curl ifconfig.me," it prints out "curl: (56) Recv failure: Connection reset by peer."
I am trying to connect to the working, paid remote socks5 server that is pinging perfectly fine.
Can you please help me out here?
Thanks in advance.
Hi, i am trying to test 2.4.3 version and get:
/usr/bin/hev-socks5-tunnel-linux-x86_64: line 3: syntax error: unexpected "|" (expecting ")")
Here's my config.yml
tunnel:
# Interface name
name: uutun0
# Interface MTU
mtu: 8500
# Multi-queue
multi-queue: false
# IPv4 address
ipv4: 198.18.0.1
# IPv6 address
ipv6: 'fc00::1'
socks5:
# Socks5 server port
port: 1081
# Socks5 server address (ipv4/ipv6)
address: 127.0.0.1
# Socks5 UDP relay mode (tcp|udp)
udp: 'udp'
Despite tun interface being declared as "uutun0", it creates a device named "utun2"--not a problem so far.
Then I do: sudo ./hev-socks5-tunnel config.yml
and it starts: [2023-05-04 16:00:10] [W] set limit nofile
Here's how I set the default route:
sudo route change default 198.18.0.1 -hopcount 1
So far it won't work and I get lots of [2023-05-04 16:02:02] [E] 0x7faf187044f0 socks5 client connect
and nothing else....
I don't understand the "bypass" part and how to do it on macOS please explain.
Thank you.
如題,這樣的話,就可以在所有操作系統內使用同一構建命令了。
Can Windows be supported in the future?
将来可以支持Windows吗?
# Main configuration for hev-socks5-tunnel
tunnel:
# Interface name
name: tun0
# Interface MTU
mtu: 8500
# Multi-queue
multi-queue: false
# IPv4 address
ipv4: 198.18.0.1
# IPv6 address
ipv6: 'fc00::1'
socks5:
# Socks5 server port
port: 1081
# Socks5 server address (ipv4/ipv6)
address: 127.0.0.1
# Socks5 UDP relay mode (tcp|udp)
udp: 'tcp'
# Socks5 server username
username: '4444
# Socks5 server password
password: '1223'
misc:
# task stack size (bytes)
# task-stack-size: 20480
# connect timeout (ms)
# connect-timeout: 5000
# read-write timeout (ms)
# read-write-timeout: 60000
# stdout, stderr or file-path
log-file: stderr
# debug, info, warn or error
log-level: error
# If present, run as a daemon with this pid file
pid-file: /tmp/hev-socks5-tunnel.pid
# If present, set rlimit nofile; else use default value
limit-nofile: 65535
还有这个显示的是什么错误信息?如果日志写入文件的话就太占用空间了,有关闭log的功能吗?
import NetworkExtension
import Tun2SocksKit
import os
import XrayKit
import UniformTypeIdentifiers
class PacketTunnelProvider: NEPacketTunnelProvider {
func onGeneralMessage(_ severity: String?, message: String?) {
let level = MGLogModel.Severity(rawValue: Int(severity ?? "0") ?? 0) ?? .none
guard let message = message, !message.isEmpty else {
return
}
switch level {
case .debug:
NSLog("DEBUG", message)
case .info:
NSLog("INFO", message)
case .warning:
NSLog("WARNING", message)
case .error:
NSLog("ERROR", message)
case .none:
break
}
}
override func startTunnel(options: [String : NSObject]? = nil) async throws {
// Darwin.sleep(13)
do {
let newSettings = NEPacketTunnelNetworkSettings(tunnelRemoteAddress: "192.168.111.10")
newSettings.ipv4Settings = NEIPv4Settings(addresses: ["192.168.111.111"], subnetMasks: ["255.255.255.0"])
newSettings.ipv4Settings?.includedRoutes = [NEIPv4Route.`default`()]
newSettings.proxySettings = nil
newSettings.dnsSettings = NEDNSSettings(servers: ["8.8.8.8","8.8.4.4"])
newSettings.mtu = 9000
try await self.setTunnelNetworkSettings(newSettings)
try self.startXray(data: options!["config"] as! String)
try self.startSocks5Tunnel(serverPort: 10801)
} catch {
print("XRAY ERROR: %@")
throw error
}
}
private func startXray(data: String) throws {
let xrayInstance = XrayInstance()
do {
NSLog("JSON config: %@", data)
guard FileManager.default.createFile(atPath: MGConstant.configDirectory+"/config.json", contents: data.data(using: .utf8)!) else {
throw NSError.newError("Xray Failed to write configuration file")
}
try xrayInstance.setenv("XRAY_LOCATION_CONFIG", value: MGConstant.configDirectory)
try xrayInstance.setenv("XRAY_LOCATION_ASSET", value: MGConstant.assetDirectory)
NSLog("MYAPP:%@", MGConstant.configDirectory)
NSLog("MYAPP:%@", MGConstant.assetDirectory)
try xrayInstance.run(data.data(using: .utf8)!)
} catch {
NSLog("Xray Error: %@", error.localizedDescription)
throw error
}
}
private func startSocks5Tunnel(serverPort port: Int) throws {
let config = """
tunnel:
name: tun0
mtu: 9000
socks5:
port: \(port)
address: 127.0.0.1
udp: 'tcp'
misc:
task-stack-size: 20480
connect-timeout: 5000
read-write-timeout: 60000
log-file: stderr
log-level: debug
limit-nofile: 65535
"""
guard FileManager.default.createFile(atPath: MGConstant.configDirectory+"/config.yml", contents: config.data(using: .utf8)!) else {
throw NSError.newError("Tunnel Failed to write configuration file")
}
DispatchQueue.global(qos: .userInitiated).async {
let result = Socks5Tunnel.run(withConfig: MGConstant.configDirectory+"/config.yml")
NSLog("MYAPP:", result)
}
}
override func stopTunnel(with reason: NEProviderStopReason) async {
let message: String
switch reason {
case .none:
message = "No specific reason."
case .userInitiated:
message = "The user stopped the provider."
case .providerFailed:
message = "The provider failed."
case .noNetworkAvailable:
message = "There is no network connectivity."
case .unrecoverableNetworkChange:
message = "The device attached to a new network."
case .providerDisabled:
message = "The provider was disabled."
case .authenticationCanceled:
message = "The authentication process was cancelled."
case .configurationFailed:
message = "The provider could not be configured."
case .idleTimeout:
message = "The provider was idle for too long."
case .configurationDisabled:
message = "The associated configuration was disabled."
case .configurationRemoved:
message = "The associated configuration was deleted."
case .superceded:
message = "A high-priority configuration was started."
case .userLogout:
message = "The user logged out."
case .userSwitch:
message = "The active user changed."
case .connectionFailed:
message = "Failed to establish connection."
case .sleep:
message = "The device went to sleep and disconnectOnSleep is enabled in the configuration."
case .appUpdate:
message = "The NEProvider is being updated."
@unknown default:
return
}
NSLog("stopTunnel", message)
}
func onAccessLog(_ message: String?) {
message.flatMap {
NSLog("onDNSLog", $0)
}
}
func onDNSLog(_ message: String?) {
message.flatMap {
NSLog("onDNSLog", $0)
}
}
}
program never succeed to print result
It seems that the tunnel stays in that line
@arror
@tozik
@smukee
I'm using xraykit here, do you have any experience with this for mac?
Thank you for your help
There are two UDP relay modes in HevSocks5Tunnel:
This is the standard way for UDP relay of RFC 1928. Use this mode for any socks5 server that implements the UDP-ASSOCIATE method of RFC1928.
socks5:
udp: udp
This is the extended way for UDP relay over TCP that implemented by HevSocks5Server.
socks5:
udp: tcp
Config is
tunnel:
# Interface name
name: tun1
mtu: 9000
socks5:
# Socks5 server port
port: \(port)
# Socks5 server address (ipv4/ipv6)
address: \(address)
# Socks5 UDP relay mode (tcp|udp)
udp: 'udp'
# Socks5 server username
username: '\(username)'
# Socks5 server password
password: '\(password)'
misc:
task-stack-size: 20480
connect-timeout: 5000
read-write-timeout: 60000
log-file: stderr
log-level: debug
limit-nofile: 65535
"""
setTunnelNetworkSettings(tunnelNetworkSettings)
with
let newSettings = NEPacketTunnelNetworkSettings(tunnelRemoteAddress: "192.168.111.10")
newSettings.ipv4Settings = NEIPv4Settings(addresses: ["192.168.111.111"], subnetMasks: ["255.255.255.0"])
newSettings.ipv4Settings?.includedRoutes = [NEIPv4Route.`default`()]
newSettings.proxySettings = nil
newSettings.dnsSettings = NEDNSSettings(servers: ["8.8.8.8","8.8.4.4"])
newSettings.mtu = 9000
But traffic is not going, with same way iOS working
without setTunnelNetworkSettings traffic going not through socks server
could you give some advise please?
Hi
As the subject of the issue says when I run the Linux binary nothing happens. Asked for debug log in the config file but again no nothing in the log!
log-file: /var/log/hevsocks.log
log-level: debug
However, the tun0 device is created. I can confirm this by the ifconfig and syslog output...
Feb 17 18:03:31 ubuntu-lts-hyperv systemd-networkd[689]: tun0: Link UP
Feb 17 18:03:31 ubuntu-lts-hyperv networkd-dispatcher[709]: WARNING:Unknown index 29 seen, reloading interface list
Feb 17 18:03:31 ubuntu-lts-hyperv systemd-networkd[689]: tun0: Gained carrier
Feb 17 18:03:31 ubuntu-lts-hyperv systemd-networkd[689]: tun0: Gained IPv6LL
Feb 17 18:03:31 ubuntu-lts-hyperv systemd-udevd[5027]: Using default interface naming scheme 'v249'.
Feb 17 18:03:31 ubuntu-lts-hyperv NetworkManager[703]: <info> [1676657011.8799] manager: (tun0): new Tun device (/org/freedesktop/NetworkManager/Devices/29)
Feb 17 18:03:34 ubuntu-lts-hyperv systemd-networkd[689]: tun0: Link DOWN
Feb 17 18:03:34 ubuntu-lts-hyperv systemd-networkd[689]: tun0: Lost carrier
tun0: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST> mtu 9000
inet 10.0.0.2 netmask 255.255.255.0 destination 10.0.0.2
inet6 fe80::8d89:35c3:430f:11c5 prefixlen 64 scopeid 0x20<link>
inet6 fc00::2 prefixlen 126 scopeid 0x0<global>
unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen 500 (UNSPEC)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 1 bytes 48 (48.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
I just get an output on terminal after killing the process by CTRL+C:
root@ubuntu-lts-hyperv:~/hev-socks5-tunnel# sudo ./hev-socks5-tunnel-linux-x86_64 ./conf/main.yml
**^C[2023-02-17 18:05:01] [E] socks5 tunnel read**
root@ubuntu-lts-hyperv:~/hev-socks5-tunnel#
I am sure about my Socks server health and confirmed it by Curl:
root@ubuntu-lts-hyperv:~# curl -x socks5h://localhost:1080 google.com
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>301 Moved</TITLE></HEAD><BODY>
<H1>301 Moved</H1>
The document has moved
<A HREF="http://www.google.com/">here</A>.
</BODY></HTML>
root@ubuntu-lts-hyperv:~#
root@ubuntu-lts-hyperv:~# curl -x socks5h://localhost:1080 --output deleteme -L https://github.com/heiher/hev-socks5-tunnel/archive/refs/tags/2.4.3.tar.gz
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- 0:00:01 --:--:-- 0
100 21817 0 21817 0 0 10398 0 --:--:-- 0:00:02 --:--:-- 67129
root@ubuntu-lts-hyperv:~#
I must also add that I used my locally compiled binary and the latest available release here on Github.
Sorry that I cannot provide more details. As I said these are literally ALL I have.
P.S.
This is my OS details:
root@ubuntu-lts-hyperv:~# uname -a
Linux ubuntu-lts-hyperv 5.15.0-60-generic #66-Ubuntu SMP Fri Jan 20 14:29:49 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
root@ubuntu-lts-hyperv:~# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04.1 LTS
Release: 22.04
Codename: jammy
root@ubuntu-lts-hyperv:~#
P.P.S
Proper source policy based routing is also done:
echo 100 tun2socks >> /etc/iproute2/rt_tables
ip rule add from 10.0.0.0/24 dev tun0 table tun2socks
ip route add default via 10.0.0.1 dev tun0 table tun2socks
root@ubuntu-lts-hyperv:~# ip rule ls
0: from all lookup local
32765: from 10.0.0.0/24 iif tun0 lookup tun2socks
32766: from all lookup main
32767: from all lookup default
root@ubuntu-lts-hyperv:~# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 172.25.192.1 0.0.0.0 UG 0 0 0 eth0
10.0.0.0 0.0.0.0 255.255.255.0 U 0 0 0 tun0
172.17.0.0 0.0.0.0 255.255.0.0 U 0 0 0 docker0
172.25.192.0 0.0.0.0 255.255.240.0 U 0 0 0 eth0
root@ubuntu-lts-hyperv:~# ip route
default via 172.25.192.1 dev eth0 proto static
10.0.0.0/24 dev tun0 proto kernel scope link src 10.0.0.2
172.17.0.0/16 dev docker0 proto kernel scope link src 172.17.0.1 linkdown
172.25.192.0/20 dev eth0 proto kernel scope link src 172.25.205.30
root@ubuntu-lts-hyperv:~# ip route list table tun2socks
default via 10.0.0.1 dev tun0
Improve CPU utilization on Linux systems by implementing multi-process support.
To address the limitations of the current single-threaded mode, and to fully utilize the multi-core CPU resources of the system, enhancing transfer throughput by enabling multi-process mode.
The multi-process mode will be supported on Linux systems, and a configuration option will be added to control the toggle of multi-process mode. When multi-process mode is enabled, the multi-queue function of the TUN device will be activated, allowing multiple processes to work on the same TUN device, with data flows distributed across multiple processes.
#include "hev-socks5-tunnel.h"
....
int ret = hev_socks5_tunnel_main(config_path, 1);
....
hev using like library (using your release libs or build by myself behavior is the same)
If path to config is wrong method returning -1
Config is
tunnel:
# Interface MTU
mtu: 8500
socks5:
#Socks5 server port
port: **port**
#Socks5 server address (ipv4/ipv6)
address: **ip**
#Socks5 UDP relay mode (tcp|udp)
udp: 'tcp'
#Socks5 server username
username: 'user'
#Socks5 server password
password: 'pass'
misc:
# task stack size (bytes)
task-stack-size: 20480
# connect timeout (ms)
connect-timeout: 5000
# read-write timeout (ms)
read-write-timeout: 60000
# stdout, stderr or file-path
log-file: stderr
log-level: trace
# If present, set rlimit nofile; else use default value
limit-nofile: 65535
working if runing with terminal your release, if build on local machine, and run from terminal, its dropping/stopping from time to time
could you advise something?
Hey!
So, I'm kinda new to this. How do I compile this into an xcframework for iphoneos with a specific min ios version (arm64 only)?
Consider this project idea.
An interface for every proxy, not just socks5.
This will be done outside of the library:
So instead of just running the tun2socks, we'll need other functions
You probably know that there are some issues with iOS and its RAM limits for VPNs.
I'm implementing all Xray-core functionalities for iOS in native code (obviously open-source) and I thought this would be the perfect tun2proxy method as I've tried your code and it's very good in every aspect I need it to be.
My Sock5 server doesn't support udp(can't be changed) , dns request can't via the socks . It works when i use dns2socks to handle dns request. Any plan to support such scenes?
{
"inbounds": [
{
"listen": "[::1]",
"port": 10801,
"protocol": "socks",
"settings": {
"auth": "noauth",
"udp": true,
"allowTransparent": true
},
"sniffing": {
"destOverride": [
"http",
"tls"
],
"enabled": true,
"metadataOnly": null,
"routeOnly": false
},
"tag": "socks"
},
{
"listen": "[::1]",
"port": 10802,
"protocol": "http",
"settings": {
"auth": "noauth",
"udp": true,
"allowTransparent": true
},
"sniffing": {
"destOverride": [
"http",
"tls"
],
"enabled": true,
"metadataOnly": null,
"routeOnly": false
},
"tag": "http"
}
],
"outbounds": [
{
"tag": "proxy",
"sendThrough": "0.0.0.0",
"protocol": "vless",
"settings": {
"vnext": [
{
"address": "",
"port": 81,
"users": [
{
"id": "",
"alterId": 0,
"security": "auto",
"encryption": "none",
"flow": ""
}
]
}
]
},
"streamSettings": {
"tcpSettings": {
"header": {
"type": "none"
}
},
"realitySettings": {
"fingerprint": "firefox",
"show": false,
"publicKey": "",
"serverName": "www.speedtest.net"
},
"network": "tcp",
"security": "reality"
}
},
{
"tag": "direct",
"protocol": "freedom",
"settings": {}
}
],
"routing": {
"domainStrategy": "AsIs",
"rules": [
{
"type": "field",
"domain": [
"regexp:.*.ir$",
"ext:iran.dat:ir",
"ext:iran.dat:other",
"geosite:category-ir-gov",
"geosite:category-ir-news",
"geosite:category-ir-bank",
"geosite:category-ir-tech",
"geosite:category-ir-travel",
"geosite:category-ir-shopping",
"geosite:category-ir-insurance",
"geosite:category-ir-scholar",
"geosite:category-ir-payment",
"geosite:category-ir-social-media",
"geosite:category-ir-media",
"geosite:category-ir-bourse",
"geosite:category-ir",
"google.com",
"www.google.com",
"snapp",
"digikala",
"speedtest",
"whatismyipaddress",
"tapsi",
"blogfa",
"bank",
"sb24.com",
"sheypoor.com",
"tebyan.net",
"beytoote.com",
"telewebion.com",
"Film2movie.ws",
"Setare.com",
"Filimo.com",
"Torob.com",
"Tgju.org",
"Sarzamindownload.com",
"soft98.ir",
"downloadha.com",
"P30download.com",
"P30download.ir",
"Sanjesh.org",
"whatismyipaddress.com",
"www.whatismyip.com",
"www.speedtest.net",
"speedtest.net"
],
"network": "tcp",
"outboundTag": "direct",
"enabled": true
},
{
"type": "field",
"ip": [
"geoip:private",
"geoip:ir"
],
"network": "tcp",
"outboundTag": "direct",
"enabled": true
},
{
"type": "field",
"port": "0-65535",
"network": "tcp",
"outboundTag": "proxy",
"enabled": true
}
]
}
}
I tested this config in proxy mode with chrome extension socks5-configurator
geoip worked ✅
but when I bypass upstream and tunneling whole system with hev-tun
just geoip not working ❌
#!/bin/bash
#variables
host_name=$1
xray_ip=$(dig +short $host_name)
def_gate=$(ip r | grep 'default' | awk '{print$3}') # This will output your default gateway ip address . if command fails try finding the deault gateway ip by using 'ip r' command
echo "\n1\n"
ip tuntap del dev tun0 mode tun user $USER
ip route del $xray_ip via $def_gate
ip tuntap add dev tun0 mode tun user $USER
ip addr add 10.0.0.1/24 dev tun0
ip addr add fdfe:dcba:9876::1/125 dev tun0
ip route add $xray_ip via $def_gate
ip link set tun0 up
ip -6 link set tun0 up
ip route add default dev tun0
ip -6 route add default dev tun0
echo "\n2\n"
chmod +x hev
# sleep 2
# insert/update hosts entry
ip_address=$xray_ip
# find existing instances in the host file and save the line numbers
suffix="XrayTun.linux"
matches_in_hosts="$(grep -n "$suffix" /etc/hosts | cut -f1 -d:)"
host_entry="${ip_address} ${host_name} ${suffix}"
echo "Please enter your password if requested."
if [ ! -z "$matches_in_hosts" ]
then
echo "Updating existing hosts entry."
# iterate over the line numbers on which matches were found
while read -r line_number; do
# replace the text of each line with the desired host entry
sudo sed -i "${line_number}s/.*/${host_entry} /" /etc/hosts
done <<< "$matches_in_hosts"
else
echo "Adding new hosts entry."
echo "$host_entry" | sudo tee -a /etc/hosts > /dev/null
fi
$2/hev $2/b2.yml # you can define the local socks5 port here 10808 is the default
tunnel:
name: tun0
mtu: 8500
socks5:
port: 10801
address: ::1
udp: 'udp'
misc:
task-stack-size: 20480
connect-timeout: 10000
read-write-timeout: 60000
log-file: stderr
log-level: debug
limit-nofile: 65535
https://github.com/heiher/hev-socks5-tunnel#run
this commands just work in linux how to do this for macos
如题,能修改到WIN下面编译吗
添加支持udp转发
裸露的udp端口
In my vps server , i install softether vpn server that use tap devie with 192.168.24.0/21 subnet . Traffic of this devoce go throuh gateway if eth0 ip.
With some iptables trick can forward tcp to local go simple tunnel and use tls tunnel to coonect to socks server on another vps . Beacuse of many restriction on internet in our country . But mg problem is with udp traffic . How i can forward udp this way . I was test tun2soxks but i cant got it working beacuse when change metrics with way say in exampl , i lost connection to device . Can i do it with hev ?
希望在Apple平台的VPN应用中使用。是否有计划支持。我看您已经添加了mac平台的支持,支持Apple的NetworkExtension会更容易些。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.