mirror of
https://github.com/anticensority/runet-censorship-bypass.git
synced 2024-11-28 04:13:43 +03:00
28 lines
641 B
JavaScript
28 lines
641 B
JavaScript
|
'use strict';
|
||
|
|
||
|
module.exports = (hosts, ips, generator, generatePac) => {
|
||
|
|
||
|
function ifProxyByPlainSwitch(host) {
|
||
|
|
||
|
function ifBlocked(host) {
|
||
|
switch( host ) {
|
||
|
//CASES
|
||
|
}
|
||
|
return false;
|
||
|
}
|
||
|
|
||
|
var doms = host.split('.');
|
||
|
|
||
|
for( var endi = doms.length-1; endi >= 0; --endi )
|
||
|
if (ifBlocked( doms.slice( endi ).join('.') ))
|
||
|
return true;
|
||
|
return false;
|
||
|
}
|
||
|
|
||
|
var cases = hosts.map( host => 'case "'+host+'":' ).join('\n') +'\nreturn true;';
|
||
|
var ifProxyString = ifProxyByPlainSwitch.toString().replace('//CASES', cases);
|
||
|
|
||
|
return generatePac( ifProxyString, 'host' );
|
||
|
|
||
|
}
|