AnyTunnel
Tunneling Anywhere (Behind NAT)
Usage
You'll need a LeanCloud account (free). Its
realtime messaging service is used during the UDP hole punching process.
npm -g install anytunnel
Server
anytunnel \
-r [leancloud region] \
-a [leancloud appId] \
-s [serverId] \
-L kcp://localhost:[port1]
Client
anytunnel \
-c \
-r [leancloud region] \
-a [leancloud appId] \
-s [serverId] \
-F kcp://localhost:[port2] \
-L socks://localhost:[port3]
The commands above will setup a socks5 proxy listening at port3
on the
client, forwarding packets to the server.
The serverId
, port1
, port2
options are arbitrary. Also, you can
specify any -F / -L options accepted by
gost as long as there is
- a -L kcp option on the server
- a -F kcp option on the client
AnyTunnel forwards UDP packets according to these two options.
Credits
-
gost (GO Simple Tunnel) provides
proxy functions, especially KCP
over UDP tunneling.
-
LeanCloud provides realtime signaling
service.
-
stun for stun packets parsing,
the result is then signaled to peers.
-
exit-hook for on-exit
cleanup (killing the gost child process)
-
commander for command line
options parsing