All Projects → LubyRuffy → Tcptunnel

LubyRuffy / Tcptunnel

将本地内网服务器映射到公网。

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to Tcptunnel

Lanproxy
lanproxy是一个将局域网个人电脑、服务器代理到公网的内网穿透工具,支持tcp流量转发,可支持任何tcp上层协议(访问内网网站、本地支付接口调试、ssh访问、远程桌面、http代理、https代理、socks5代理...)。技术交流QQ群 678776401
Stars: ✭ 4,784 (+6544.44%)
Mutual labels:  frp, proxy, reverse-proxy, tunnel, nat, ngrok
Frp
A fast reverse proxy to help you expose a local server behind a NAT or firewall to the internet.
Stars: ✭ 51,746 (+71769.44%)
Mutual labels:  frp, proxy, reverse-proxy, tunnel, nat
Spike
📣 A fast reverse proxy written in PHP that helps to expose local services to the internet
Stars: ✭ 582 (+708.33%)
Mutual labels:  proxy, reverse-proxy, tunnel, nat
Fasttunnel
NAT 内网穿透 远程内网计算机 域名访问内网站点 反向代理内网服务 花生壳 端口转发 http代理 微信 小程序 expose a local server behind a NAT or firewall to the internet like ngrok and frp. NAT ssh proxy tunnel reverse-proxy
Stars: ✭ 248 (+244.44%)
Mutual labels:  proxy, reverse-proxy, tunnel, nat
Lunnel
fast reverse-proxy
Stars: ✭ 293 (+306.94%)
Mutual labels:  proxy, reverse-proxy, tunnel, ngrok
anytunnel
内网穿透,内网穿透代理服务器,商用内网穿透代理系统,内网穿透平台,内网穿透多用户会员系统。
Stars: ✭ 115 (+59.72%)
Mutual labels:  tunnel, nat, reverse-proxy, frp
Frpc Android
Android,安卓版frpc,一个快速反向代理,可帮助您将NAT或防火墙后面的本地服务器暴露给Internet。
Stars: ✭ 205 (+184.72%)
Mutual labels:  frp, proxy, tunnel, nat
Sidedoor
SSH connection daemon for Debian/Raspbian/Ubuntu/etc
Stars: ✭ 97 (+34.72%)
Mutual labels:  proxy, reverse-proxy, tunnel, nat
Awesome Network Stuff
Resources about network security, including: Proxy/GFW/ReverseProxy/Tunnel/VPN/Tor/I2P, and MiTM/PortKnocking/NetworkSniff/NetworkAnalysis/etc。More than 1700 open source tools for now. Post incoming.
Stars: ✭ 578 (+702.78%)
Mutual labels:  proxy, reverse-proxy, tunnel
Gateway Go
🎁GateWay Client for OpenIoTHub[云易连访问内网端口和设备的网关]
Stars: ✭ 127 (+76.39%)
Mutual labels:  frp, tunnel, nat
Python Proxy
HTTP/HTTP2/HTTP3/Socks4/Socks5/Shadowsocks/ShadowsocksR/SSH/Redirect/Pf TCP/UDP asynchronous tunnel proxy implemented in Python 3 asyncio.
Stars: ✭ 692 (+861.11%)
Mutual labels:  proxy, tunnel, nat
Xfrps
xfrps fork from frp but mainly use its server side feature and cooperate with xfrp
Stars: ✭ 179 (+148.61%)
Mutual labels:  frp, reverse-proxy, nat
Inlets Pro
Secure TCP and HTTP tunnels that work anywhere
Stars: ✭ 179 (+148.61%)
Mutual labels:  proxy, tunnel, nat
Server Go
🎨OpenIoTHub Server[内网穿透和物联网设备管理服务器]
Stars: ✭ 127 (+76.39%)
Mutual labels:  frp, tunnel, nat
tunman
Comprehensive solution for SSH tunnels - respawning, healthchecking/monitoring
Stars: ✭ 43 (-40.28%)
Mutual labels:  tunnel, nat, reverse-proxy
Otunnel
peer-to-peer tunnel tool
Stars: ✭ 224 (+211.11%)
Mutual labels:  proxy, reverse-proxy, tunnel
Openiothub
💖A free IoT (Internet of Things) platform and private cloud. [一个免费的物联网和私有云平台,支持内网穿透]
Stars: ✭ 371 (+415.28%)
Mutual labels:  frp, tunnel, nat
Pyngrok
A Python wrapper for ngrok
Stars: ✭ 159 (+120.83%)
Mutual labels:  reverse-proxy, tunnel, ngrok
FastTunnel
expose a local server to the internet. 高性能跨平台的内网穿透解决方案 远程内网计算机 域名访问内网站点 反向代理内网服务 端口转发 http代理
Stars: ✭ 815 (+1031.94%)
Mutual labels:  tunnel, nat, reverse-proxy
Proxy admin free
Proxy是高性能全功能的http代理、https代理、socks5代理、内网穿透、内网穿透p2p、内网穿透代理、内网穿透反向代理、内网穿透服务器、Websocket代理、TCP代理、UDP代理、DNS代理、DNS加密代理,代理API认证,全能跨平台代理服务器。
Stars: ✭ 487 (+576.39%)
Mutual labels:  frp, proxy, nat

