-
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: argument types for dns methods #11764
Conversation
14835e3
to
ceb43e9
Compare
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.
Once more, thanks for doing this! ❤
doc/api/dns.md
Outdated
|
||
With the `all` option set to `true`, the arguments change to | ||
AAAA (IPv6) record. All `option` properties are optional. If `options` is an | ||
integer, then it must be `4` or `6`- if `options` is not provided, then IPv4 |
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.
Can you leave a space after the `6`
? Also, if you’re using a dash, here’s an en dash to copy: – 😄
doc/api/dns.md
Outdated
- `callback(err, hostname, service)` {Function} | ||
- `err` {Error} | ||
- `hostname` {string} Eg: `localhost` | ||
- `service` {string} Eg: `http` |
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 we’ve pretty much settled on e.g.
in the docs
|
||
Uses the DNS protocol to resolve a start of authority record (`SOA` record) for | ||
the `hostname`. The `addresses` argument passed to the `callback` function will | ||
the `hostname`. The `address` argument passed to the `callback` function will |
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.
Hm, should it be `callback(err, address)`
above?
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.
Updated. 😸
ceb43e9
to
afaf206
Compare
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.
Nice! Thanks.
doc/api/dns.md
Outdated
- `hostname` {string} | ||
- `options` {integer | Object} | ||
- `family` {integer} The record family. Must be `4` or `6`. IPv4 | ||
and v6 addresses are both valid by default. |
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.
"IPv6"
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.
"both returned by default"?
doc/api/dns.md
Outdated
With the `all` option set to `true`, the arguments change to | ||
AAAA (IPv6) record. All `option` properties are optional. If `options` is an | ||
integer, then it must be `4` or `6` – if `options` is not provided, then IPv4 | ||
and IPv6 addresses are both valid. |
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.
valid -> "returned if found"?
doc/api/dns.md
Outdated
- `port` {number} | ||
- `callback(err, hostname, service)` {Function} | ||
- `err` {Error} | ||
- `hostname` {string} e.g. `localhost` |
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.
'example.com' would make a better example, localhost is a unusual host, it isn't even required to be resolved by a DNS server
doc/api/dns.md
Outdated
@@ -147,6 +139,12 @@ on some operating systems (e.g FreeBSD 10.1). | |||
<!-- YAML | |||
added: v0.11.14 | |||
--> | |||
- `address` {string} | |||
- `port` {number} | |||
- `callback(err, hostname, service)` {Function} |
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 don't know if it's customary to include the arguments in this line. Rather if I recall correctly it's just `callback` {Function}
.
doc/api/dns.md
Outdated
- `rrtype` {string} | ||
- `callback(err, addresses)` {Function} | ||
- `err` {Error} | ||
- `addresses` {Array} |
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.
Include the type of array members also
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.
The type of the contents of this array depend on rrtype
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 changed it to {string[] | Object[] | Array[string[]] | Object} to cover the possible types.
afaf206
to
8952c1e
Compare
Updated. |
8952c1e
to
eea3261
Compare
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 other than the nits.
doc/api/dns.md
Outdated
- `rrtype` {string} | ||
- `callback` {Function} | ||
- `err` {Error} | ||
- `addresses` {string[] | Object[] | Array[string[]] | Object} |
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.
Array[string[]]
is a bit ambiguous. string[][]
should be better.
doc/api/dns.md
Outdated
- `hostname` {string} | ||
- `callback` {Function} | ||
- `err` {Error} | ||
- `addresses` {Array[string[]]} |
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.
ditto
eea3261
to
bc930b3
Compare
Nits fixed. 👍 |
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.
Generally LGTM, couple of long lines that need to be wrapped
doc/api/dns.md
Outdated
- `hostname` {string} Hostname to resolve. | ||
- `options` {Object} | ||
- `ttl` {boolean} Retrieve the Time-To-Live value (TTL) of each record. | ||
When `true`, the callback receives an array of `{ address: '1.2.3.4', ttl: 60 }` objects |
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.
long line here :-)
doc/api/dns.md
Outdated
- `hostname` {string} Hostname to resolve. | ||
- `options` {Object} | ||
- `ttl` {boolean} Retrieve the Time-To-Live value (TTL) of each record. | ||
When `true`, the callback receives an array of `{ address: '0:1:2:3:4:5:6:7', ttl: 60 }` objects |
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.
... and here
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.
Other than the minor issues pointed out by the other reviewers, LGTM.
bc930b3
to
73ab559
Compare
Fixed the long lines. :) |
Landed in 1faf136 |
Refs: nodejs#9399 PR-URL: nodejs#11764 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Refs: nodejs#9399 PR-URL: nodejs#11764 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
would anyone like to backport to v6.x? |
Checklist
Affected core subsystem(s)
documentation
Description of changes
Adds argument data types to the docs for
dns
methodsIssue