mac agents command line terminal provided

surroundings:

  • macOS Mojave 10.14.3
  • iTrem 2 3.2.8
  • Sour milk 1.1.4.4-R8

Check the status of your command line

curl ip.gs

 

Officially begin

First, first check your own sour milk is normal, and in the Advanced Settings page, find local Sock5 listening port, I myself was 1086, note that there's a HTTP proxy listening port, not the

 

 Second, install the required software (not installed on the first brew brew, search for specific self-Ha)

brew install privoxy

Third, the configuration privoxy

vim /usr/local/etc/privoxy/config

Inserted inside the two rows,

listen-address 0.0.0.0:8118
forward-socks5 / localhost:1086 .

 note! ! ! 1086 is just above the port ring out here, do not mistake, a mistake to not take the

Fourth, start prioxy

sudo /usr/local/sbin/privoxy /usr/local/etc/privoxy/config
查看是否成功,输入命令
netstat -na | grep 8118

See similar success the following information to indicate the start 

tcp4 0 0 *.8118 *.* LISTEN

Fifth, the last step, easy to use

在 ~/.zshrc Was added switching function, easier to use

vim ~/.zshrc

Inserted inside

function proxy_off(){
    unset http_proxy
    unset https_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:8118"
    export https_proxy=$http_proxy
    echo -e "已开启代理"
}

再 source 一下

source  ~/.zshrc

然后就可以通过在命令行输入 proxy_on 和 proxy_off 来开启和关闭代理啦

 

六、日常开启 prioxy 软件

brew services start privoxy

 

七、日常使用步骤

先启动 provixy 软件
brew services start privoxy
然后 启动代理
proxy_on

 

最后在看看自己的命令行状态吧

curl ip.gs

 well done!

Guess you like

Origin www.cnblogs.com/shihaoyu/p/11126513.html