Socket
Socket
Sign inDemoInstall

@chainsafe/netmask

Package Overview
Dependencies
1
Maintainers
3
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @chainsafe/netmask

Typescript implementation of netmask filtering


Version published
Weekly downloads
29K
increased by0.9%
Maintainers
3
Install size
56.4 kB
Created
Weekly downloads
 

Readme

Source

@chainsafe/netmask

Zero dependency typescript implementation for using netmasks with both ipv4 and ipv6. Heavily inspired by go implementation.

Features

  • IPv4 and IPv6 support
  • Zero dependencies
  • Typescript support

How to use

npm i -s @chainsafe/netmask

or yarn add @chainsafe/netmask

Example usage:

import {cidrContains, networkMaskContains} from "@chainsafe/netmask"

cidrContains("192.168.0.1/24", "192.168.0.16")
cidrContains("2001:db8::/128", "2001:db8::")
networkMaskContains("192.168.0.1", "255.255.255.0", "192.168.0.16")

Quick start

  1. yarn
  2. yarn run build
  3. yarn run test

FAQs

Last updated on 16 Jan 2023

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc