From 60726f0795a96500544cffcd0c1581d4c2505480 Mon Sep 17 00:00:00 2001 From: Ayushya Chitransh Date: Tue, 13 Feb 2018 14:44:21 +0530 Subject: [PATCH 1/2] Use latest version for getting location info Previous version was returning incorrect location data. I verified that using newer version gives correct results. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 1d202cc..4eafcb2 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "d3": "3.5.6", "debug": "2.2.0", "express": "4.13.3", - "geoip-lite": "1.1.6", + "geoip-lite": "1.2.1", "grunt": "^0.4.5", "grunt-contrib-clean": "^0.6.0", "grunt-contrib-concat": "^0.5.1", From d9523870306f2db241977652cc201dd1b8d77d6a Mon Sep 17 00:00:00 2001 From: Ayushya Chitransh Date: Tue, 13 Feb 2018 14:52:45 +0530 Subject: [PATCH 2/2] Using corrected IP address IP address being received had `:ffff` at the starting, it needs to be corrected before setting correct IP for node. Closes #99 --- lib/node.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/node.js b/lib/node.js index 8e4f9ca..454fa54 100644 --- a/lib/node.js +++ b/lib/node.js @@ -102,6 +102,9 @@ Node.prototype.setInfo = function(data, callback) Node.prototype.setGeo = function(ip) { + if (ip.substr(0, 7) == "::ffff:") { + ip = ip.substr(7) + } this.info.ip = ip; this.geo = geoip.lookup(ip); }