p2p_tun 一种基于kcptun的p2p双向代理软件
1使用方法
a)拥有公网ip(如2.3.3.3)的服务器运行 ./p2pserver -l “:4000”
b)局域网设备A运行 ./p2pclient -r “2.3.3.3:4000” -l “:1022” -t “localhost:22”
c)局域网设备B运行 ./p2pclient -r “2.3.3.3:4000” -l “:1022” -t “localhost:22”
公网服务器实现打洞,p2p成功后设备A和设备B直接通信,访问设备A的1022端口就等价于访问设备B的22端口,反过来也一样。
2原理
a)NAT打洞技术
https://www.cnblogs.com/GO-NO-1/p/7241556.html
b)kcptun
https://github.com/xtaci/kcptun