主要参考使用 shadowsocks 加速 Mac 自带终端或iTerm 2
shadowsocks-NG自带privoxy
Privoxy配置
在vim /usr/local/etc/privoxy/config
中添加
1 2
| listen-address 0.0.0.0:1087 #全局域网可访问 forward-socks5 / localhost:1080 . #最后有个.
|
然后sudo privoxy /usr/local/privoxy/config
mac段查看端口lsof -iTCP:1087
使用ShadowsocksX-NG
在HTTP Proxy Preference
选端口
Terminal端
1 2
| export http_proxy='http://localhost:1087' export https_proxy='http://localhost:1087'
|
取消代理
1 2
| unset http_proxy unset https_proxy
|
或者在.zshrc
中添加开关函数
1 2 3 4 5 6 7 8 9 10 11
| function proxy_off(){ unset http_proxy unset https_proxy echo -e "已关闭代理" } function proxy_on() { export no_proxy="localhost,127.0.0.1,localaddress,.localdomain.com" export http_proxy="http://127.0.0.1:8118" export https_proxy=$http_proxy echo -e "已开启代理" }
|
测试当前终端标签/窗口是否走代理: