package
download and parse ip-set (blocklist) files
npm install load-ip-setGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Tagged topics.
Estimated unpacked size across 16 packages.
1.0 MB
Includes dependencies.
6 direct dependencies.
^1.4.0
1.4.0
^1.0.1
1.0.1
^3.0.0
3.0.0
^2.0.1
2.1.1
^1.2.3
1.2.3
^1.0.1
1.0.3
This module is used by WebTorrent!
npm install load-ip-setGiven one of the following:
{ start: '1.2.3.0', end: '1.2.3.255' } ip rangesthis module loads the ip set (downloading from the network, if necessary) and returns an ip-set object. An ip-set is just a mutable set data structure optimized for use with IPv4 and IPv6 addresses.
import loadIPSet from 'load-ip-set'
loadIPSet('http://example.com/list.txt', (err, ipSet) => {
if (err) throw err
ipSet.contains('1.2.3.4') //=> true
ipSet.contains('2.2.2.2') //=> false
})The second argument can be an optional opts object which will be passed to
simple-get and the node.js core http.request
method. This is useful for setting the user agent, for example.
loadIPSet('http://example.com/list.txt', {
headers: {
'user-agent': 'WebTorrent (http://webtorrent.io)'
}
}, (err, ipSet) => {
})MIT. Copyright (c) Feross Aboukhadijeh and WebTorrent, LLC.
mafintosh
mathiasbuus@gmail.com