为终端配置外部网络访问权限

在根目录下/user下找到.zprofile文件,添加以下配置

function proxy_on() {
    export https_proxy=http://127.0.0.1:7890
    export http_proxy=http://127.0.0.1:7890
    export all_proxy=socks5://127.0.0.1:7890
    echo -e "终端代理已开启。"
}

function proxy_off(){
    unset https_proxy
    unset http_proxy
    unset all_proxy
    echo -e "终端代理已关闭。"
}

运行proxy_on()来开启终端,使用ping facebook.com来测试是否连接。

posted @ 2024-02-19 10:06  艾路  阅读(2)  评论(0编辑  收藏  举报