Mr.2 可以帮你将本地的服务暴露到外网供访问,支持 TCP/UDP, 当然也包括 HTTP.
Server
$ mr2 server -l :9999 -p password
Client
# Local server is 127.0.0.1:1234, expect to expose: server_address:5678
$ mr2 client -s server_address:port -p password -P 5678 -c 127.0.0.1:1234
# Local web root is /path/to/www, expect to expose: server_address:5678
$ mr2 client -s server_address:port -p password -P 5678 --clientDiretory /path/to/www
示例
访问局域网 HTTP 服务
$ mr2 client -s server_address:port -p password -P 5678 -c 127.0.0.1:8080
# then
Your HTTP server in external network is: server_address:5678
SSH 访问本地机器
$ mr2 client -s server_address:port -p password -P 5678 -c 127.0.0.1:22
# then
$ ssh -oPort=5678 user@server_address
访问本地 DNS 服务器
$ mr2 client -s server_address:port -p password -P 5678 -c 127.0.0.1:53
# then
Your DNS server in external network is: server_address:5678
$ dig github.com @server_address -p 5678
通过 HTTP 访问本地目录:
$ mr2 client -s server_address:port -p password -P 5678 --clientDirectory /path/to/www
# then
A HTTP server in external network is: server_address:5678