mr2 帮助你将本地端口暴露在外网.支持 TCP/UDP, 当然也支持 HTTP. Keep it simple, stupid.
$ nami install github.com/txthinking/mr2
NAME: mr2 - Expose local TCP and UDP server to external network USAGE: mr2 [global options] command [command options] [arguments...] VERSION: 20210401 COMMANDS: server Run as server mode client Run as client mode httpsserver Run as https server mode httpsclient Run as https client mode help, h Shows a list of commands or help for one command GLOBAL OPTIONS: --help, -h show help (default: false) --version, -v print the version (default: false)
server
and client
在远程服务器上. 注意防火墙开放所有相关端口的 TCP 和 UDP 协议
$ mr2 server -l :9999 -p password
更多参数: $ mr2 server -h
在本地. 假设你的远程 mr2 server 是1.2.3.4:9999
, 你的本地服务是127.0.0.1:8080
, 你想让远程服务器开放8888
端口
$ mr2 client -s 1.2.3.4:9999 -p password -P 8888 -c 127.0.0.1:8080
更多参数: $ mr2 client -h
现在访问 1.2.3.4:8888
就等于 127.0.0.1:8080
server
and client
$ mr2 client -s 1.2.3.4:9999 -p password -P 8888 -c 127.0.0.1:8080
现在访问 1.2.3.4:8888
就等于 127.0.0.1:8080
$ mr2 client -s 1.2.3.4:9999 -p password -P 8888 -c 127.0.0.1:22
现在访问 1.2.3.4:8888
就等于 127.0.0.1:22
$ ssh -oPort=8888 [email protected]
$ mr2 client -s 1.2.3.4:9999 -p password -P 8888 -c 127.0.0.1:53
现在访问 1.2.3.4:8888
就等于 127.0.0.1:53
$ dig github.com @1.2.3.4 -p 8888
$ mr2 client -s 1.2.3.4:9999 -p password -P 8888 --clientDirectory /path/to/www --clientPort 8080
现在访问 1.2.3.4:8888
就等于 127.0.0.1:8080
, web root 是 /path/to/www
...
httpsserver
and httpsclient
在远程服务器上. 假设你的域名是 domain.com
, 泛域名证书*.domain.com
是 ./domain_com_cert.pem
和 ./domain_com_cert_key.pem
, 想让 HTTPS 监听 443`. 注意防火墙开放任何相关端口的 TCP 协议
$ mr2 httpsserver -l :9999 -p password --domain domain.com --cert ./domain_com_cert.pem --certKey ./domain_com_cert_key.pem --tlsPort 443
更多参数: $ mr2 httpsserver -h
在本地. 假设你的远程 mr2 httpsserver 是 1.2.3.4:9999
, 你的本地 HTTP 1.1 服务是 127.0.0.1:8080
, 想让远程服务器开放子域名 hey
$ mr2 httpsclient -s 1.2.3.4:9999 -p password --serverSubdomain hey -c 127.0.0.1:8080
更多参数: $ mr2 httpsclient -h
现在访问 https://hey.domain.com:443
就等于 http://127.0.0.1:8080
在一些多层 NAT 情况下, 可能 UDP 会失败. 我在本地直接连接 ISP 提供的 Wi-Fi 的情况测试通过.
A project by txthinking
基于 GPLv3 协议开源
1 kekxv 2021-03-26 07:40:32 +08:00 via iPhone 和 nps 对比有什么区别? |
![]() | 2 yorkyoung 2021-03-26 08:47:41 +08:00 和 gost 对比有什么区别? |
3 buxvyaomingzi &bsp; 2021-03-26 09:32:34 +08:00 你这个直接端口映射有区别吗? |
![]() | 4 Acoffice 2021-03-26 09:53:46 +08:00 和 frp 对比有什么区别? |
![]() | 5 Acoffice 2021-03-26 09:53:58 +08:00 和 goproxy 对比有什么区别? |
![]() | 6 thisismr2 OP PRO @kekxv :B 不完全了解, 我也不知道具体有啥区别, 可能有 原生的 UDP 支持, 只需一条命令 或 支持泛域名证书吧 |
![]() | 8 thisismr2 OP PRO @buxvyaomingzi 路由器上吗, 很多人应该没有外网 IP, 运营商不给 |
![]() | 9 thisismr2 OP PRO @Acoffice https 那块好像有点区别, mr2 客户端不需要关心证书. 这个功能根据我们团队内部使用经验刚开源 |
![]() | 10 dk7952638 2021-03-26 16:44:21 +08:00 名字是老二的意思? |
11 snuglove 2021-03-26 16:55:47 +08:00 nps 好用. |