Total Pageviews

Saturday, 7 October 2017

搭建基于go的翻墙工具-goflyway( 加密程度不高,不建议使用。)

在inux vps上。首先搭建go环境,然后,

cd $GOPATH

go get -u -v github.com/coyove/goflyway/cmd/goflyway/

(可执行文件goflyway会出现在$GOBIN/里面)
cd ~

goflyway -h
     __//                   __ _                          
    /.__.\                 / _| |                         
    \ \/ /      __ _  ___ | |_| |_   ___      ____ _ _   _
 '__/    \     / _' |/ _ \|  _| | | | \ \ /\ / / _' | | | |
  \-      )   | (_| | (_) | | | | |_| |\ V  V / (_| | |_| |
   \_____/     \__, |\___/|_| |_|\__, | \_/\_/ \__,_|\__, |
 ____|_|____    __/ |             __/ |               __/ |
     " "  cf   |___/             |___/               |___/

Usage of goflyway:
  -a string
        proxy authentication, form: username:password (remember the colon)
  -c string
        config file path
  -china-list
        identify Chinese websites using china-list (default true)
  -debug
        debug mode
  -disable-console
        disable the console access
  -disable-shoco
        disable shoco compression
  -dns-cache int
        DNS cache size (default 1024)
  -hr-counter
        use high resolution counter (default true)
  -k string
        key, important (default "0123456789abcdef")
  -l string
        local listening port (remember the colon) (default ":8100")
  -local-error
        log all localhost errors
  -lv string
        logging level, whose value can be: all, warn, err (default "all")
  -partial
        partially encrypt the tunnel traffic 

  -throttling int
        traffic throttling, experimental
  -throttling-max int
        traffic throttling token bucket max capacity (default 1048576)
  -up string
        upstream server address (e.g. vps-ip:8100)

于是,
goflyway -k somepassword -l :2466
     __//                   __ _                          
    /.__.\                 / _| |                         
    \ \/ /      __ _  ___ | |_| |_   ___      ____ _ _   _
 '__/    \     / _' |/ _ \|  _| | | | \ \ /\ / / _' | | | |
  \-      )   | (_| | (_) | | | | |_| |\ V  V / (_| | |_| |
   \_____/     \__, |\___/|_| |_|\__, | \_/\_/ \__,_|\__, |
 ____|_|____    __/ |             __/ |               __/ |
     " "  cf   |___/             |___/               |___/

[  1017 00:21:40.556] listening on :2466

goflyway -k somepassword -l :2466是运行在前台的,可以使用systemd把该command运行为service:
nano /etc/systemd/system/goflyway.service
其内容为:
[Unit]
After=network.target

[Service]
ExecStart=
/root/go1.16.3/go/gopath/bin/goflyway -k somepassword -l :2466
Restart=always

[Install]
WantedBy=multi-user.target


然后运行:
systemctl start goflyway
systemctl enable goflyway
服务器端搭建完成。


在客户端机器mac上。
首先搭建go环境,然后,

cd $GOPATH

go get -u -v github.com/coyove/goflyway/cmd/goflyway/

(go get这一步要先挂个vpn,否则go get会失败

(可执行文件goflyway会出现在$GOBIN/里面)
cd ~

goflyway -h
goflyway -k somepassword -l 127.0.0.1:7100 -up vps-ip:2466
不要关闭此terminal.

设置本地机器的chrome浏览器的http proxy为127.0.0.1:7100 ,then the browser can cross the gfw.(chrome浏览器要先安装proxy switchyomega插件

或:
设置本地机器的ff浏览器的http proxy为127.0.0.1:7100 ,then the browser can cross the gfw.(ff浏览器也要先安装proxy switchyomega插件:https://addons.mozilla.org/en-US/firefox/addon/switchyomega。如果不安装此插件,直接设置本地机器的ff浏览器的http proxy为127.0.0.1:7100,ff是会翻墙失败的。)

项目地址:
https://github.com/coyove/goflyway

too many open files 解决方法:

ulimit -n 2048

这样就可以把当前用户的最大允许打开文件数量设置为2048了,但这种设置方法在重启后会还原为默认值。 

 from https://blog.csdn.net/fdipzone/article/details/34588803