Total Pageviews

Monday 15 October 2018

利用gotunnel-by-codesaler翻墙(不建议使用本法,太容易断开连接了)

登陆linux vps.
先安装go环境。然后,
git clone https://github.com/codesaler/gotunnel gotunnel-by-codesaler
cd gotunnel-by-codesaler
rm -rf gnet
git clone https://github.com/reusee/gnet


root@wh:~/gotunnel-by-codesaler# ls
client  gnet  README.md  server
root@wh:~/gotunnel-by-codesaler# cd server
root@wh:~/gotunnel-by-codesaler/server# ls
config.go  server.go
root@wh:~/gotunnel-by-codesaler/server# nano config.go
root@wh:~/gotunnel-by-codesaler/server# cat config.go
package main

const (
  PORT = "0.0.0.0:38808"
  KEY = "abcd1234qwer7890"
)
root@wh:~/gotunnel-by-codesaler/server# go build
(会在当前目录下,生成可执行文件server)
root@wh:~/gotunnel-by-codesaler/server# ls
config.go  server  server.go
root@wh:~/gotunnel-by-codesaler/server# ./server

不过命令./server是运行在前台的,我们可以利用systemd来把它运行为service:
nano /etc/systemd/system/gotunnel-by-codesaler.service
内容为:
[Unit]

After=network.target


[Service]
WorkingDirectory=/root/gotunnel-by-codesaler/server/
ExecStart=/root/gotunnel-by-codesaler/server/server
Restart=always

[Install]
WantedBy=multi-user.target

然后运行:
systemctl start gotunnel-by-codesaler
systemctl enable gotunnel-by-codesaler
服务器端搭建完成。

在客户机器mac.
先安装go环境。然后,
git clone https://github.com/codesaler/gotunnel gotunnel-by-codesaler
cd gotunnel-by-codesaler
rm -rf gnet
git clone https://github.com/reusee/gnet



bogon:gotunnel-by-codesaler brite$ ls
README.md client gnet server
bogon:gotunnel-by-codesaler brite$ cd client
bogon:client brite$ ls
client.go config.go const.go
bogon:client brite$ nano config.go
bogon:client brite$ cat config.go

package main

const (
  PORT = "127.0.0.1:8808"
  SERVER = "vps-ip:38808"
  KEY = "abcd1234qwer7890"
)
bogon:client brite$ go build
(会在当前目录下,生成可执行文件client)
bogon:client brite$ ls
client client.go config.go const.go
bogon:client brite$ ./client
(不要关闭此终端窗口)
如果翻墙速度变慢了,就重新运行客户端(这点适用于任何翻墙术)
在终端窗口里,按ctrl+c,然后运行./client

然后,设置本地机器的浏览器的socks5代理服务器为127.0.0.1 ,端口为8808,浏览器即可翻墙。

项目地址:https://github.com/codesaler/gotunnel

本贴就是用此翻墙术翻墙后,发布的。用来看youtube,不太流畅。