其他

mac 终端代理

2020-05-26  本文已影响0人  哦呵呵y

~/.bash_profile中添加以下代码
在终端中调用proxy_offproxy_on就可以打开代理....

function proxy_off(){
        unset http_proxy
        unset https_proxy
        unset ftp_proxy
        unset rsync_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:1087"#注意,根据自己的配置设置有可能会是1080或1086
        export https_proxy=$http_proxy
        export ftp_proxy=$http_proxy
        export rsync_proxy=$http_proxy
        export HTTP_PROXY=$http_proxy
        export HTTPS_PROXY=$http_proxy
        export FTP_PROXY=$http_proxy
        export RSYNC_PROXY=$http_proxy
        echo -e "已开启代理"
}

上一篇下一篇

猜你喜欢

热点阅读