runet-censorship-bypass/pac-generator/src/blocked-hosts-hash.js

13 lines
377 B
JavaScript
Raw Normal View History

2015-11-28 12:20:45 +03:00
'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 )
};