如何测试代理成功:
$ curl ip.sb
查看 IP 地址即可
cmd
set http_proxy=http://127.0.0.1:1080
set https_proxy=https://127.0.0.1:1080
set http_proxy=socks5://127.0.0.1:1080
set https_proxy=socks5://127.0.0.1:1080
PowerShell
$env:http_proxy="http://127.0.0.1:1080"
$env:https_proxy="https://127.0.0.1:1080"
$env:http_proxy="socks5://127.0.0.1:1079"
$env:https_proxy="socks5://127.0.0.1:1079"
Unix like
$ export http_proxy="socks5://127.0.0.1:1079"
$ export https_proxy="socks5://127.0.0.1:1079"
$ export ALL_PROXY=socks5://127.0.0.1:1079
$ export http_proxy=http://127.0.0.1:1080
$ export https_proxy=https://127.0.0.1:1080
这里的 1080 是 HTTP 端口号,写上你设置的端口号即可
测试是否成功
$ curl -L google.com
//或查看 IP
$ curl ip.gs
临时走代理
$ 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 "
建立一个上述的别名即可。使用如下:
$ socks5 curl -L google.com