可以将公网(WAN)主机流量转到内网(LAN)主机的反向代理工具库,实现了内网穿透。采用多链接+配对的方式实现,支持TCP、HTTP、SSH协议等。
A reverse proxy tool which can let WAN server's data flows to LAN server. support TCP, HTTP, SSH or others protocol based on TCP.
Prepare a WAN server and a LAN server. Follow the steps on both of servers.
- Download and install
Node.js(>=12.0.0)
. - Install
damproxy
$ npm i damproxy -g
Simple usage, forward data from port 80 and 443 to LAN server:
$ damproxy listen --forward-ports 80 443
Full options:
$ damproxy listen --host 0.0.0.0 --port 8991 --pwd mypassword --forward-ports 80@17080 443@17443
Host for LAN server connection, default 0.0.0.0
.
Port for LAN server connection, default 8991
.
Set the password to identify LAN server. Should less than 32 characters.
Specify the port that will receive data from real client, then it will forward to the LAN server via the secondary port as outbound port. 80@17080 means receive data from 80 and forward to LAN server that output via 17080. Defaults the secondary port will automatically provided. May specify it in whitelist situation.
Simple usage, connect to WAN server
$ damproxy connect --host x.x.x.x --forward-ports 80
Full options:
$ damproxy connect --host x.x.x.x --port 8991 --pwd mypassword --forward-ports 80 443@20443 22@192.168.0.102:22
WAN server's host to connect.
WAN server's port to connect, default 8991
.
Send the password to WAN server. Should less than 32 characters.
Whitelist of forwarding port and specify a redirect address. It formed by A@B:C which means allowing data from WAN server's port A and send it to B:C. 80
equivalent to 80@127.0.0.1:80
and 80:8080
equivalent to 80@127.0.0.1:8080
.