朝廷阅兵在即,稳定要紧,自宣和六年以来,杀伐决断,无所不用其极。
上有所好,下必甚焉。大墙之内,小墙林立。在家上网,要翻GFW,到了公司,还得翻LGFW(Less Great Firewall)。银河系是大,可像模像样的网站也就那么几个,被功夫网拦掉几个,再被小功夫网滤掉几个,掰着手指头一算,好么,还得搭上几个。
PAC一直是我的交 通协管,原来也就是和功夫网作阵地战,因此配置得简单一些。但现在要判断是在家还是在公司,从而自动决定是否将一些被公司网关过滤掉的网站加入使用代理访 问的网址列表,并决定是使用公司网关作为代理来访问没有被屏蔽的网址还是直接访问互联网,甚至还要对公司内部网站使用直接访问的方式。因此重写了PAC, 从此两点一线间,可以无缝切换了。
JAVASCRIPT:
- function FindProxyForURL(url, host){
- url = url.toLowerCase();
- host = host.toLowerCase();
- //Your Freedom
-
- //Sufferers under the despotic power of GFW
- var sufferers = new Array();
-
- //As I say, if the despotic power of GFW disappoints me, holding a candle to the devil outrages me.
- var furiesOfYuri = new Array();
-
- var gateway = "DIRECT";
- //If my IP address is as below, it indicates that I am in the office.
- if(myIpAddress() == '10.1.29.29'){
- //Use the gateway of my company's network to visit the internet
- //Append URLs blocked by the company to the sufferers
- sufferers = sufferers.concat(furiesOfYuri);
- }
-
- //No one can take my freedom away
- for(var i = 0;i <sufferers.length;i++){
- if(shExpMatch(host,sufferers[i])){
- return freedom;
- }
- }
-
- if(isPlainHostName(host)){
- //Visit local network directly
- return "DIRECT";
- }else{
- //Visit other URLs by gateway, which either indicates visiting directly at home or by the gateway of company in my office
- return gateway;
- }
- }
没有评论:
发表评论