heiher / hev-socks5-tunnel

A high-performance tun2socks for Linux/Android/FreeBSD/macOS/iOS/WSL2 (IPv4/IPv6/TCP/UDP)
MIT License
651 stars 132 forks source link

socks5不通,通过抓包发现发的包也跟s5协议标准对不上。 #68

Closed tovasLuo closed 7 months ago

tovasLuo commented 7 months ago

详细说下我的部署方式:

tovasLuo commented 7 months ago

本机10800端口上部署了s5server。就是xray的客户端。xray链接到远端服务器。然后部署hev-socks5-tunnel, 配置文件:

tunnel:
  # Interface name
  name: tun0
  # Interface MTU
  mtu: 1500
  # Multi-queue
  multi-queue: false
  # IPv4 address
  ipv4: 172.30.34.1
  # IPv6 address
  ipv6: 'fc00::1'

socks5:
  # Socks5 server port
  port: 10800
  # Socks5 server address (ipv4/ipv6)
  address: 127.0.0.1
  # Socks5 UDP relay mode (tcp|udp)
  udp: 'udp'

路由: 0: from all lookup local 10: from all fwmark 0x438 lookup main 20: from 172.30.34.1 lookup 20 32766: from all lookup main 32767: from all lookup default

接收使用curl --interface tun0 www.google.com,在10800端口上收到s5握手包 050100050100019df00f080050 10800回包0500(无密码)后面就不对了。不知道我哪里部署的不对。附上抓包文件: test.zip

heiher commented 7 months ago

看上去是服务端对TCP流处理的实现有问题,客户端合并发送请求时服务端不继续响应。

tovasLuo commented 7 months ago

没问题。最开始没看出来,这是个合并发包。多谢回复。另外关于dns问题,比如google域名污染了,直接隧道访问google,不会转换成标准的s5 connect domian 05010003。而是转换成了s5的connect ip。本地请求了dns解析。

heiher commented 7 months ago

Tun方式默认不干预DNS服务的情况下,就是在客户端完成域名解析的,而不是Socks5协议的服务端域名地址解析。对于域名污染问题,一个可行的解决方法是在客户端系统上使用没有污染的域名解析服务,并且通过Tun来访问这个服务。

heiher commented 4 months ago

如果之前遇到因写合并导致与Socks5服务端不兼容问题,请尝试 2.6.6 版本:

https://github.com/heiher/hev-socks5-tunnel/releases/tag/2.6.6

2.6.6版本开始支持流水化Socks5握手开关(请求写合并),且默认关闭。