mullvad / udp-over-tcp

Proxy UDP traffic over a TCP stream
Apache License 2.0
377 stars 61 forks source link

使用真tcp协议传输udp数据包,实测支持wireguard #50

Open hjfxyz opened 11 months ago

hjfxyz commented 11 months ago

https://github.com/mullvad/udp-over-tcp 适用于UDP被限速,TCP不限速,且udp2raw无效果,并且需要全局的真V-P-N。用wireguard是因为轻量且快速。

Ubuntu下编译 git clone https://github.com/mullvad/udp-over-tcp.git cd udp-over-tcp apt install cargo -y ./build-static-bins.sh 编译好之后,拿走所需的可执行文件,其余可删除 mv target/x86_64-unknown-linux-gnu/release/tcp2udp /usr/local/bin/tcp2udp mv target/x86_64-unknown-linux-gnu/release/udp2tcp /usr/local/bin/udp2tcp

在安装wireguard的vps(vps的公网IP为128.1.2.3)上运行tcp2udp,监听tcp端口4567,转发到wireguard的udp端口55555,命令如下。(后台运行使用systemd、supervisor、screen之类自己搞。) tcp2udp --tcp-listen 0.0.0.0:4567 --udp-bind=127.0.0.1 --udp-forward 127.0.0.1:55555 --tcp-recv-timeout=130 --nodelay

在中转的vps(例:本地VMware开Ubuntu虚拟机,IP为192.168.9.9)上运行udp2tcp,监听udp端口8910,转发到安装wireguard的vps端口4567 udp2tcp --udp-listen 0.0.0.0:8910 --tcp-forward 128.1.2.3:4567 --tcp-recv-timeout=130 --nodelay

wireguard客户端连接到192.168.9.9端口8910即可

或许可以搭配https://github.com/cbeuw/Cloak 使用,尚未实测。

chainofhonor commented 10 months ago

感谢 这个教程简单明了 一下就会了

编译的时候尽量用Ubuntu 我最开始用rockylinux8编译失败

delphinuz commented 5 months ago

./build-static-bins.sh Updating crates.io index error: failed to select a version for env_logger. ... required by package udp-over-tcp v0.4.0 (/root/udp-over-tcp) versions that meet the requirements ^0.11.3 (locked to 0.11.3) are: 0.11.3

请问怎么修正这个编译错误呢?谢谢