runet-censorship-bypass/pac-generator/src/blocked-hosts-hash.js
2016-05-08 21:14:08 +05:00

13 lines
377 B
JavaScript
Executable File

'use strict';
module.exports = (hosts, ips, generator, generatePac) => {
var hostsHash = {'': true};
hosts.forEach( host => hostsHash[host] = true );
function ifProxyByHash(host, hostsHash) {
while(!hostsHash[host])
host = (host+'.').replace(/^\w*\./g);
return host.length !== 0;
}
return generatePac( ifProxyByHash, 'host', hostsHash )
};