/
githubmirror
/
XX-Net
Обзор
Документация
Войти
/
githubmirror
/
XX-Net
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
code/default/smart_router/local/proxy.pac
45 строк
1 KB
Michael.X
3.9.4, Improve SmartRouter
11 янв 2018, 09:47
11 янв 2018, 09:47
029a865
Код
Авторство
О чём код?
/** * fork from genpac 2.0.1 https://github.com/JinnLynn/genpac * GFWList From: online[https://raw.githubusercontent.com/gfwlist/gfwlist/master/gfwlist.txt] */ var black_list = [ "BLACK_LIST" ]; var white_list = [ "WHITE_LIST" ]; var proxy = 'PROXY PROXY_LISTEN'; function FindProxyForURL(url, host) { for (var i = 0; i < white_list.length; i++) { var host_end = white_list[i]; if (host == host_end || host.endsWith('.' + host_end)) { return 'DIRECT'; } } for (var i = 0; i < black_list.length; i++) { var host_end = black_list[i]; if (host == host_end || host.endsWith('.' + host_end)) { return proxy; } } return 'DIRECT'; } // REF: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith if (!String.prototype.endsWith) { String.prototype.endsWith = function(searchString, position) { var subjectString = this.toString(); if (typeof position !== 'number' || !isFinite(position) || Math.floor(position) !== position || position > subjectString.length) { position = subjectString.length; } position -= searchString.length; var lastIndex = subjectString.indexOf(searchString, position); return lastIndex !== -1 && lastIndex === position; }; }