Pages

Saturday, 14 November 2015

用goproxy-by-alienero翻墙

Install

You should have a golang env. Download[https://golang.org/dl/] 1.2 or later 
mkdir ~/goproxy

export GOAPTH=~/goproxy
cd ~/goproxy
go get -u -v github.com/Alienero/goproxy/server
(可执行文件server将会出现在$GOAPTH/bin/里面.然后把$GOAPTH/bin添加到环境变量)

Usage

cd $GOAPTH/bin

# Start the server:
cd ~
openssl req -x509 -nodes -days 3650 -newkey rsa:2048 -keyout key.pem -out cert.pem 
(此命令会在~/下,生成cert.pem和key.pem文件。) 
 server -listen=:8087 -password=你自设的密码 &
(不过此命令server -listen=:8087 -password=你自设的密码 是运行在前台的,容易退出。我们
可利用systemd来让其运行为service:
nano /etc/systemd/system/goproxy-by-alienero.service
内容为:
[Unit]
After=network.target

[Service]
WorkingDirectory=/root
ExecStart=/root/go/gopath/bin/server -listen=0.0.0.0:8087 -password=my_password
Restart=always

[Install]
WantedBy=multi-user.target 
然后运行:
systemctl daemon-reload
systemctl restart goproxy-by-alienero
systemctl enable goproxy-by-alienero
服务器端就搭建好了。
在客户机器mac上,先安装go环境。
cd $GOPATH
go get -u -v github.com/Alienero/goproxy/client
(可执行文件client将会出现在$GOAPTH/bin/里面。然后把$GOAPTH/bin添加到环境变量)
# Start the client:
cd ~ 
把服务器上的~/下的cert.pem文件下载到本地机器的~/下。
 client -listen=127.0.0.1:8089 -password=你自设的密码 -remote=your_vps_ip:8087
然后设置浏览器的http proxy为127.0.0.1:8089,浏览器即可翻墙。
# In the client ,you can firt start the program then config it
# Of cause you can use the args to config
#   -password xxx
# The Client listen address. Default is 127.0.0.1:8089
#   -listen 127.0.0.1:8089
# The remote server address(proxy server). Default is yim.so
#   -remote yim.so
# If you ues the windows,you want to hava the colorful print, you can set the iscolor true
# Default is false. It Only normal display in Cygwin Terminal
#   -iscolor
FROM https://github.com/Alienero/goproxy
(此goproxy不是phuslu/goproxy,也不是shell909090/goproxy)
我用此goproxy翻墙成功,翻墙速度还行。