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.
const IPSet = require('ip-set')const ipSet = new IPSet(/* optionally pass an array of IP addresses to seed the set with */)ipSet.add(exampleBlockedIP1)ipSet.add(exampleBlockedIP2)let isBlocked = ipSet.contains(exampleBlockedIP2) // isBlocked will be true
CIDR ip's are also supported
ipSet.add(`192.168.1.0/24`)let isBlockedInList = ipSet.contains('192.168.1.0') // isBlockedInList will be trueisBlockedInList = ipSet.contains('192.168.1.255') // isBlockedInList will be true