interface Options {
    cache?: CacheInstance;
    maxTtl?: number;
    resolver?: Resolver | Resolver;
    fallbackDuration?: number;
    errorTtl?: number;
    lookup?: false | typeof lookup;
}

Properties

Custom cache instance. If undefined, it will create a new one.

undefined
maxTtl?: number

Limits the cache time (TTL). If set to 0, it will make a new DNS query each time.

Infinity
resolver?: Resolver | Resolver

DNS Resolver used to make DNS queries.

new dns.promises.Resolver()
fallbackDuration?: number

When the DNS server responds with ENOTFOUND or ENODATA and the OS reports that the entry is available, it will use dns.lookup(...) directly for the requested hostnames for the specified amount of time (in seconds).

If you don't query internal hostnames (such as localhost, database.local etc.), it is strongly recommended to set this value to 0.

3600
errorTtl?: number

The time how long it needs to remember failed queries (TTL in seconds).

Note: This option is independent, options.maxTtl does not affect this.

0.15
lookup?: false | typeof lookup

The fallback function to use when the DNS server responds with ENOTFOUND or ENODATA.

Note: This has no effect if the fallbackDuration option is less than 1.

dns.lookup