【软件简介】
内网穿透,支持服务器中继和基于quic的P2P直连两种模式
【开原地址】
Github: https://github.com/rust-net/remote-bind
【使用说明】
1.服务器中继
在服务器 x.x.x.x 的 1234 端口上运行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
2.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
【docker部署】
服务端:
docker run -d --name="rbs" --net="host" --restart="always" imgxx/remote-bind server [port] [password]
客户端:
docker run -d --name="rbc" --net="host" --restart="always" imgxx/remote-bind client [server:port] [bind_port] [password] [local_service:port] # 通过服务端中继的方式
docker run -d --name="rbc" --net="host" --restart="always" imgxx/remote-bind client p2p [server:port] [bind_port] [local_listen:port] # 通过P2P连接的方式
oneport:
docker run -d --name="oneport" --net="host" --restart="always" -v ./config.yml:/config.yml imgxx/remote-bind oneport -c /config.yml
config.yml:
config:
# 监听地址
listen: 0.0.0.0:1111
# 热重启接口
# api: 127.0.0.111:11111
rules:
# 字符串匹配
- rule: GET /oneport/status
address: 127.0.0.111:11111
# 首字节匹配
- rule: 3
address: 127.0.0.1:3389
# 多字节匹配
- rule: [0x53, 0x53]
address: 127.0.0.1:22
# 内置规则
- rule: $SSH
address: 127.0.0.1:22
# 内置规则可能是多个规则的集合,比如 $HTTP 匹配 GET、POST 等多个字符串
- rule: $HTTP
address: 127.0.0.1:80
# 通配规则
- rule: []
address: 127.0.0.1:4444
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。

评论(0)