'Nodejs ipv4, ipv6 geolocalization

U use this to get user ip in node js

req.headers['x-forwarded-for'] ||  req.socket.remoteAddress ||  null

but sometimes its return ipv6. Exist method to get only ipv4? Or get geolocalization over ipv6? (geoip-lite and fast-geoip dont return geolocalization over ipv6 ;()



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source