V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
githmb
V2EX  ›  程序员

分享一款 Rust 实现的内网穿透工具

  •  1
     
  •   githmb · 233 天前 · 1032 次点击
    这是一个创建于 233 天前的主题,其中的信息可能已经有所发展或是发生改变。

    remote-bind

    https://github.com/rust-net/remote-bind

    Install

    Windows / Linux: releases

    Android: remote-bind-apk

    服务器中继

    在服务器 x.x.x.x1234 端口上运行 server ,并设置密码为 passwd

    $ ./server 1234 passwd
    2023-09-04 00:00:00 - [I] - server/src/main.rs:76 -> Server started on x.x.x.x:1234
    2023-09-04 00:00:00 - [I] - core/src/server.rs:71 -> STUN started on 0.0.0.0:1234
    2023-09-04 00:00:00 - [I] - core/src/server.rs:71 -> STUN started on 0.0.0.0:1235
    

    在局域网主机上运行客户端,将 127.0.0.1:3389 服务映射到 x.x.x.x:13389 上:

    $ ./client x.x.x.x:1234 13389 passwd 127.0.0.1:3389
    2023-09-04 00:00:00 - [I] - client\src\main.rs:97 -> 正在连接服务器:x.x.x.x:1234
    2023-09-04 00:00:00 - [I] - core\src\client.rs:18 -> 正在连接
    2023-09-04 00:00:00 - [I] - core\src\client.rs:20 -> 连接完成
    2023-09-04 00:00:00 - [I] - client\src\main.rs:104 -> 正在绑定端口:13389
    2023-09-04 00:00:00 - [I] - client\src\main.rs:108 -> 服务已绑定: 127.0.0.1:3389 -> x.x.x.x:13389
    

    P2P 直连

    在要进行 P2P 访问的主机上运行客户端,监听 127.0.0.1:9833 地址,映射到 x.x.x.x:13389 上绑定的服务:

    $ ./client p2p x.x.x.x:1234 13389 127.0.0.1:9833
    2023-09-04 00:00:00 - [I] - core\src\client_p2p.rs:27 -> 正在测试
    2023-09-04 00:00:00 - [I] - core\src\client_p2p.rs:29 -> 测试成功
    2023-09-04 00:00:00 - [I] - core\src\client_p2p.rs:31 -> 服务已启动: 127.0.0.1:9833
    

    注意:P2P 无法保证 100%的成功率

    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2842 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 07:05 · PVG 15:05 · LAX 00:05 · JFK 03:05
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.