2005/12/06

又一次暂时解决了访问自己blog的问题。

比较习惯使用firefox,但是不想SwitchProxy 插件,主要是怕插件占用太多资源,毕竟不是一直使用代理服务器的。
鉴于我要是用代理服务器的网站也就是那么几个(blogspot.com等),还不如写一个pac脚本呢。根据URL来选择是否是用代理服务器。而找代理服务器是一个比较费时的工作,所以我还是选择使用Tor+Privoxy作为我的代理服务器,当然是建立在我的Gentoo服务器上。
最重要的就是要写一个脚本:
function FindProxyForURL(url, host)
{
companyProxy="PROXY 10.4.0.1:3128";
torProxy="PROXY 10.4.0.109:8118";
torSocks="SOCKS 10.4.0.109:9050";
url = url.toLowerCase();
host = host.toLowerCase();
if (url.substring(0,6) == "https:" ||url.substring(0,4) == "ftp:"){
return "DIRECT";
}else if (shExpMatch(url,"*blogspot.com*")||shExpMatch(url,"*wikipedia.org*")){
return torProxy;
}else{
return companyProxy;
}
}


保存为*.pac文件就行了。
然后在浏览器里配置Configuration URL,指定为file://path/filename.pac就可以了。
上边仅仅是我的例子。
更多信息请参考这里。
http://wp.netscape.com/eng/mozilla/2.0/relnotes/demo/proxy-live.html

没有评论:

发表评论

Mastodon Daily(2024-04-27)

I just watched The Happening (2008) https://trakt.tv/movies/the-happening-2008 #TheHappe...