Privoxy HTTP 代理配置

安装 privoxy

$ brew install privoxy

配置 privoxy

默认配置文件是 /usr/local/etc/privoxy/config, 重点配置 forward (forward-socks5等)部分,以下是我的这部分配置:

forward-socks5 / .

forward-socks5 .gcr.io                  127.0.0.1:6668  .
forward-socks5 .android.com             127.0.0.1:6668  .
forward-socks5 .bluemix.net             127.0.0.1:6668  .
forward-socks5 .softlayer.com           127.0.0.1:6668  .
forward-socks5 .softlayer.net           127.0.0.1:6668  .
forward-socks5 .appspot.com             127.0.0.1:6668  .
forward-socks5 .blogger.com             127.0.0.1:6668  .
forward-socks5 .blogspot.com            127.0.0.1:6668  .
forward-socks5 .chromium.org            127.0.0.1:6668  .
forward-socks5 .ggpht.com               127.0.0.1:6668  .
forward-socks5 .gmail.com               127.0.0.1:6668  .
forward-socks5 .golang.org              127.0.0.1:6668  .
forward-socks5 .google.com              127.0.0.1:6668  .
forward-socks5 .google.com.hk           127.0.0.1:6668  .
forward-socks5 .google-analytics.com    127.0.0.1:6668  .
forward-socks5 .googleapis.com          127.0.0.1:6668  .
forward-socks5 .googlecode.com          127.0.0.1:6668  .
forward-socks5 .googleusercontent.com   127.0.0.1:6668  .
forward-socks5 .googlevideo.com         127.0.0.1:6668  .
forward-socks5 .gstatic.com             127.0.0.1:6668  .
forward-socks5 .youtube-nocookie.com    127.0.0.1:6668  .
forward-socks5 .youtube.com             127.0.0.1:6668  .
forward-socks5 .youtu.be                127.0.0.1:6668  .
forward-socks5 .ytimg.com               127.0.0.1:6668  .
forward-socks5 .2ality.com              127.0.0.1:6668  .
forward-socks5 .amazonaws.com           127.0.0.1:6668  .
forward-socks5 .bbc.co.uk               127.0.0.1:6668  .
forward-socks5 .bbc.com                 127.0.0.1:6668  .
forward-socks5 .bbcchinese.com          127.0.0.1:6668  .
forward-socks5 .biglms.com              127.0.0.1:6668  .
forward-socks5 .blogblog.com            127.0.0.1:6668  .
forward-socks5 .bootstrapcdn.com        127.0.0.1:6668  .
forward-socks5 .businessinsider.com     127.0.0.1:6668  .
forward-socks5 .bintray.com             127.0.0.1:6668  .
forward-socks5 .caddyserver.com         127.0.0.1:6668  .
forward-socks5 .ckers.org               127.0.0.1:6668  .
forward-socks5 .cloudfront.net          127.0.0.1:6668  .
forward-socks5 .dnsimple.com            127.0.0.1:6668  .
forward-socks5 .dropbox.com             127.0.0.1:6668  .
forward-socks5 .dropboxusercontent.com  127.0.0.1:6668  .
forward-socks5 .drupal.org              127.0.0.1:6668  .
forward-socks5 .eaio.com                127.0.0.1:6668  .
forward-socks5 .facebook.com            127.0.0.1:6668  .
forward-socks5 .facebook.net            127.0.0.1:6668  .
forward-socks5 .fb.com                  127.0.0.1:6668  .
forward-socks5 .feedburner.com          127.0.0.1:6668  .
forward-socks5 .fessendenhouse.org      127.0.0.1:6668  .
forward-socks5 .freshseries.net         127.0.0.1:6668  .
forward-socks5 .ftchinese.com           127.0.0.1:6668  .
forward-socks5 .getmdl.io               127.0.0.1:6668  .
forward-socks5 .ghbtns.com              127.0.0.1:6668  .
forward-socks5 .global.ssl.fastly.net   127.0.0.1:6668  .
forward-socks5 .gradle.org              127.0.0.1:6668  .
forward-socks5 .gravatar.com            127.0.0.1:6668  .
forward-socks5 .hadoopfdw.org           127.0.0.1:6668  .
forward-socks5 .haproxy.org             127.0.0.1:6668  .
forward-socks5 .heronstreaming.io       127.0.0.1:6668  .
forward-socks5 .helphul.io              127.0.0.1:6668  .
forward-socks5 .hkgolden.com            127.0.0.1:6668  .
forward-socks5 .html5rocks.com          127.0.0.1:6668  .
forward-socks5 .iredmail.org            127.0.0.1:6668  .
forward-socks5 .javatpoint.com          127.0.0.1:6668  .
forward-socks5 .keyhole.com             127.0.0.1:6668  .
forward-socks5 .kotlinlang.org          127.0.0.1:6668  .
forward-socks5 .litecoin.org            127.0.0.1:6668  .
forward-socks5 .mailchimpapp.com        127.0.0.1:6668  .
forward-socks5 .marketo.com             127.0.0.1:6668  .
forward-socks5 .maven.org               127.0.0.1:6668  .
forward-socks5 .mediafire.com           127.0.0.1:6668  .
forward-socks5 .medium.com              127.0.0.1:6668  .
forward-socks5 .messenger.com           127.0.0.1:6668  .
forward-socks5 .mitmproxy.org           127.0.0.1:6668  .
forward-socks5 .nanzao.com              127.0.0.1:6668  .
forward-socks5 .nature.com              127.0.0.1:6668  .
forward-socks5 .nodejs.org              127.0.0.1:6668  .
forward-socks5 .nytimes.com             127.0.0.1:6668  .
forward-socks5 .olark.com               127.0.0.1:6668  .
forward-socks5 .openwrt.org             127.0.0.1:6668  .
forward-socks5 .oracle.com              127.0.0.1:6668  .
forward-socks5 .pgfoundry.org           127.0.0.1:6668  .
forward-socks5 .polymer-project.org     127.0.0.1:6668  .
forward-socks5 .qianduan.net            127.0.0.1:6668  .
forward-socks5 .rawgit.com              127.0.0.1:6668  .
forward-socks5 .github.com              127.0.0.1:6668  .
forward-socks5 .githubusercontent.com   127.0.0.1:6668  .
forward-socks5 .githubapp.com           127.0.0.1:6668  .
forward-socks5 .react.parts             127.0.0.1:6668  .
forward-socks5 .repl.it                 127.0.0.1:6668  .
forward-socks5 .rfa.org                 127.0.0.1:6668  .
forward-socks5 .rfi.fr                  127.0.0.1:6668  .
forward-socks5 .scmp.com                127.0.0.1:6668  .
forward-socks5 .secure-admin.com        127.0.0.1:6668  .
forward-socks5 .shadowsocks.org         127.0.0.1:6668  .
forward-socks5 .slack.com               127.0.0.1:6668  .
forward-socks5 .slideshare.com          127.0.0.1:6668  .
forward-socks5 .slideshare.net          127.0.0.1:6668  .
forward-socks5 .stackoverflow.com       127.0.0.1:6668  .
forward-socks5 .sstatic.net             127.0.0.1:6668  .
forward-socks5 .sstatic.net             127.0.0.1:6668  .
forward-socks5 .telegram.org            127.0.0.1:6668  .
forward-socks5 .stringjs.com            127.0.0.1:6668  .
forward-socks5 .t.co                    127.0.0.1:6668  .
forward-socks5 .tmagazine.com           127.0.0.1:6668  .
forward-socks5 .torproject.org          127.0.0.1:6668  .
forward-socks5 .tumblr.com              127.0.0.1:6668  .
forward-socks5 .twimg.com               127.0.0.1:6668  .
forward-socks5 .twitter.com             127.0.0.1:6668  .
forward-socks5 .twttr.com               127.0.0.1:6668  .
forward-socks5 .typekit.net             127.0.0.1:6668  .
forward-socks5 .uploaded.net            127.0.0.1:6668  .
forward-socks5 .vimeo.com               127.0.0.1:6668  .
forward-socks5 .vimeocdn.com            127.0.0.1:6668  .
forward-socks5 .voachinese.com          127.0.0.1:6668  .
forward-socks5 .webrtc.org              127.0.0.1:6668  .
forward-socks5 .wikipedia.org           127.0.0.1:6668  .
forward-socks5 .wixstatic.com           127.0.0.1:6668  .
forward-socks5 .wordpress.com           127.0.0.1:6668  .
forward-socks5 .wsj.com                 127.0.0.1:6668  .
forward-socks5 .wsj.net                 127.0.0.1:6668  .
forward-socks5 .wsjemail.com            127.0.0.1:6668  .
forward-socks5 .yandex.st               127.0.0.1:6668  .
forward-socks5 .yzzk.com                127.0.0.1:6668  .
forward-socks5 .zaobao.com.sg           127.0.0.1:6668  .
forward-socks5 .zeroturnaround.com      127.0.0.1:6668  .
forward-socks5 .zsh.org                 127.0.0.1:6668  . 

含义是 默认是直接穿过,罗列的才走 socks5://127.0.0.1:6668 代理
这个 socks5 代理,是通过 ssh tunnel 创建的:

ssh -N -v [email protected] -D 127.0.0.1:6668 > /tmp/proxy68.log 2>&1 &

cli 配置 mac 代理

$ networksetup -setwebproxy       Wi-Fi 127.0.0.1 8118
$ networksetup -setsecurewebproxy Wi-Fi 127.0.0.1 8118

Wi-Fi是 networkservice 的名字,通常就是这个,可参看所有的networkservices:

$ networksetup -listallnetworkservices

何时需要用cli来配置?如果你有多套proxy策略,script会更方便。

后记

不是所有网络客户端程序都可以使用代理(比如UDP等其它L4协议),
也不是所有都可以使用HTTP代理(或SOCKS代理),
也不是所有都支持PAC,
使用(配置)代理的方式也多种多样(如果不认系统代理的话)。
所以,完整的穿越GFW,还需要case-by-case的配置

Back to top

comments powered by Disqus