-
Notifications
You must be signed in to change notification settings - Fork 513
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add dns caching by default #2440
Comments
Hi,
|
can you state some instructions, where its code should be written? |
Hey! However, I'm facing difficulty locating the specific code related to fetch requests and DNS resolution commands within the files. Your help in navigating and identifying these components would be immensely appreciated! |
"I can come up with ways to approach this issue Planning to add DNS cache lookup. Considering two ways: 1) Middleware like HTTP dispatcher in 'lib,' or 2) Custom Resolver globally. would appreciate if I can get a head's up on the approach and which one will be better(if any) !!! @ronag |
The more pragmatic the approach, the better; I'd suggest you take a look at how Socket#connect handles the |
I had a look last evening and the easiest way I think is to do like @metcoder95 suggest by using the lookup option in the socket module. My PR is not yet ready, need to finish implementation and refactor a bit. This was mostly to play and see if it works. Not sure how to make it configurable in the fetch method to keep it rfc compliant. |
We add an optional custom lookup function to that has the same interface as the lookup option in TCP/UDP socket.connect. This allows users of this library to implement their own DNS caching implementation. This does not preclude the future possibility of including a DNS caching implementation by default.
We add an optional custom lookup function to that has the same interface as the lookup option in TCP/UDP socket.connect. This allows users of this library to implement their own DNS caching implementation. This does not preclude the future possibility of including a DNS caching implementation by default.
@ronag feel free to reopen but as you mentioned it's already possible to do this import CacheableLookup from 'cacheable-lookup';
const cacheable = new CacheableLookup(opts)
const agent = new Agent({
connect: { lookup: cacheable.lookup }
}) |
No strong opinion on this, but I see the potential in having it within core; maybe it will require more thought but as @KhafraDev suggests, is already doable by third-party |
Something like: https://github.com/szmarczak/cacheable-lookup#readme
Should be an option to disable.
The text was updated successfully, but these errors were encountered: