Optional
cacheOptional
resolversA set of resolvers used to answer DNS queries
String keys control which resolvers are used for which TLDs.
import { dns } from '@multiformats/dns'
import { dnsOverHttps } from '@multiformats/dns'
const resolver = dns({
resolvers: {
// only used for .com domains
'com.': dnsOverHttps('https://example-1.com'),
// only used for .net domains, can be an array
'net.': [
dnsOverHttps('https://example-2.com'),
dnsOverHttps('https://example-3.com'),
],
// used for everything else (can be an array)
'.': dnsOverHttps('https://example-4.com')
}
})
To avoid repeating DNS lookups, successful answers are cached according to their TTL. To avoid exhausting memory, this option controls how many answers to cache.