Replies: 1 comment
-
|
Got uses If you want to use import dns from 'dns/promises';
await got('https://example.com', {
dnsLookup: async (hostname) => {
const addresses = await dns.resolve4(hostname);
return {address: addresses[0], family: 4};
}
});For DNS caching, you can use the I think the current approch of using |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
The module uses dns.lookup for dns requests. While dns.lookup uses OS-level caches, it is based on synchronous gethostbyname call and can be a problem (https://nodejs.org/api/dns.html#implementation-considerations). Got has its own dns cache, so isn't it better to use dns.resolve instead?
Also, it allows to use dns.Resolver object, which allows more customization
Beta Was this translation helpful? Give feedback.
All reactions