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

ip-range-check

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ip-range-check

Check whether an IP(v4 or v6) is in an CIDR range

  • 0.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
480K
increased by10.51%
Maintainers
1
Weekly downloads
 
Created

What is ip-range-check?

The ip-range-check npm package is used to check if an IP address falls within a specified range of IP addresses. It supports both IPv4 and IPv6 addresses and can handle CIDR notation, IP ranges, and individual IP addresses.

What are ip-range-check's main functionalities?

Check if an IP is within a CIDR range

This feature allows you to check if a given IP address falls within a specified CIDR range. In this example, the IP '192.168.1.5' is checked against the CIDR range '192.168.1.0/24'.

const ipRangeCheck = require('ip-range-check');
const ip = '192.168.1.5';
const range = '192.168.1.0/24';
const result = ipRangeCheck(ip, range);
console.log(result); // true

Check if an IP is within a range of IPs

This feature allows you to check if a given IP address falls within a specified range of IP addresses. In this example, the IP '192.168.1.5' is checked against the range ['192.168.1.1', '192.168.1.10'].

const ipRangeCheck = require('ip-range-check');
const ip = '192.168.1.5';
const range = ['192.168.1.1', '192.168.1.10'];
const result = ipRangeCheck(ip, range);
console.log(result); // true

Check if an IP is within multiple ranges

This feature allows you to check if a given IP address falls within any of multiple specified ranges. In this example, the IP '192.168.1.5' is checked against the ranges '192.168.1.0/24' and ['10.0.0.1', '10.0.0.10'].

const ipRangeCheck = require('ip-range-check');
const ip = '192.168.1.5';
const ranges = ['192.168.1.0/24', ['10.0.0.1', '10.0.0.10']];
const result = ipRangeCheck(ip, ranges);
console.log(result); // true

Other packages similar to ip-range-check

Keywords

FAQs

Package last updated on 21 Jun 2019

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