tcptunnel

用于两种场景:

  1. 直接的端口转发,这个好理解
  2. 做内网服务器到公网的映射访问,用于解决内网服务器没有公网IP或者无法进行端口映射的场景

想要完成ngrok和lcx等类似的功能,对于lcx定义的slave啊,listen啊,tran啊我觉得很大歧义,半天理解不了。所以我发明了三个简单易懂的连接方式:

  • 公网服务器: publicserver,用于做转发的,监听一个对外开放的端口就行(对,我这里只要一个端口就行)
  • 内网服务器:natserver,也就是实际希望被外网访问的局域网服务器(或者是局域网代理)
  • 客户端:client,连接客户端,这个很好理解,实际的访问者,本地启动后,通过其他客户端连接本地监听的端口就相当于访问内网服务器

是不是更容易理解?是的话直接夸我。

注意:没有经过大量实际测试,请谨慎用于生产环境。

编译

由于用到了1.9才有的sync.Map, 所以编译环境必须是1.9+,见谅见谅 ;)

git clone https://github.com/LubyRuffy/tcptunnel
go get
go build

生成tcptunnel文件

跨平台编译,比如到NAS服务器或者树莓派等ARM平台,执行:

GOOS=linux GOARCH=arm GOARM=5 go build

运行

直接执行是读取config.toml配置文件中的内容,最主要的是Mode和对应的配置内容,后续在配置文件中说明。

./tcptunnel 

作为内网映射运行:

  • 作为publciserver执行,放到公网服务器
./tcptunnel -m publicserver
  • 作为natserver执行,放到内网的服务器
./tcptunnel -m natserver
  • 作为client执行,放到需要访问内网服务器的客户端
./tcptunnel -m client

然后连接本地端口就相当于连接natserver里面对应的服务器了

natserver 和 client 通信是通过约定好一致的唯一ID来进行。

作为tcpproxy执行,也就是端口转发

./tcptunnel -m tcpproxy

配置文件说明

默认读取config.toml文件,

# 模式: 支持publicserver,natserver,client,tcpproxy。可以通过命令行的-m参数覆盖
Mode = "publicserver"

# 连接公网服务器的地址,格式为 host:port
# 在Mode为 natserver 和 clientconnect 时有效
PublicServerAddr = "127.0.0.1:10011"

# 端口转发模式,仅仅在Mode为 tcpproxy 时有效
[TcpProxies]
    # 数组,可以多个映射关系
    [TcpProxies.proxy80]
    LocalBindAddr = "127.0.0.1:1234"
    RemoteServerAddr = "192.168.1.1:80"
    Type = "http"

    [TcpProxies.proxy22]
    LocalBindAddr = "127.0.0.1:1235"
    RemoteServerAddr = "192.168.1.1:22"

# 公网服务器监听的地址,仅仅在Mode为 publicserver 时有效,格式为 ip:port
[PublicServer]
LocalBindAddr = "127.0.0.1:10011"

# 端口转发模式,仅仅在Mode为 natserver 时有效
[NatServer]
    # 数组,可以多个映射关系,ID用于注册,客户端连接的时候直接通过ID来进行查找
    [NatServer.test]
    RemoteServerAddr = "192.168.1.1:80"
    ID = "test"
    Type = "http"

    [NatServer.test1]
    RemoteServerAddr = "192.168.1.1:22"
    ID = "test1"
    
# 端口转发模式,仅仅在Mode为 client 时有效
[ClientConnect]
    # 数组,可以多个映射关系,ID用于标示连接时指定NAT后的服务器对象
    [ClientConnect.test]
    LocalBindAddr = "127.0.0.1:1234"
    ID = "test"

流程说明

natserver    REGISTER   -> publicserver
                           publicserver <- CONNECT client <- application tcp connect
natserver NEWDATASTREAM <- publicserver
natserver   DATASTREAM  -> publicserver
                           publicserver -> 200 OK client <-> application tcp connect
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].