Total Pageviews

Wednesday, 31 July 2019

一个基于go的http代理服务器程序:http-proxy-by-lautrond

A very simple http proxy example wrote in Golang.

from https://github.com/LauTrond/http-proxy
-----

我的补充说明:
在linux vps上。先搭建go环境。然后,
cd $GOPATH
go get -u -v github.com/LauTrond/http-proxy

(在$GOPATH/bin/里面就会生成可执行文件http-proxy)

/root/go/gopath/bin/http-proxy -listen 127.0.0.1:7080

意思是仅允许vps上的程序连接7080端口。

nano /etc/systemd/system/http-proxy.service
内容如下:
[Unit]
After=network.target

[Service]
ExecStart=/root/go/gopath/bin/http-proxy -listen 127.0.0.1:7080
Restart=always

[Install]

WantedBy=multi-user.target

然后,
systemctl start http-proxy
systemctl enable http-proxy

这个http-proxy可用做各类tunnel程序的后端。比如kcptun的后端:

No comments:

Post a Comment