diff --git a/proxy/proxy.js b/proxy/proxy.js index afcb9f24..ae1d77b8 100755 --- a/proxy/proxy.js +++ b/proxy/proxy.js @@ -28,7 +28,7 @@ var proxymap = { }; // Avoid DDOS -var bannedIPs = ['212.44.42.5']; +var bannedIPs = []; // Ghetto hack for error page var getErrorPage = function (title, code, error) { @@ -57,20 +57,26 @@ fs.watchFile(config.opt.proxy_table_file, function (oldts, newts) { }); }); -fs.watchFile(__dirname + '/ips.json', function(oldts, newts){ - fs.readFile(__dirname + '/ips.json', function(err, data){ +function readIP (){ + return fs.readFile(__dirname + '/ips.json', function(err, data){ if (err) { log.info('Can\'t load the ips (read)'); } else { try { - bannedIPs = JSON.parse(data) - log.info('ips updated') + bannedIPs = JSON.parse(data); + log.info('ips updated'); } catch (exc) { - log.warn(exc) + log.warn(exc); } } - }) -}) + }); +} + +fs.watchFile(__dirname + '/ips.json', function(oldts, newts){ + return readIP(); +}); + +readIP(); //Don't crash br0 process.on('uncaughtException', function (err) {