-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
docs: dns docs for family = 0 and all = true is potentially misleading #51482
Comments
The alternative angle is to view this as a potential feature for the dns module - where the behaviour of |
The current implementation is "setting the family value to 0 and all to true will mean on a system that supports both IPv4 and IPv6, either an IPv4 or IPv6 address". If I am not wrong. :) |
PR-URL: nodejs#51517 Fixes: nodejs#51482 Reviewed-By: Paolo Insogna <paolo@cowtech.it> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
PR-URL: nodejs#51517 Fixes: nodejs#51482 Reviewed-By: Paolo Insogna <paolo@cowtech.it> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
PR-URL: nodejs#51653 Fixes: nodejs#51482 Reviewed-By: Paolo Insogna <paolo@cowtech.it> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
PR-URL: nodejs#51653 Fixes: nodejs#51482 Reviewed-By: Paolo Insogna <paolo@cowtech.it> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Affected URL(s)
https://nodejs.org/api/dns.html#dnslookuphostname-options-callback
Description of the problem
I think the docs are potentially misleading on the
family = 0
dns lookup option.Currently, the docs read: "The value 0 indicates that IPv4 and IPv6 addresses are both returned."
I initially interpreted this as "[NOT CORRECT] setting the family value to
0
and all totrue
will mean on a system that supports both IPv4 and IPv6, an IPv4 and IPv6 address will be returned"However, what I think this actually means is "setting the family value to
0
and all totrue
will mean on a system that supports both IPv4 and IPv6, either an IPv4 or IPv6 address, or both will be returned - depending on the underlying DNS implementation"As a short example demoing this behaviour (at least on Ubuntu 22.04.3, running Node v20.11.0):
Meaning if a user really does want both (rather than just accepts either), they should do two calls: one for IPv4 and one for IPv6 separately.
Some evidence for it being potentially confusing:
Also see #28159.
The text was updated successfully, but these errors were encountered: