pac的原理是,浏览器在加载一个页面前首先执行这个文件里的
function FindProxyForURL(url, host)是用javascript的语法编写的,它返回一个代理服务器地址或直接连接。
因此只要先判断:
如果是访问带有".blogspot.com"字串的地址,即访问blogger,则使用blogger的备用代理服务器地址。否则,判断是否某些被gfwed的网址,是则使用tor的代理服务器,最后,直接链接。
function FindProxyForURL(url,host)
{
// ==================================================
// Automatic proxy configuration Script Paradigm V0.1
//
// Author : zdpress
// Blog : Blog Behind GFW
// URL : http://behindgfw.blogspot.com
// Email : zdpress+blog at Gmail.com
// Thanks : super1 from zh.wikipedia.org
// Note : Under Firefox the URL should be like
// file:///C:/TOR.pac
// Under IE the URL should be like
// file://C:\TOR.pac
// ==================================================
url = url.toLowerCase();
host = host.toLowerCase();
if(dnsDomainIs(host, ".blogspot.com"))
return "PROXY 72.14.219.190:80";
//使用blogspot服务器后备IP
else if
(
//域名匹配.
dnsDomainIs(host,"lefkada.eecs.harvard.edu")
//通过http://lefkada.eecs.harvard.edu/cgi-bin/ipaddr.pl?tor=1检验是否已登陆Tor.
|| dnsDomainIs(host,"technorati.com")
|| dnsDomainIs(host,"wikipedia.org")
|| dnsDomainIs(host,"mediawiki.org")
|| dnsDomainIs(host,"wikimedia.org")
|| dnsDomainIs(host,"wiktionary.org")
|| dnsDomainIs(host,"wikibooks.org")
|| dnsDomainIs(host,"wikisource.org")
|| dnsDomainIs(host,"wikiquote.org")
|| dnsDomainIs(host,"wikinews.org")
|| dnsDomainIs(host,"wikimediafoundation.org")
|| dnsDomainIs(host,"voanews.com")
|| dnsDomainIs(host,"bbc.co.uk")
|| dnsDomainIs(host,"xys.org")
|| dnsDomainIs(host,"mindmeters.com")
|| dnsDomainIs(host,"gpass1.com")
|| dnsDomainIs(host,"pbwiki.com")
|| dnsDomainIs(host,"ice.citizenlab.org")
|| dnsDomainIs(host,"greatfirewallofchina.net")
|| dnsDomainIs(host,"civisec.org")
|| dnsDomainIs(host,"solog.org")
|| dnsDomainIs(host,"zuola.com")
|| dnsDomainIs(host,"im.tv")
//想增加网址在这里复制增加一行即可
|| shExpMatch(url, "http://*/search?q=cache*")
//匹配google网页快照
)
// return "PROXY 145.97.39.139:80;PROXY 125.241.38.130:8080;PROXY 127.0.0.1:8118";
// 注:IE支持代理列表,但FF不支持。为防止Tor滥用,有时因出口地址相同,
// 而不能编辑维基,所以有必要换用专用维基代理或者其他普通代理地址。
// 145.97.39.139:80为维基专用代理中一个,后者125.241.38.130:8080为普通代理。
// 维基专用代理: 145.97.39.156:80 145.97.39.142:80 145.97.39.140:80 145.97.39.135:80
// 145.97.39.132:80 145.97.39.138:80 145.97.39.133:80 145.97.39.139:80
// 145.97.39.134:80 145.97.39.136:80 145.97.39.131:80 145.97.39.137:80
return "PROXY 127.0.0.1:8118";
//使用tor+privoxy
else return "DIRECT";
//如缺少这句在IE下会经常显示错误
}
No comments:
Post a Comment