An experiment in using hypertrie to host a peer-to-peer geo ip lookup database.
The data from MaxMind GeoLite2 is loaded into a hypertrie.
npm install -g @jimpick/dat-geoip
There is a CLI to look up an IP address:
$ dat-geoip 66.6.44.4
{
"ip": "66.6.44.4",
"network": "66.6.32.0/20",
"geonameId": 5128581,
"registeredCountryGeonameId": 6252001,
"representedCountryGeonameId": 0,
"isAnonymousProxy": false,
"isSatelliteProvider": false,
"postalCode": "10010",
"latitude": 40.7391,
"longitude": -73.9826,
"accuracyRadius": 1000,
"localeCode": "en",
"continentCode": "NA",
"continentName": "North America",
"countryIsoCode": "US",
"countryName": "United States",
"subdivision1IsoCode": "NY",
"subdivision1Name": "New York",
"subdivision2IsoCode": "",
"subdivision2Name": "",
"cityName": "New York",
"metroCode": "501",
"timeZone": "America/New_York",
"isInEuropeanUnion": false
}
This software is MIT licensed.
The data that gets loaded into it from MaxMind has this license:
This product includes GeoLite2 data created by MaxMind, available from
<a href="http://www.maxmind.com">http://www.maxmind.com</a>.