-
Notifications
You must be signed in to change notification settings - Fork 30k
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
doc: update family = 0 in dns.md #51483
Conversation
Review requested:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is still not quite clear: this suggests only one will be returned. But on systems both are!
I also think we should update the dns promises and other relevant documentation to match, not just this one instance.
The documentation said it won't return both, quoting this from https://man7.org/linux/man-pages/man3/getaddrinfo.3.html
I am not sure if there is any system exception. |
On my system only one is returned. But some systems do seem to return multiple, e.g. whatever this is using under the hood: https://www.jdoodle.com/execute-nodejs-online/ (try I'm not sure which systems do act like this though. |
Interestingly it looks like on all configurations I could see on GitHub actions both IPv4 and IPv6 addresses are returned: This is strange, given running ubuntu 22.04 myself (which corresponds to ubuntu-latest in GitHub actions today) on Node 21 only returns IPv4. But my machine does support both given it can get IPv6 addresses when setting family = 6. Odd. |
You are specifying When Was I able to clarify it? |
I was expecting |
I close this PR in-order to open a new PR for clarification. |
I don't think this correct. On my system only one IP is returned, despite both being available: require('node:dns').lookup('localhost', { all: true, family: 0 }, console.log)
// null [ { address: '127.0.0.1', family: 4 } ]
require('node:dns').lookup('localhost', { all: true, family: 4 }, console.log)
// null [ { address: '127.0.0.1', family: 4 } ]
require('node:dns').lookup('localhost', { all: true, family: 6 }, console.log)
// null [ { address: '::1', family: 6 } ] It's that this is inconsistent between systems: some return one, some return both - and the docs don't reflect that (and it leads to this kind of confusion!). |
On my system (MacOS) both are returned when using |
Fixes: #51482
First PR, please tell me if there is anything wrong. Thanks HEHE