PaddeK / node-maxmind-db

This is the pure Node API for reading MaxMind DB files. MaxMind DB is a binary file format that stores data indexed by IP address subnets (IPv4 or IPv6).
GNU Lesser General Public License v2.1
88 stars 25 forks source link

IPv6 not resolved by JS, when PHP works OK #6

Closed tybulewicz closed 10 years ago

tybulewicz commented 10 years ago

Using GeoIP2-Country database I have some problems with IPv6 addresses. I'm using the same database file (GeoIP2-Country.mmdb md5sum: dae3c9bc2f4b780ba114abb555be94a8)

countries.getGeoData('2a00:1450:4001:c02::8a') returns null When using the PHP Api and on http://www.maxmind.com/en/geoip_demo resolves to IE

countries.getGeoData('2600:1010:b00e:4658:488b:55d4:86a4:3c61') throws Error: MaxmindDBReader: Unable to find IP:2600:1010:b00e:4658:488b:55d4:86a4:3c61 in Database When using the PHP Api and on http://www.maxmind.com/en/geoip_demo resolves to US

oschwald commented 10 years ago

I briefly looked at the code and there doesn't seem to be any parsing for IPv6 addresses. See this line. Once parsing of the addresses into byte arrays is added, I think most of the rest of the code should work without modification.