I'm making a ban-by-IP system for my game's server(which was made using the "nodejs-websocket" module), and I need a reliable way to get the client's IP to make sure that a client banned stays banned. The problem is, whenever I try doing so through the server, the object that was supposed to contain the IP has instead "::1"
According to what I've found, this result "::1" is a loopback address in IPv6, but even when connecting to the server using another IP it has the same result.
So far I've tried using the code "connection.socket.remoteAddress" which is supposed to return the connection(client)'s IP address, since connection.socket exposes the net.Socket instance, but it didn't work. I've been trying to google another way to do that(and alternatives to that method), but I couldn't find much
var ws = require("nodejs-websocket")
var server = ws.createServer(function (connection) {
console.log(connection.socket.remoteAddress)
}).listen(1000);
new WebSocket("ws://localhost:1000");
no errors are thrown, and as said before it just returns "::1". Any ideas to fix this?