4.0.2 • Published 2 years ago
dnsbl v4.0.2
dnsbl
Query DNS-based blackhole lists
Support both IPv4 and IPv6 queries.
Installation
$ npm i dnsblUsage
import {lookup, batch} from 'dnsbl';
await lookup('127.0.0.2', 'zen.spamhaus.org');
// true
await lookup('127.0.0.2', 'zen.spamhaus.org', {includeTxt: true});
// {
// listed: true,
// txt: [['some txt'], ['another txt']]
// }
await batch(['1.2.3.4', '5.6.7.8'], ['dnsbl.somelist.net', 'dnsbl.someotherlist.net']);
// [
// { blacklist: 'dnsbl.somelist.net', address: '1.2.3.4', listed: true },
// { blacklist: 'dnsbl.somelist.net', address: '5.6.7.8', listed: false },
// { blacklist: 'dnsbl.someotherlist.net', address: '1.2.3.4', listed: true },
// { blacklist: 'dnsbl.someotherlist.net', address: '5.6.7.8', listed: false }
// ]API
lookup(address, blacklist, options)
address: string an IP address.blacklist: string the hostname of the blacklist to query.
Returns a Promise that resolves to true or false, indicating if the address is listed (e.g. the DNS query returned a non-empty result). Will reject on error.
If the includeTxt option is set, it will return an Object with these properties:
listedboolean - a boolean indicating if the address is listed on the blacklist.txtstring[] - an array of resolved TXT records for the address.
batch(addresses, blacklists, options)
addressesstring or Array - one or more IP addresses.blacklistsstring or Array - one or more blacklist hostnames.
Returns a Promise that resolve to a results object (see below).
options object
serversstring or Array - DNS servers to use. Pass a falsy value to use the system resolvers. Default:['208.67.220.220', '208.67.222.222', '2620:119:35::35', '2620:119:53::53'].timeoutnumber - timout in milliseconds. Default:5000.concurrencynumber - number of concurrent queries. Default:64.includeTxtboolean - include txt records if IP is blacklisted. Default:false.
results object
The results object is an array of objects with these properies:
addressstring - the IP address.blackliststring - the blacklist hostname.listedboolean - a boolean indicating if the address is listed on the blacklist.txtstring[] - an array of resolved TXT records for the address.
© silverwind, distributed under BSD licence
4.0.2
2 years ago
4.0.1
2 years ago
4.0.0
3 years ago
3.2.0
6 years ago
3.1.1
7 years ago
3.1.0
7 years ago
3.0.0
7 years ago
2.0.0
7 years ago
1.1.11
8 years ago
1.1.10
8 years ago
1.1.9
8 years ago
1.1.8
9 years ago
1.1.7
9 years ago
1.1.6
9 years ago
1.1.5
9 years ago
1.1.4
9 years ago
1.1.3
9 years ago
1.1.2
9 years ago
1.1.1
9 years ago
1.1.0
9 years ago
1.0.0
9 years ago
0.1.2
10 years ago
0.1.1
11 years ago
0.1.0
11 years ago