
常见的VPN程序大部分默认代理浏览器的http流量,好多场景不是一个浏览器能解决问题的。linux用户大部分都是重度命令用户,如果要让终端下的命令被代理转发,这时我们就要用上proxychains-ng这款神器了。
首先下载 proxychains-ng(也许会很慢,可以网上搜一下设置 brew 镜像,然后下载速度就会快一点):
brew install proxychains-ng
使用 proxychains-ng 进行代理,例如 git clone:
procychains4 git clone https://github.com/facebook/react.git
在使用了 proxychains-ng 后终端的输出中,可以看到第一句 log 为:
[proxychains] config file found: /usr/local/etc/proxychains.conf
我们可以编辑 proxychains.conf 文件,将代理加入 [ProxyList] 中。例如:
[ProxyList]
socks5 127.0.0.1 1234
http 127.0.0.1 4321
编辑终端的 rc 文件(例如 .zshrc),添加 proxuchains4 的 alias:
alias pc="proxychains4"
退出保存,执行 source .zshrc 使别名生效。之后你就可以这样使用 procychains4:
pc git clone https://github.com/facebook/react.git
可以发现下载速度加快了很多。
文章来源网络,作者:运维,如若转载,请注明出处:https://shuyeidc.com/wp/221989.html<