Skip to content
 
 

Latest commit

 

History

22 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ipdb Build Status

IP lookup using IPIP.net database

Free databases available for download here. If you need better accuracy you should consider buying commercial subscription.

Install

$ npm install ipdb

Usage

const IPDB = require('ipdb');
const ipdb = new IPDB('./data/ipipfree.ipdb');

ipdb.find('183.62.57.1');
/*
{
  code: 0,
  data: {
    country_name: '中国',
    region_name: '广东',
    city_name: '广州',
    bitmask: 18,
    ip: '183.62.57.1'
  }
}
*/

API

ipdb = new IPDB(file, [options])

file

Type: string | Buffer

The ipdb database pathname (string) or contents (buffer).

options

Type: object

patches

Type: array Default: []

See Patches

ipdb.find(ip, [options])

Return a result object

ip

Type: string

options

Type: object

language

Type: string Default: CN

patches

Type: array Default: []

See Patches

Patches

  • @ipdb/iso3166 - IPIP.net database patches (ISO-3166)
  • @ipdb/cac - IPIP.net database patches (中国行政区划代码)
  • @ipdb/range - IPIP.net database patches (range of cidr)

Related

License

MIT © metowolf

About

IP lookup using IPIP.net database

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages