You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
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
Version published
Weekly downloads
230K
-12.13%
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

ip

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