Show HN: Free and easy geoip API thanks to Cloudflare and Heroku
github.com
github.com
Also via json: https://ifcfg.me/json
Is this on GitHub by chance?
I suspect perhaps s/he's using an older/outdated GeoIP database/service as the AS Number returned for my IP is wrong.
The LAN address lookup (which doesn't work on Safari) is utilising a security hole in WebRTC.
If you want GeoIP details in served JS, the details should be served from an existing host on the initial page load where you can centrally manage availability/maintenance/etc.
If you are doing nodeJS or something server side, then it would be quicker to call out to established command line tools and cut out an entire internet round trip.
The MaxMind GeoLite database will give you quite a lot more information than this does, with a single call to the library, and can be delivered as part of your main page response if necessary.
The MaxMind GeoLite database also isn't reliant on CloudFlare to work.
How do you know how is your DNS server geolocated? I made a tiny proof of concept of a DNS reflector with a little extra:
$ dig +short whoami.fluffcomputing.com txt
Or in Windows:
nslookup -type=txt whoami.fluffcomputing.com
Or in PowerShell:
(Resolve-DnsName -Type txt -Name whoami.fluffcomputing.com).strings
The DB used is MaxMind's GeoLite2; so the system is as (in)accurate as the DB might be.
If you just request an A record you'll get just your DNS server IP address as other services do (e.g. whois.akamai.net).
Bigger free tier + https
"geoip": [ 0, 37.7957, -122.4209, "California", "San Francisco", "United States" ],
I've been using this recently to suggest locations when users set up a feed: https://freegeoip.net/
It uses MaxMind data.
So any computing resource where you can install the maxmind database and library "supports" GeoIP lookups.