transitive-bullshit / Ip Set
Licence: mit
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.
Stars: ✭ 28
Programming Languages
javascript
184084 projects - #8 most used programming language
ip-set
IP Address Set
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.
install
npm install ip-set
usage
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
todo
(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
credits
Original interval-tree written by galedric for torrent-stream. Ported to an isolated npm module by transitive-bullshit for webtorrent.
license
MIT. Copyright (c) Travis Fischer
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].