Total Pageviews

Friday, 18 October 2019

一个socks代理服务器程序:firefly-proxy-server

登陆linux vps.
首先安装go环境,然后,
cd $GOPATH
go get -u -v github.com/yinghuocho/firefly-proxy/server/
which server
/root/go/gopath/bin/server
mv /root/go/gopath/bin/server /root/go/gopath/bin/firefly-proxy-server

[root@hs gopath]# cd ~
[root@hs ~]# firefly-proxy-server -h
Usage of firefly-proxy-server:
  -cert-file string
        https certificate
  -http-addr string
        http server address (default ":80")
  -https-addr string
        https server address
  -key-file string
        https key file
  -local-socks-addr string
        SOCKS server address (default "127.0.0.1:10800")
  -logfile string
        file to record log
  -pidfile string
        file to save process id
[root@hs ~]#
[root@hs ~]# firefly-proxy-server -http-addr :90 -local-socks-addr 127.0.0.1:10801
2019/10/18 16:22:47 SOCKS server listens on 127.0.0.1:10801
2019/10/18 16:22:47 HTTP server listens on :90

在vps的127.0.0.1:10801上,就建立了一个socks proxy server. 可以利用systemd把
firefly-proxy-server -http-addr :90 -local-socks-addr 127.0.0.1:10801运行为service:
nano /etc/systemd/system/firefly-proxy-server.service
其内容为:
[Unit]
After=network.target

[Service]
ExecStart=/root/go/gopath/bin/firefly-proxy-server -http-addr :90 -local-socks-addr 127.0.0.1:10801
Restart=always

[Install]
WantedBy=multi-user.target


然后,运行:
systemctl start  firefly-proxy-server
systemctl enable  firefly-proxy-server
这个socks代理服务器程序搭建完成。

这个socks代理服务器程序可用作tunnel程序的后端程序。

项目地址:https://github.com/yinghuocho/firefly-proxy/tree/master/server