前提是安装了Golang的Linux环境
- 下载
https://github.com/inconshreveable/ngrok/archive/refs/heads/master.zip - 解压ngrok-master.zip
- 执行如下命令
export NGROK_DOMAIN="修改为你自己的域名"
cd /ngrok-master
openssl genrsa -out rootCA.key 2048
openssl req -x509 -new -nodes -key rootCA.key -subj "/CN=$NGROK_DOMAIN" -days 5000 -out rootCA.pem
openssl genrsa -out device.key 2048
openssl req -new -key device.key -subj "/CN=$NGROK_DOMAIN" -out device.csr
openssl x509 -req -in device.csr -CA rootCA.pem -CAkey rootCA.key -CAcreateserial -out device.crt -days 5000
cp rootCA.pem assets/client/tls/ngrokroot.crt
cp device.crt assets/server/tls/snakeoil.crt
cp device.key assets/server/tls/snakeoil.key
make release-server
GOOS=linux GOARCH=386 make release-client
GOOS=linux GOARCH=amd64 make release-client
GOOS=windows GOARCH=386 make release-client
GOOS=windows GOARCH=amd64 make release-client
GOOS=darwin GOARCH=386 make release-client
GOOS=darwin GOARCH=amd64 make release-client
GOOS=linux GOARCH=arm make release-client
编译成功后在当前目录的bin目录下可找到ngrokd(服务端)文件和客户端在windows,linux等文件夹中
- 服务端启动命令:
./bin/ngrokd -domain="$NGROK_DOMAIN" -tunnelAddr=":4443" - 客户端配置文件中:
server_addr: “修改为你自己的域名:4443”
|