From 61de6b21fe7d4c915b012aac4b5cb6c3465fada5 Mon Sep 17 00:00:00 2001 From: aenerv7 Date: Thu, 3 Mar 2016 14:47:29 +0800 Subject: [PATCH 1/2] Update ngacn.cc acfun.tv bilibili.tv steampowered.com --- whitelist.pac | 130 +++++++++++++++++++++++++------------------------- 1 file changed, 66 insertions(+), 64 deletions(-) diff --git a/whitelist.pac b/whitelist.pac index e25189c..6d5d062 100644 --- a/whitelist.pac +++ b/whitelist.pac @@ -126,6 +126,7 @@ var white_domains = {"am":{ "mzsky":1, "n21":1, "nandagang":1, +"ngacn":1, "pingyin":1, "pinjie":1, "pp":1, @@ -6485,6 +6486,7 @@ var white_domains = {"am":{ "staticsdo":1, "stcn":1, "stdaily":1, +"steampowered":1, "steelphone":1, "stnts":1, "stockstar":1, @@ -9572,6 +9574,7 @@ var white_domains = {"am":{ "9928":1, "9998":1, "acg":1, +"acfun":1, "bilibili":1, "caoxian":1, "cnnl":1, @@ -9612,86 +9615,85 @@ var white_domains = {"am":{ var subnetIpRangeList = [ 0,1, -167772160,184549376, //10.0.0.0/8 -2886729728,2887778304, //172.16.0.0/12 -3232235520,3232301056, //192.168.0.0/16 -2130706432,2130706688 //127.0.0.0/24 +167772160,184549376, //10.0.0.0/8 +2886729728,2887778304, //172.16.0.0/12 +3232235520,3232301056, //192.168.0.0/16 +2130706432,2130706688 //127.0.0.0/24 ]; var hasOwnProperty = Object.hasOwnProperty; function check_ipv4(host) { - // check if the ipv4 format (TODO: ipv6) - // http://home.deds.nl/~aeron/regex/ - var re_ipv4 = /^\d+\.\d+\.\d+\.\d+$/g; - if (re_ipv4.test(host)) { - // in theory, we can add chnroutes test here. - // but that is probably too much an overkill. - return true; - } + // check if the ipv4 format (TODO: ipv6) + // http://home.deds.nl/~aeron/regex/ + var re_ipv4 = /^\d+\.\d+\.\d+\.\d+$/g; + if (re_ipv4.test(host)) { + // in theory, we can add chnroutes test here. + // but that is probably too much an overkill. + return true; + } } function convertAddress(ipchars) { - var bytes = ipchars.split('.'); - var result = (bytes[0] << 24) | - (bytes[1] << 16) | - (bytes[2] << 8) | - (bytes[3]); - return result >>> 0; + var bytes = ipchars.split('.'); + var result = (bytes[0] << 24) | + (bytes[1] << 16) | + (bytes[2] << 8) | + (bytes[3]); + return result >>> 0; } function isInSubnetRange(ipRange, intIp) { - for ( var i = 0; i < 10; i += 2 ) { - if ( ipRange[i] <= intIp && intIp < ipRange[i+1] ) - return true; - } + for ( var i = 0; i < 10; i += 2 ) { + if ( ipRange[i] <= intIp && intIp < ipRange[i+1] ) + return true; + } } function getProxyFromDirectIP(strIp) { - var intIp = convertAddress(strIp); - if ( isInSubnetRange(subnetIpRangeList, intIp) ) { - return direct; - } - return ip_proxy; + var intIp = convertAddress(strIp); + if ( isInSubnetRange(subnetIpRangeList, intIp) ) { + return direct; + } + return ip_proxy; } function isInDomains(domain_dict, host) { - var suffix; - var pos1 = host.lastIndexOf('.'); + var suffix; + var pos1 = host.lastIndexOf('.'); - suffix = host.substring(pos1 + 1); - if (suffix == "cn") { - return true; - } + suffix = host.substring(pos1 + 1); + if (suffix == "cn") { + return true; + } - var domains = domain_dict[suffix]; - if ( domains === undefined ) { - return false; - } - host = host.substring(0, pos1); - var pos = host.lastIndexOf('.'); + var domains = domain_dict[suffix]; + if ( domains === undefined ) { + return false; + } + host = host.substring(0, pos1); + var pos = host.lastIndexOf('.'); - while(1) { - if (pos <= 0) { - if (hasOwnProperty.call(domains, host)) { - return true; - } else { - return false; - } - } - suffix = host.substring(pos + 1); - if (hasOwnProperty.call(domains, suffix)) { - return true; - } - pos = host.lastIndexOf('.', pos - 1); - } + while(1) { + if (pos <= 0) { + if (hasOwnProperty.call(domains, host)) { + return true; + } else { + return false; + } + } + suffix = host.substring(pos + 1); + if (hasOwnProperty.call(domains, suffix)) { + return true; + } + pos = host.lastIndexOf('.', pos - 1); + } } function FindProxyForURL(url, host) { - if ( isPlainHostName(host) === true ) { - return direct; - } - if ( check_ipv4(host) === true ) { - return getProxyFromDirectIP(host); - } - if ( isInDomains(white_domains, host) === true ) { - return nowall_proxy; - } - return wall_proxy; + if ( isPlainHostName(host) === true ) { + return direct; + } + if ( check_ipv4(host) === true ) { + return getProxyFromDirectIP(host); + } + if ( isInDomains(white_domains, host) === true ) { + return nowall_proxy; + } + return wall_proxy; } - From f344d85e938f7c31f10e739e20a14c9b111bcc16 Mon Sep 17 00:00:00 2001 From: aenerv7 Date: Fri, 4 Mar 2016 10:10:21 +0800 Subject: [PATCH 2/2] Update ipip.net --- whitelist.pac | 1 + 1 file changed, 1 insertion(+) diff --git a/whitelist.pac b/whitelist.pac index 6d5d062..76b6be9 100644 --- a/whitelist.pac +++ b/whitelist.pac @@ -8795,6 +8795,7 @@ var white_domains = {"am":{ "importfood":1, "indexedu":1, "inhe":1, +"ipip":1, "irs01":1, "ishang":1, "itcpn":1,