Open brbaker opened 9 years ago
@brbaker I have a pull request pending usage of 'ip-address' module. I think this handles all the IPv4 mapped types. I would like you to review and see if this fits the bill and we can make the switch easily going forward.
ip-address: https://www.npmjs.com/package/ip-address
Pull Request: https://github.com/PaddeK/node-maxmind-db/pull/17
I'm having the same problem. Just to be sure, I took the latest version to include the pull request #17. But the issue still seems to be present. When testing with '::ffff:192.168.0.1', the Error 'Invalid IPv4 address' is thrown. Breaking this down, I found that the ip-address module doesn't validate the address as a proper IPv4 address (here)
What would be best way to tackle this problem? Manually extracting the IPv4 address before sending it to getGeoData, as @brbaker suggested?
Same issue. Error: Invalid IPv4 address
is thrown for ::ffff:127.0.0.1
.
The code doesn't properly handle IPv4 addresses that are mapped into the IPv6 address space. http://tools.ietf.org/html/rfc4291#section-2.5.5.2
Code currently passes off to the IPv4 parser when it finds a '.', however the IPv4 parser doesn't handle it. Probably best to extract the IPv4 mapped address and then pass it into the ipv4 parser.