gost tunnel的使用
用过了好几个 tunnel 工具软件,各有长处。 ghostunnel 是支持自定义 tls 证书加密的,这回用个更厉害的,支持各种代理链条的,gost 项目地址:https://github.com/ginuerzh/gost 里面的概念有点意思,其实就两条,-L 本地监听,-F 链条转发。 注意的就一点,-F 的时候实际是一个中转服务器。这个中转服务器要转发的规则需要在 -L 参数里指定。 那么举个具体的例子: 中转服务器开了一个明文端口 9999,这个端口跑的是 ghostunnel client,加密数据后传到另外一个ghostunnel server服务器,然后数据明文穿出,访问具体的目的网站的端口。 客户端的服务器呢无外网访问权限,需要访问中转服务器 192.168.1.1 的 9999 端口,然后数据通过 ghostunnel 加密穿出到外网。 中转服务器配置如下: # ghostunnel 监听本地环回地址的9999端口,TLS 加密穿越到外网110.114.5.19:9999,然后根据外网 server 里面的配置,到达最终目的地 ip 和 端口 ghostunnel client --listen localhost:9999 --target 110.114.5.19:9999 --keystore client.pem --cacert ca.pem --unsafe-listen # gost 监听本地网卡192.168.1.1的9999端口 gost-linux-amd64-2.11.1 -L=tls://192.168.1.1:9999 客户端配置如下: gost-linux-amd64-2.11.1 -L=tcp://localhost:9999/localhost:9999 -F=tls://192.168.1.1:9999 这样客户端的程序,只要连接 localhost:9999 的 tcp 端口,就可以接力中转服务器穿出去了。 上面的配置非常怪异吧,仔细解释一下: 中转服务器呢有两个地址,localhost的环回地址,以及本地网卡192.168.1.1 localhost:9999 是用 ghostunnel 加密 tcp 流量,tls 穿到外网 110.114.5.19 的 9999 端口,然后外网再转发。 ...