This is a
playground to test code. It runs a full
Node.js environment and already has all of
npm’s 400,000 packages pre-installed, including
ip-set with all
npm packages installed. Try it out:
This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.
Efficient mutable set data structure optimized for use with IPv4 and IPv6 addresses. The primary use case is for working with potentially large IP blacklists.
npm install ip-set
var ipSet = require('ip-set')(/* optionally pass an array of IP addresses to seed the set with */) ipSet.add(exampleBlockedIP1) ipSet.add(exampleBlockedIP2) var isBlocked = ipSet.contains(exampleBlockedIP2) // isBlocked will be true
CIDR ip's are also supported
ipSet.add(`192.168.1.0/24`); var isBlockedInList= ipSet.contains('192.168.1.0');// isBlockedInList will be true isBlockedInList= ipSet.contains('192.168.1.255');// isBlockedInList will be true
(prioritized highest to lowest)
MIT. Copyright (c) Travis Fischer