Skip to content
whbin edited this page Apr 11, 2016 · 1 revision

var client_ip='123.234.16.39';var cookie='BROWSER_ID82009569';alert(cookie); var DIRECT_LIST = [ ];

var BLOCK_LIST = [ ];

var PROXY_LIST = [

 "googleusercontent.com", "google*", "gmail*",
"googleapis.com", "google-analytics.com", "market.android.com", "ggpht.com", "gstatic*", "appspot.com",

"vpn", "speedtest", "golang", "twitter", "box", "t.co", "chrome.com", "chromium", "android.com", "facebook.com", "fbcdn.net", "whatismyip*", "instagram.com", "facebook.net", "shadowsocks*", "onedrive.live.com", "cdn.optimizely.com", "archive.org", "zh.wikipedia.org", "bloomberg.com", "goo.gl", "www.gagasms.co.kr", "gagasms.co.kr", "naver.com", "m.naver.com", "app.box.com", "ip138.com", ];

///////////////////////////////////////////////

var SERVER_PROXY_JP = "HTTPS hkbs.xdoor.org:48271; HTTPS hkbs.xdoor.org:48271; HTTPS jp2.xdoor.org:48271"; var SERVER_PROXY_HK = "HTTPS hkbs.xdoor.org:48271; HTTPS jp2.xdoor.org:48271; HTTPS jp2.xdoor.org:48271"; var DISABLED = "DIRECT"; var DIRECT = "DIRECT";

var LEVELS = [ {list: DIRECT_LIST, proxy: DIRECT}, {list: BLOCK_LIST, proxy: DISABLED}, {list: PROXY_LIST, proxy: SERVER_PROXY_HK}, ];

var DEFAULT_PROXY_RESULT = DIRECT;

///////////////////////////////////////////////

function getDomain(url) {

if (url.substring(0, 8) == 'file:///') {
    return url;
} else if (url.substring(0, 7) == 'http://') {
    url = url.substring(7);
} else if (url.substring(0, 8) == 'https://') {
    url = url.substring(8);
}
                                    var slashIndex = url.indexOf("/");
if (slashIndex != -1) {
    url = url.substring(0, slashIndex);
}
return url;

}

function matchDomains(url, pattern) { var domain = getDomain(url); return shExpMatch(domain, pattern) || shExpMatch(domain, "*." + pattern); }

function matchUrls(url, pattern) { return shExpMatch(url, pattern); }

function isURL(pattern) { return pattern.substring(0, 7) == 'http://' || pattern.substring(0, 8) == 'https://'; }

function doMatch(url, patternList) { for (var i = 0; i < patternList.length; i++) { var pattern = patternList[i];

    if (pattern == '') {
        continue;
    }

    if (isURL(pattern) && matchUrls(url, pattern)) {
        return true;
    } else if (matchDomains(url, pattern)) {
        return true;
    }
}

} // 浏览器将会调用的方法 function FindProxyForURL(url, host) { try { for (var i in LEVELS) { var level = LEVELS[i];

        if (doMatch(url, level.list)) {
   		 var sIPAddress=client_ip;
      	var ipAddr = sIPAddress.substring( sIPAddress.lastIndexOf('.')+1,sIPAddress.length);
            if(parseInt(ipAddr)%3==1){
                    return SERVER_PROXY_JP;
            }       else{
             	return SERVER_PROXY_HK;
			}       else{
             	return SERVER_PROXY_KR;
            }       else{
        }
    }
} catch(e) {
    alert(e);
}
return DEFAULT_PROXY_RESULT;

}

Clone this wiki locally