科学
命令行
export http_proxy=http://127.0.0.1:1087
export https_proxy=$http_proxy
撤销
unset http_proxy https_proxy
可以在 ~/.zshrc 或者 ~/.bash_profile 中添加这样的alias:
alias proxy='export http_proxy=http://127.0.0.1:1087 https_proxy=http://127.0.0.1:1087'
alias unproxy='unset http_proxy https_proxy'
ProxyCommand
这是 ssh 自带的一条命令,它能够允许ssh通过一个现有的ssh会话来发送命令。简单来说,就是能够允许 ssh via ssh。
——那么,我们需要两个vps咯?
不用,我们用下面的一个工具:Corkscrew
brew install corkscrew
使用:
vim ~/.ssh/config
host *
ProxyCommand corkscrew 127.0.0.1 1080 %h %p
或者,ssh [email protected] -o "ProxyCommand nc -X 5 -x 127.0.0.1:1080 %h %p"
proxychains-ng
安装,brew install proxychains-ng
修改,vim /usr/local/etc/proxychains.conf
使用,proxychains4 wget http://xxx.com/xxx.zip
proxychains-ng直接调用SHELL
bash
$ proxychains4 -q /bin/bash
zsh
$ proxychains4 -q /bin/zsh
测试
查看 IP,测试是否生效 curl -i http://ip.cn