如何测试代理成功:

  1. $ curl ip.sb

查看 IP 地址即可

cmd

  1. set http_proxy=http://127.0.0.1:1080
  2. set https_proxy=https://127.0.0.1:1080
  3. set http_proxy=socks5://127.0.0.1:1080
  4. set https_proxy=socks5://127.0.0.1:1080

PowerShell

  1. $env:http_proxy="http://127.0.0.1:1080"
  2. $env:https_proxy="https://127.0.0.1:1080"
  3. $env:http_proxy="socks5://127.0.0.1:1079"
  4. $env:https_proxy="socks5://127.0.0.1:1079"

Unix like

  1. $ export http_proxy="socks5://127.0.0.1:1079"
  2. $ export https_proxy="socks5://127.0.0.1:1079"
  3. $ export ALL_PROXY=socks5://127.0.0.1:1079
  4. $ export http_proxy=http://127.0.0.1:1080
  5. $ export https_proxy=https://127.0.0.1:1080

这里的 1080 是 HTTP 端口号,写上你设置的端口号即可

测试是否成功

  1. $ curl -L google.com
  2. //或查看 IP
  3. $ curl ip.gs

临时走代理

  1. $ alias socks5="http_proxy=socks5://127.0.0.1:1080 https_proxy=socks5://127.0.0.1:1080 all_proxy=socks5://127.0.0.1:1080 "

建立一个上述的别名即可。使用如下:

  1. $ socks5 curl -L google.com