Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ip2region

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ip2region

ip/ipv6 to geo database, IP(支持IPv6)地址到区域运营商

  • 2.3.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

NPM version build status Test coverage David deps node version npm download npm license

node-ip2region

IP 地址到区域运营商 IP(支持 IPv6) to region on Node.js

安装使用使用

$ npm install ip2region --save
// 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: '中国', province: '广东省', city: '深圳市', isp: '阿里云' }
const res2 = query.search('240e:47d:c20:1627:30a3:ba0d:a5e6:ec19');
console.log(res2);
> { country: "中国", province: "广东省", city: "", isp: "中国电信" }

配置

  • ipv4db: ipv4 数据库地址
  • ipv6db: ipv6 数据库地址
  • disableIpv6: 关闭 ipv6 查询功能(减少内存占用)
import IP2Region from "ip2region";
const query = new IP2Region({
  ipv4db: "/tmp/db4.db",
  ipv6db: "/tmp/db6.db",
  disableIpv6: true,
});

Keywords

FAQs

Package last updated on 25 May 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc