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

ipop

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ipop

IP subnet calculator

  • 0.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

ipop

IP subnet calculator. One can also use it to check if IP is in subnet.

Install

npm install ipop

Usage

Example

var ipop = require('ipop');

// check if IP in subnet
console.log(ipop.ip4incidr('192.168.1.15', '192.168.0.1/24'));
console.log(ipop.ip4incidr('192.168.1.15', '192.168.0.1/16'));
console.log(ipop.ip4incidr('192.168.1.15', '192.168.1.15/32'));

// show subnet info
console.log(ipop.cidr4('87.239.88.1/22'));

Output:

false
true
true
{ net: '87.239.88.0',
  netmask: '255.255.252.0',
  broadcast: '87.239.91.255',
  low: '87.239.88.1',
  high: '87.239.91.254',
  hosts: 1022 }

Documentation

ip4incidr(ip, cidr)

check if ip is in given cidr. Returns boolean. cidr has to be in format X.X.X.X/X.

cidr4(cidr)

cidr4 returns object with info about given cidr:

  • net: network address
  • netmask: network mask
  • broadcast: broadcast address
  • low: first usable host address
  • high: last usable host address
  • hosts: number of usable hosts

Keywords

FAQs

Package last updated on 27 Feb 2014

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