mirror of
https://github.com/snail007/goproxy.git
synced 2026-04-27 16:35:49 +03:00
[GH-ISSUE #491] 多IP服务器UDP功能异常 #394
Labels
No labels
TODO
bug
duplicate
enhancement
good first issue
help wanted
helpful
invalid
need-confirm
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/goproxy#394
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Raymond-C on GitHub (Jun 26, 2022).
Original GitHub issue: https://github.com/snail007/goproxy/issues/491
多IP服务器,通过 --bind-ip 绑定出口IP,但实际使用时,发现只有主IP能使用UDP协议。而其他IP只能使用TCP协议。
Expected Behavior
多IP服务器内的所有IP都可以支持TCP/UDP流量
Current Behavior
只有主IP同时支持TCP/UDP流量,非主IP仅支持TCP流量
Possible Solution
Steps to Reproduce
Context (Environment)
例子中隐去实际IP,主IP用 212.212.212.212 代替,子 IP 段使用 247.247.247.12 代替,客户端IP用 191.191.191.253 代替
root@vz:~# proxy sps --udp -p :6666 --bind-ip 247.247.247.12:6666
2022/06/26 06:18:13.926036 INFO binding 247.247.247.12 for 6666
2022/06/26 06:18:13.926094 INFO init ss local cipher, aes-256-cfb, sspassword
2022/06/26 06:18:13.926265 INFO ss udp disabled
2022/06/26 06:18:13.926276 INFO tcp sps on [::]:6666
2022/06/26 06:18:18.918343 INFO your machine code is : XXXXXXXXXXXXXXXXXXXXXXXX
2022/06/26 06:18:18.918373 INFO checking ...
2022/06/26 06:18:18.932525 INFO binding 247.247.247.12 for 6666
2022/06/26 06:18:19.252370 INFO check success, your machine will expired at 2023-06-20 06:47:19
#以下为使用主IP连接时的测试情况
2022/06/26 06:18:23.937701 INFO binding 247.247.247.12 for 6666
2022/06/26 06:18:28.943881 INFO binding 247.247.247.12 for 6666
2022/06/26 06:18:30.415316 INFO ip 191.191.191.253 rate, current: 1/s, max: 20/s
2022/06/26 06:18:30.415351 INFO outgoing ip is: 247.247.247.12, for 212.212.212.212:6666
2022/06/26 06:18:30.482791 INFO conn 191.191.191.253:35569 - 104.193.88.77:80 connected [www.baidu.com:80]
2022/06/26 06:18:31.869106 INFO s5 udp on [::]:52746
2022/06/26 06:18:32.102434 INFO conn 191.191.191.253:35569 - 104.193.88.77:80 released [www.baidu.com:80]
2022/06/26 06:18:33.949338 INFO binding 247.247.247.12 for 6666
2022/06/26 06:18:34.842252 WARN connect to tcp parent fail, ERR:read auth info fail,ERR: read tcp 212.212.212.212:6666->119.60.104.215:53236: read: connection reset by peer from 119.60.104.215:53236
2022/06/26 06:18:38.955678 INFO binding 247.247.247.12 for 6666
2022/06/26 06:18:43.960872 INFO binding 247.247.247.12 for 6666
2022/06/26 06:18:48.966153 INFO binding 247.247.247.12 for 6666
#以下为使用子IP连接时的测试情况
2022/06/26 06:19:24.005743 INFO binding 247.247.247.12 for 6666
2022/06/26 06:19:29.012340 INFO binding 247.247.247.12 for 6666
2022/06/26 06:19:34.017433 INFO binding 247.247.247.12 for 6666
2022/06/26 06:19:39.022655 INFO binding 247.247.247.12 for 6666
2022/06/26 06:19:43.081951 INFO ip 191.191.191.253 rate, current: 1/s, max: 20/s
2022/06/26 06:19:43.081990 INFO outgoing ip is: 247.247.247.12, for 247.247.247.12:6666
2022/06/26 06:19:43.525221 INFO conn 191.191.191.253:35956 - 104.193.88.123:80 connected [www.baidu.com:80]
2022/06/26 06:19:44.029176 INFO binding 247.247.247.12 for 6666
2022/06/26 06:19:44.733472 INFO s5 udp on [::]:43716
2022/06/26 06:19:44.965335 INFO conn 191.191.191.253:35956 - 104.193.88.123:80 released [www.baidu.com:80]
2022/06/26 06:19:48.410577 INFO s5 udp on [::]:39659
2022/06/26 06:19:49.034397 INFO binding 247.247.247.12 for 6666
2022/06/26 06:19:52.075429 INFO s5 udp on [::]:51154
2022/06/26 06:19:54.039378 INFO binding 247.247.247.12 for 6666
2022/06/26 06:19:55.754057 INFO s5 udp on [::]:54372
2022/06/26 06:19:59.045615 INFO binding 247.247.247.12 for 6666
2022/06/26 06:19:59.401750 INFO s5 udp on [::]:57809
Detailed Description
以下log对应 sstap 连接测试截图


Possible Implementation
@snail007 commented on GitHub (Jun 27, 2022):
多IP,-p参数必须指定IP,有多少IP指定多少IP,不指定IP就只有主IP支持UDP,比如 -p 192.168.0.2 :6666 -p 192.168.0.3 :6666 .
@Raymond-C commented on GitHub (Jun 29, 2022):
找一台绑了2个IP的机器进行测试,结果:
如果是通过goproxy转发到已经起好的父级服务,就没问题;
如果靠goproxy本身去起服务,就无法使用子IP进行UDP数据传输
测试1:
命令:proxy sps --udp -p 192.168.168.1:6666 -p 192.168.168.2:6666 --bind-ip 192.168.168.2:6666
结果:启动报错
log:2022/06/29 22:57:15.865826 proxy/main.go:86 ERROR err : flag 'local' cannot be repeated
测试2:
命令:proxy sps --udp -p 192.168.168.1:6666,192.168.168.2:6666 --bind-ip 192.168.168.2:6666
结果:和issue描述的问题一致,log也一样
通过主IP连接可以使用 TCP/UDP。但是UDP的出口IP为主IP;通过子IP连接只能使用TCP
测试3:
命令:1、先用 v2ray 起一个支持UDP的socks5,服务 端口 8888,绑定子IP 192.168.168.2 作为outbound
2、连接 8888 端口测试,可以同时使用TCP/UDP,且UDP端口为 192.168.168.2
3、起goproxy服务 proxy sps -p :6666 --udp -P socks5://127.0.0.1:8888
结果:通过主IP或者子IP都可以连接,且使用 TCP/UDP,UDP出口IP为 192.168.168.2
日志: