diff --git a/README.md b/README.md index a1b87abc0..285ae0608 100644 --- a/README.md +++ b/README.md @@ -73,6 +73,7 @@ Comes with lightweight example front-end script which uses the pool's AJAX API. * https://moneropool.com * http://monero.crypto-pool.fr * https://minexmr.com +* https://moneropool.us Usage diff --git a/lib/pool.js b/lib/pool.js index 74bf83978..93850a113 100644 --- a/lib/pool.js +++ b/lib/pool.js @@ -50,6 +50,7 @@ var shareTrustMinFloat = shareTrustEnabled ? config.poolServer.shareTrust.min / var banningEnabled = config.poolServer.banning && config.poolServer.banning.enabled; +var client_ip = {}; setInterval(function(){ @@ -97,7 +98,7 @@ process.on('message', function(message) { function IsBannedIp(ip){ - if (!banningEnabled || !bannedIPs[ip]) return false; + if (!banningEnabled || !bannedIPs[ip] || ip == "127.0.0.1") return false; var bannedTime = bannedIPs[ip]; var bannedTimeAgo = Date.now() - bannedTime; @@ -616,7 +617,8 @@ var httpResponse = ' 200 OK\nContent-Type: text/plain\nContent-Length: 20\n\nmin function startPoolServerTcp(callback){ async.each(config.poolServer.ports, function(portData, cback){ - var handleMessage = function(socket, jsonData, pushMessage){ + var handleMessage = function(socket, jsonData, pushMessage, c_ip){ + c_ip = c_ip || socket.remoteAddress; if (!jsonData.id) { log('warn', logSystem, 'Miner RPC request missing RPC id'); return; @@ -641,7 +643,7 @@ function startPoolServerTcp(callback){ socket.write(sendData); }; - handleMinerMethod(jsonData.method, jsonData.params, socket.remoteAddress, portData, sendReply, pushMessage); + handleMinerMethod(jsonData.method, jsonData.params, c_ip, portData, sendReply, pushMessage); }; net.createServer(function(socket){ @@ -689,13 +691,18 @@ function startPoolServerTcp(callback){ break; } } + if (message.indexOf('PROXY TCP4') === 0) { + client_ip[socket.remotePort] = message.split(' ')[2]; + log('info', logSystem, 'Proxy V1 request %s: %s', [client_ip[socket.remotePort], message]); + continue; + } log('warn', logSystem, 'Malformed message from %s: %s', [socket.remoteAddress, message]); socket.destroy(); break; } - handleMessage(socket, jsonData, pushMessage); + handleMessage(socket, jsonData, pushMessage, client_ip[socket.remotePort]); } dataBuffer = incomplete; } diff --git a/website_example/pages/home.html b/website_example/pages/home.html index 7561a534e..fbfa4c8b9 100644 --- a/website_example/pages/home.html +++ b/website_example/pages/home.html @@ -281,6 +281,8 @@