Mac use Privoxy + SS set up a proxy

Mac use Privoxy + SS set up a proxy

 

Xu key:

.zshrc

.bash_profile

privoxy

ss <shadowsocks client>

 

1, simple proxy measures: 
   edit .zshrc file:

vim ~/.zshrc

    insert:

alias proxy='export proxy_profile="socks5://127.0.0.1:1080" ; export all_proxy=$proxy_profile; echo "proxy has be set to: $proxy_profile" ; curl cip.cc'
alias unproxy='unset all_proxy ; echo "proxy has be clear" ; curl cip.cc'

    application:

source ~/.zshrc && proxy

# 清除proxy

unproxy

 

2, a plurality of terminals on the agency to take effect. Simple proxy drawback is that, when using other terminal is opened, the agent will fail.

  •     Set the default port 1080 SOCKS5 proxy settings.
  •     Privoxy to use HTTP proxy SOCKS is converted to the default port 8118.
  •     Editing .bash_profile insert code.
  •     Installation Privoxy configuration vim / usr / local / etc / privoxy / config.
  •     Detecting whether the agent was successful.

      Editing .bash_profile insert code.

vim ~/.bash_profile

#插入
export all_proxy="socks5://127.0.0.1:1080";
export http_proxy="http://127.0.0.1:8118";
export https_proxy="http://127.0.0.1:8118";

 

  Installation Privoxy configuration vim / usr / local / etc / privoxy / config.

  Installation privoxy, mac use: BREW install Privoxy  

vim /usr/local/etc/privoxy/config

#插入
#xu S
listen-address 127.0.0.1:8118
forward-socks5 / 127.0.0.1:1080 .
#xu E

#执行
/usr/local/sbin/privoxy /usr/local/etc/privoxy/config

 

  Detecting whether the agency was successful:

ps aux|grep privoxy && lsof -i:8118

  

  

curl cip.cc

 

 

FAQ:

1, Why can not ping google.com success?

ICMP work Layer3 OSI model (the network layer), the SOCKS work Layer5 (session layer), httping Layer7 work (application layer), and therefore pingthe message can not pass through the SOCKS, but the httpingmessage may be.

For example, I set the VPS in the shadowsocks (SOCKS5 proxy) server, using my macbook pro 127.0.0.1:1080 use as a client, I want to check google network is good.

httping -x 127.0.0.1:1080 -g http://www.google.com -5

 

--

 

Guess you like

Origin www.cnblogs.com/q1104460935/p/11294201.html