How to use the maxmind.getLocation function in maxmind

To help you get started, we’ve selected a few maxmind examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github runk / node-maxmind / examples / city.js View on Github external
var maxmind = require('maxmind');
maxmind.init(__dirname + '/GeoLiteCity.dat');

// The returned location object has the following properties:
// countryCode, countryName, region, city, latitude, longitude
// postalCode, metroCode, dmaCode, areaCode
console.log('Location:', maxmind.getLocation('66.6.44.4'));
github bpaquet / node-logstash / test / test_214_filter_geoip.js View on Github external
var vows = require('vows'),
  geoip = require('geoip-lite'),
  maxmind = require('maxmind'),
  filter_helper = require('./filter_helper');

maxmind.init(['test/maxmind/GeoIPCity.dat', 'test/maxmind/GeoIPASNum.dat']);

var ip1 = '91.121.153.187';
var ip1_res = geoip.lookup(ip1);
var ip1_res_maxmind = maxmind.getLocation(ip1);

var ip2 = '82.66.65.173';
var ip2_res = geoip.lookup(ip2);
var ip2_res_maxmind = maxmind.getLocation(ip2);

vows.describe('Filter Geoip ').addBatch({
  'normal': filter_helper.create('geoip', 'ip', [
    {
      'titi': 'tata'
    },
    {
      'titi': 'tata',
      'ip': 'toto'
    },
    {
      'titi': 'tata',
github bpaquet / node-logstash / test / test_214_filter_geoip.js View on Github external
var vows = require('vows'),
  geoip = require('geoip-lite'),
  maxmind = require('maxmind'),
  filter_helper = require('./filter_helper');

maxmind.init(['test/maxmind/GeoIPCity.dat', 'test/maxmind/GeoIPASNum.dat']);

var ip1 = '91.121.153.187';
var ip1_res = geoip.lookup(ip1);
var ip1_res_maxmind = maxmind.getLocation(ip1);

var ip2 = '82.66.65.173';
var ip2_res = geoip.lookup(ip2);
var ip2_res_maxmind = maxmind.getLocation(ip2);

vows.describe('Filter Geoip ').addBatch({
  'normal': filter_helper.create('geoip', 'ip', [
    {
      'titi': 'tata'
    },
    {
      'titi': 'tata',
      'ip': 'toto'
    },
    {
      'titi': 'tata',
      'ip': ip1
    },
    {
      'titi': 'tata',
github runk / node-maxmind / examples / distance.js View on Github external
var maxmind = require('maxmind');
maxmind.init(__dirname + '/GeoLiteCity.dat');

var fromLocation = maxmind.getLocation('66.6.44.4');
var toLocation = maxmind.getLocation('213.180.193.3');

console.log('From:\t', fromLocation.countryName, fromLocation.city);
console.log('To:\t', toLocation.countryName, toLocation.city);
console.log('Dist:\t', toLocation.distance(fromLocation));
github runk / node-maxmind / examples / time_zone.js View on Github external
var maxmind = require('maxmind');
var timeZone = require('maxmind/lib/time_zone');

maxmind.init(__dirname + '/GeoLiteCity.dat');

var location = maxmind.getLocation('66.6.44.4');

console.log('countryCode\t', location.countryCode);
console.log('countryName\t', location.countryName);
console.log('timeZone\t', timeZone(location.countryCode, location.region));
github runk / node-maxmind / examples / distance.js View on Github external
var maxmind = require('maxmind');
maxmind.init(__dirname + '/GeoLiteCity.dat');

var fromLocation = maxmind.getLocation('66.6.44.4');
var toLocation = maxmind.getLocation('213.180.193.3');

console.log('From:\t', fromLocation.countryName, fromLocation.city);
console.log('To:\t', toLocation.countryName, toLocation.city);
console.log('Dist:\t', toLocation.distance(fromLocation));

maxmind

IP lookup using Maxmind databases

MIT
Latest version published 25 days ago

Package Health Score

86 / 100
Full package analysis