@ipdb/range
Version:
IPIP.net database patches (IP Range of CIDR)
56 lines (41 loc) • 952 B
Markdown
# ipdb-range
> IPIP.net database patches (IP Range of CIDR)
Free databases available for [download here](https://www.ipip.net/free_download/). If you need better accuracy you should consider buying [commercial subscription](https://www.ipip.net/product/ip.html#ipv4city).
## Install
```
$ npm install @ipdb/range
```
## Patches
|value|
|---|
|range|
## Usage
```js
const IPDB = require('ipdb');
const ipdb_range = require('@ipdb/range');
const ipdb = new IPDB('./data/ipipfree.ipdb', {
patches: [ipdb_range]
});
ipdb.find('183.62.57.1');
/*
{
code: 0,
data: {
country_name: '中国',
region_name: '广东',
city_name: '广州',
bitmask: 18,
range: {
from: '183.62.0.0',
to: '183.62.63.255',
next: '183.62.64.0'
},
ip: '183.62.57.1'
}
}
*/
```
## Related
- [ipdb](https://github.com/metowolf/ipdb) - IP lookup using IPIP.net database
## License
MIT © [metowolf](https://i-meto.com/)