doc: update family = 0 in dns.md#51483
doc: update family = 0 in dns.md#51483duncanchiu409 wants to merge 2 commits intonodejs:mainfrom duncanchiu409:main
Conversation
|
Review requested:
|
domdomegg
left a comment
There was a problem hiding this comment.
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: https://github.com/domdomegg/nodejs-dns-lookup-family-testing/actions/runs/7549295297 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