Dark Mode

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

yourtion/node-ip2region

Repository files navigation

node-ip2region

IP Di Zhi Dao Qu Yu Yun Ying Shang IP(Zhi Chi IPv6) to region on Node.js

An Zhuang Shi Yong Shi Yong

$ npm install ip2region --save
{ country: 'Zhong Guo ', province: 'Yan Dong Sheng ', city: 'Shen Zhen Shi ', isp: 'A Li Yun ' } const res2 = query.search('240e:47d:c20:1627:30a3:ba0d:a5e6:ec19'); console.log(res2); > { country: "Zhong Guo ", province: "Yan Dong Sheng ", city: "", isp: "Zhong Guo Dian Xin " }">// const IP2Region = require('ip2region').default;
import IP2Region from "ip2region";
const query = new IP2Region();
const res = query.search('120.24.78.68');
console.log(res);
> { country: 'Zhong Guo ', province: 'Yan Dong Sheng ', city: 'Shen Zhen Shi ', isp: 'A Li Yun ' }
const res2 = query.search('240e:47d:c20:1627:30a3:ba0d:a5e6:ec19');
console.log(res2);
> { country: "Zhong Guo ", province: "Yan Dong Sheng ", city: "", isp: "Zhong Guo Dian Xin " }

Pei Zhi

  • ipv4db: ipv4 Shu Ju Ku Di Zhi
  • ipv6db: ipv6 Shu Ju Ku Di Zhi
  • disableIpv6: Guan Bi ipv6 Cha Xun Gong Neng (Jian Shao Nei Cun Zhan Yong )
import IP2Region from "ip2region";
const query = new IP2Region({
ipv4db: "/tmp/db4.db",
ipv6db: "/tmp/db6.db",
disableIpv6: true,
});