GeoIP query tool with AS Number
GeoIP data from geoip-lite using MaxMind's GeoLite2 database
ASN data from APNIC (data-raw-table) (data-used-autnums)
Update GeoLite2 database to better results
cd node_modules/geoip-lite
npm run-script updatedb license_key=[KEY]
You can get free license key in MaxMind
npm i geoipasn
ESM
import geoip from 'geoipasn';
const data = geoip('12.34.56.78');
console.log(data);
CJS
const geoip = require('geoipasn').default;
const data = geoip('12.34.56.78');
console.log(data);
Result
{
ip: IP { label: '12.34.56.78' },
country: { code: 'US', name: 'United States of America' },
region: 'Ohio',
city: 'Dayton',
coordinate: { latitude: 39.6438, longtitude: -84.1743, range: 5 },
timezone: 'America/New_York',
time: 2022-09-24T02:47:59.000Z,
as: { number: 7018, name: 'ATT-INTERNET4' },
service: ''
}
// Get AS number of IP
const data = geoip.asn('12.34.56.78');
console.log(data);
Result
{ ip: IP { label: '12.34.56.78' }, number: 7018, name: 'ATT-INTERNET4' }