heiher/hev-socks5-tunnel

line 3: syntax error: unexpected "|" (expecting ")")

Closed this issue · 7 comments

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 ")")

heiher commented

try to download pre-compiled executable in browser and run with default config file at conf/main.yml.

Thanks, i have cross compiled it to OpenWrt. Now trying to test it with Xray-core and always gets Segmentation fault error, where to look?

[2023-02-17 03:16:25] [E] 0xc3a910 socks5 client res.rep 7 [2023-02-17 03:16:25] [E] 0xc3a910 socks5 session handshake [2023-02-17 03:16:26] [E] 0xc3a910 socks5 client res.rep 7 [2023-02-17 03:16:26] [E] 0xc3a910 socks5 session handshake [2023-02-17 03:16:28] [E] 0xc3aff0 socks5 client res.rep 7 [2023-02-17 03:16:28] [E] 0xc3aff0 socks5 session handshake [2023-02-17 03:16:31] [E] 0xc3b250 socks5 client res.rep 7 [2023-02-17 03:16:31] [E] 0xc3b250 socks5 session handshake [2023-02-17 03:16:31] [E] 0xc3a910 socks5 client res.rep 7 [2023-02-17 03:16:31] [E] 0xc3a910 socks5 session handshake [2023-02-17 03:16:31] [E] 0xc3b910 socks5 client res.rep 7 [2023-02-17 03:16:31] [E] 0xc3b910 socks5 session handshake [2023-02-17 03:16:32] [E] 0xc3bcb0 socks5 client res.rep 7 [2023-02-17 03:16:32] [E] 0xc3bcb0 socks5 session handshake Segmentation fault

heiher commented

I need more details to reproduce about openwrt version/cpu arch, socks5 server and socks5-tunnel commit id.

OpenWrt 21.02 based on latest kernel 5.4.230, CPU x86/64 Intel Celeron 5095A.
PKG_VERSION:=2.4.3
PKG_SOURCE_VERSION:=e3d7c37346aa120187fef3fe844fbf1d573a1080
https://github.com/XTLS/Xray-core/releases/tag/v1.7.5
(socks5 inbound)

{ "tag": "all", "listen": "127.0.0.1", "port": 1080, "protocol": "socks", "settings": { "auth": "noauth", "udp": true, "ip": "127.0.0.1" }, "streamSettings": { "sockopt": { "mark": 255 } } }

I have figure out that problems only over WiFi connected clients (xjasonlyu/tun2socks have no such issues).
And still have very poor speeds even on LAN on download ( < 20 MB/s VS xjasonlyu/tun2socks — 190 MB/s).
Upload is almost same as on xjasonlyu/tun2socks.

heiher commented

Thanks for your info.

First of all, I suggest you try to use hev-socks5-tunnel (head commit of master branch) and enable udp in udp in config file to avoid this error:

[E] 0xc3a910 socks5 client res.rep 7

socks5:
  udp: udp

And then, This is an interesting question! I probably can't figure out why until I reproduce it. I have tested hev-socks5-tunnel (master) on x86-64 using xray (v1.7.5) as server and everything looks well:

xray config:

{
  "log": {
    "loglevel": "warning"
  },
  "inbounds": [
    {
      "tag": "socks-in",
      "protocol": "socks",
      "listen": "0.0.0.0",
      "port": 1080,
      "settings": {
        "auth": "noauth",
        "udp": true,
        "ip:": "192.168.0.8"
      }
    }
  ],
  "outbounds": [
    {
      "tag": "direct",
      "protocol": "freedom"
    }
  ]
}
Client <-------- 1Gbps ----------> Server
  • Upload
iperf3 -c 192.168.0.8
[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-10.00  sec  1.08 GBytes   926 Mbits/sec    0             sender
[  5]   0.00-10.04  sec  1.08 GBytes   920 Mbits/sec                  receiver
  • Download
iperf3 -c 192.168.0.8 -R
[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-10.04  sec  1.09 GBytes   934 Mbits/sec    0             sender
[  5]   0.00-10.00  sec  1.08 GBytes   928 Mbits/sec                  receiver

At last, The Android VPN client based on hev-socks5-tunnel(master) looks well too with xray v1.7.5 over WiFi connection:

https://github.com/heiher/sockstun

I have make all setting as yours (just outbound is different), and re-compile binary from latest master branch, still:

  1. Have slow and unstable download speed;
  2. UDP is not passed to Xray (just blocked);
  3. Still have "[E] 0x240a850 socks5 client res.rep 7";
  4. If clients connects to OpenWrt router through WiFi, i have "Segmentation fault" in few seconds.

With xjasonlyu/tun2socks i have no any of this issues, but it take very much CPU resources and maximum speed is degraded if using ARM device. So — your program is very interesting for me.

I can share my setup for you through Anydesk, can i find you in any messenger?

heiher commented

Thanks for help debugging on your devices, Please let me know if you have any other questions.