Uses ip-api.com to query for information.
ip-api.com will automatically ban any IP addresses doing over 150 requests per minute. To unban your IP click here.
You are free to use ip-api.com for non-commercial use. ip-api.com does not allow commercial use without prior approval.
For commercial, unlimited use see ip-api.com pro service.
npm i --save ip-locator
var ipLocator = require('ip-locator')
ipLocator.getDomainOrIPDetails(IpOrhostnameString, ResponseTypeString, function (err, data, quota) {
console.log(data);
console.log(quota);
});
ipLocator.getDomainOrIPDetails(IpOrhostnameString, ResponseTypeString)
.then(function(result) {
console.log(result.data);
console.log(result.quota);
})
.catch(function(error) {
console.log(error);
});
const result = await ipLocator.getDomainOrIPDetails(IpOrhostnameString, ResponseTypeString);
{
secondsToReset, // how many secons until remaining requests count will be reset
requestsRemaining // how many requests can be sent
};
- json
- xml
- csv
- line
var ipLocator = require('ip-locator')
ipLocator.getDomainOrIPDetails('google.com','json', function (err, data) {
console.log(data)
});
Outputs:
{ as: 'AS15169 Google Inc.',
city: 'Mountain View',
country: 'United States',
countryCode: 'US',
isp: 'Google',
lat: 37.4192,
lon: -122.0574,
org: 'Google',
query: '74.125.130.101',
region: 'CA',
regionName: 'California',
status: 'success',
timezone: 'America/Los_Angeles',
zip: '94043' }