Setting Up HTTP Proxy in Terminal

让 Terminal 的流量全走 proxy

安装 polipo

➜  ~ brew install polipo

添加以下 alias

subl ~/.oh-my-zsh/custom/example.zsh
alias proxy='nohup polipo socksParentProxy=127.0.0.1:1080 >/dev/null 2>&1 &;export all_proxy=http://127.0.0.1:8123'
alias unproxy='unset all_proxy'

NIN: Port 8123是 polipo 的默认 http 端口.

测试 - 检查 IP

➜  ~ proxy
[2] 6331
[2]  + 6331 exit 1     nohup polipo socksParentProxy=127.0.0.1:1080 > /dev/null 2>&1
➜  ~ curl icanhazip.com | nali
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100    15  100    15    0     0  20325      0 --:--:-- --:--:-- --:--:-- 15000
xxx.xxx.xxx.xxx[美国]
➜  ~ unproxy
➜  ~ curl icanhazip.com | nali
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100    16  100    16    0     0     30      0 --:--:-- --:--:-- --:--:--    30
119.131.xxx.xxxx[广东省 电信]

Ref

Show Comments