Sign Up for Free

RunKit +

Try any Node.js package right in your browser

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:

var ipSet = require("ip-set")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

ip-set v1.0.2

Efficient mutable set for IP addresses

ip-set travis npm

IP Address Set

browser support

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.

Works in the browser with browserify! This module is used by WebTorrent.


npm install ip-set


var ipSet = require('ip-set')(/* optionally pass an array of IP addresses to seed the set with */)
var isBlocked = ipSet.contains(exampleBlockedIP2) // isBlocked will be true

CIDR ip's are also supported

var isBlockedInList= ipSet.contains('');// isBlockedInList will be true
isBlockedInList= ipSet.contains('');// isBlockedInList will be true


(prioritized highest to lowest)

  • [x] Port IPv4 implementation from torrent-stream
  • [x] Add basic tests
  • [x] Support CIDR notation
  • [ ] Support IPv6
  • [ ] Investigate potential use of node-iptrie


Original interval-tree written by galedric for torrent-stream. Ported to an isolated npm module by transitive-bullshit for webtorrent.


MIT. Copyright (c) Travis Fischer


RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free