为本地终端设置代理
- 前提准备
电脑本机配置好了clash、V2rayU等代理工具,知道socks5、http的代理端口
- 第一步
#cat ~/.zprofile
#在zsh 加载环境变量的时候,先加载一下 bash_profile 也可
source ~/.bash_profile
- 第二步
适用于:macOS & Linux(Windows下的:MobaXterm、GitBash)
#cat ~/.bash_profile
#cat ~/.bash_aliases #不起作用,重新登录后不会自动加载
cat >> ~/.bash_profile << EOF
#客户端:v2rayN_10808+10809 + NekoBox_2080 + Clash_7890
#socks
alias proxy_s5_v2rayN='export ALL_PROXY=socks5://127.0.0.1:10808'
alias proxy_s5_neko='export ALL_PROXY=socks5://127.0.0.1:2080'
alias proxy_s5_clash='export ALL_PROXY=socks5://127.0.0.1:7890'
alias proxy_unset_s5='unset ALL_PROXY'
#http
alias proxy_http_v2rayN='export proxy_http=http://127.0.0.1:10809;export proxy_https=http://127.0.0.1:10809;'
alias proxy_http_neko='export proxy_http=http://127.0.0.1:2081;export proxy_https=http://127.0.0.1:2081;'
alias proxy_http_clash='export proxy_http=http://127.0.0.1:7890;export proxy_https=http://127.0.0.1:7890;'
alias proxy_unset_http='unset proxy_http proxy_https'
EOF
source .bash_profile
all_proxy
- 大写形式的代理环境变量,遵循与小写形式相同的语法。
- 用于设置所有协议共用的代理服务器,覆盖其他代理设置。
SOCKS_PROXY、SOCKS5_PROXY
- 用于设置 SOCKS 代理服务器。