Total Pageviews

Saturday, 2 November 2019

利用go_proxy2翻墙

登陆linux vps.
mkdir go_proxy2-exec
cd go_proxy2-exec
wget https://github.com/qq906907952/go_proxy2/releases/download/linux/linux_x86-64.tar
tar xvf linux_x86-64.tar
(会解压出来目录go_proxy2)
cd go_proxy2
rm -rf client.json
cd cert/serv
nano serv.cnf
(把IP.1的值改为你的vps的公网ip)
./create_serv_crt.sh
(会在当前目录下,生成root.crt,root.key,server.crt,server.key文件。稍后,要下载server.crt到本地机器
cd ../..
nano server.json
内容如下:
{

  "Servers": [
    {
      "Tls": {
        "On": true,
        "Tcp_encrypt":true,
        "Server_cert_path": "cert/serv/server.crt",
        "Server_private_key_path": "cert/serv/server.key",
        "Client_cert_paths": [
          "cert/client/client.crt"
        ]
      },
      "Listen_port": 1199,
      "Enc_method": "chacha20",
      "Password": "12345678901234567890123456789012"
    }
  ],

  "Ulimit": 1024000,
  "Udp_timeout": 30
}


看到上面的 "cert/client/client.crt" 了吗?稍后,我们需要上传客户机器上所生成的client.crt文件到cert/client/目录。

./go_proxy -c server.json --daemon
服务器端搭建完成。
(注意:重启vps后,需记得运行:
cd go_proxy2-exec/go_proxy2;./go_proxy -c server.json --daemon)

在本地机器mac上。
mkdir go_proxy2-exec
cd go_proxy2-exec
wget https://github.com/qq906907952/go_proxy2/releases/download/osx/osx_x86-64.tar
tar xvf  osx_x86-64.tar
(会解压出来目录go_proxy2)
cd go_proxy2
rm -rf server.json
cd cert
cd serv
(把服务器上的server.crt下载到当前目录)
cd ..
cd client
./create_cli_crt.sh
(会在当前目录下,生成client.crt和client.key,把client.crt上传到服务器上的cert/client/目录。)
cd ../..
nano client.json
其内容如下:
{

  "Clients": [
    {
      "Mode": "http",
      "Ipv6": false,
      "Local_addr": "0.0.0.0:3939",
      "Server_addr": "vps-ip:1199",
      "Enc_method": "chacha20",
      "Password": "12345678901234567890123456789012",
      "Local_dns_addr": "114.114.114.114:53",
      "Remote_dns_addr": "8.8.4.4:53",
      "Connection_max_payload": 10,
      "Domain_cache_time": 3600,
      "Tls": {
        "On": true,
        "Server_name":"",
        "Tcp_encrypt": true,
        "Root_cert_path": "cert/serv/server.crt",
        "Client_cert": [
          {
            "Cert": "cert/client/client.crt",
            "Private_key": "cert/client/client.key"
          }

        ]
      }
    },
    {
      "Mode": "socks5",
      "Ipv6": false,
      "Local_addr": "0.0.0.0:4949",
      "Server_addr": "vps-ip:1199",
      "Enc_method": "chacha20",
      "Password": "12345678901234567890123456789012",
      "Local_dns_addr": "114.114.114.114:53",
      "Remote_dns_addr": "8.8.8.8:53",
      "Connection_max_payload": 10,
      "Domain_cache_time": 3600,
      "Udp_in_tcp": false,
      "Tls": {
        "On": true,
        "Server_name": "",
        "Tcp_encrypt": true,
        "Root_cert_path": "cert/serv/server.crt",
        "Client_cert": [
          {
            "Cert": "cert/client/client.crt",
            "Private_key": "cert/client/client.key"
          }
        ]
      }
    }

  ],

  "Ulimit": 1024000,
  "Udp_timeout": 30
}


然后,运行:
./go_proxy -c client.json -s start
不要关闭此terminal.

然后,设置本地机器的浏览器的http proxy为127.0.0.1,端口为3939或
设置本地机器的浏览器的socks5 proxy为127.0.0.1,端口为4949,浏览器即可翻墙。
建议使用浏览器chrome+switchyomega.
如果使用浏览器ff,则只能设置ff的socks5 proxy,才能翻墙。
若是设置ff的http proxy,翻墙会失败。
不过如果安装switchyomega的ff版:
https://addons.mozilla.org/en-US/firefox/addon/switchyomega/ ,那么在ff+switchyomega里面,设置ff的http proxy,翻墙还是会成功。所以switchyomega真是帮了大忙。

项目地址:
https://github.com/qq906907952/go_proxy2/
https://github.com/qq906907952/go_proxy2/releases