Uh oh!
There was an error while loading. Please reload this page.
dns: add resolveAny support - #13137
Conversation
85adf13 to
c4cb648Comparesilverwind
commented
May 21, 2017
Thanks for tackling this. It also needs a doc update in the table here and a new section for |
XadillaX
commented
May 21, 2017
@silverwind thanks for mentioning it. I'm still working on implementing this feature. |
c4cb648 to
a161474Compare1c4fddb to
acc9637Compare@silverwind I've already added the document now. |
acc9637 to
3643ebeCompare
cjihrig
left a comment
There was a problem hiding this comment.
A few comments on the test. Haven't reviewed the whole thing yet.
There was a problem hiding this comment.
This should come right after the 'use strict'; directive.
There was a problem hiding this comment.
Can you split these complex assertions into smaller individual assertions.
There was a problem hiding this comment.
Why can't you call r.forEach() directly?
There was a problem hiding this comment.
Because r is an array-liked object, not a real array instance.
{'0': 'foo','1': 'bar','length': 2,'type': 'TXT'}There was a problem hiding this comment.
Can you drop the console.log().
There was a problem hiding this comment.
Ah, I forgot to delete it. sorry.
There was a problem hiding this comment.
Using the table to illustrate the structure is a bit unclear.
There was a problem hiding this comment.
How about using list? or something else?
There was a problem hiding this comment.
Not sure... the table may be ok if the sentence leading into it is changed up a bit. Not having any specific ideas on how to improve it tho. It just reads a bit awkward.
There was a problem hiding this comment.
Hmmm... So I gave an example following.
There was a problem hiding this comment.
Following is a example of the `ret` object passed to the callback:
`dns.resolveAny` and `dns.resolve` with `"ANY"` has the similar behavior like `$ dig <domain> any` and returns an array with several types of records. `dns.resolveAny` parses the result packet by several rules in turn. Supported types: * A * AAAA * CNAME * MX * NAPTR * NS * PTR * SOA * SRV * TXT Refs: nodejs#2848
3643ebe to
e44d750CompareTrott
commented
May 23, 2017
Based on |
silverwind
commented
May 25, 2017
| (((unsigned int)((unsigned char)(p)[0]) << 24U) | \ | ||
| ((unsigned int)((unsigned char)(p)[1]) << 16U) | \ | ||
| ((unsigned int)((unsigned char)(p)[2]) << 8U) | \ | ||
| ((unsigned int)((unsigned char)(p)[3])))) |
There was a problem hiding this comment.
Can you use inline functions rather than macros, and static casts rather than C-style casts?
| }; | ||
| Local<Array> AddrTTLToArray(Environment* env, | ||
| ares_addrttl* addrttls, |
| Local<Array> AddrTTLToArray(Environment* env, | ||
| ares_addrttl* addrttls, | ||
| int naddrttls) { |
There was a problem hiding this comment.
naddrttls should be int because ares_parse_a_reply needs naddrttls be an integer but not an unsigned integer.
| Local<Array> ttls = Array::New(isolate, naddrttls); | ||
| auto context = env->context(); | ||
| for (int i = 0; i < naddrttls; i += 1) { |
There was a problem hiding this comment.
size_t (and btw, we tend to use i++ here)
| Local<Array> AddrTTL6ToArray(Environment* env, | ||
| ares_addr6ttl* addrttls, | ||
| int naddrttls) { |
There was a problem hiding this comment.
Ditto – I think it’s safe to merge these two methods into a template, by the way.
| status = ares_parse_a_reply(buf, | ||
| len, | ||
| &host, | ||
| reinterpret_cast<ares_addrttl*>(addrttls), |
There was a problem hiding this comment.
There’s no need to reinterpret_cast here, static_cast should be enough
| int ParseGeneralReply(Environment* env, | ||
| unsigned char* buf, |
There was a problem hiding this comment.
buf can be const unsigned char*, right?
| /* If it's `CNAME`, return the CNAME value */ | ||
| /* And if it's `CNAME_OR_A` and it has value in `h_name` and `h_aliases[0]` */ | ||
| /* We consider it's a CNAME record, otherwise we consider it's an A record */ |
There was a problem hiding this comment.
This continues the sentence from the line before, right? Could you start it with a lowercase w then? And maybe consider folding the comments into a single multi-line comment, i.e.
/* foo
* bar
* baz */
| int ParseMxReply(Environment* env, | ||
| unsigned char* buf, |
| mx_record->Set(exchange_symbol, | ||
| OneByteString(env->isolate(), current->host)); | ||
| mx_record->Set(priority_symbol, | ||
| Integer::New(env->isolate(), current->priority)); |
There was a problem hiding this comment.
Regarding all uses of Set(): Can you use the overload that returns a Maybe<bool> and check the result?
silverwind
left a comment
There was a problem hiding this comment.
Left some docs comments
There was a problem hiding this comment.
"to resolve all records (also known as ANY or * query)"
(This is taken out of the rfc - 255 A request for all records)
There was a problem hiding this comment.
Maybe replace the last sentence with: "Depending on the type, additional properties will be present on the object:
There was a problem hiding this comment.
Why not return a regular array (e.g. where Array.isArray(array) returns true)?
There was a problem hiding this comment.
Because we need the extra column type.
You mean create an array with extra type directly?
eg.
constarr=['foo','bar'];arr.type='TXT';There was a problem hiding this comment.
Right, seems reasonable to keep it that way.
There was a problem hiding this comment.
typo: array-like
I think this should be an array; if necessary, you can make it an entries: […] property on the object itself.
There was a problem hiding this comment.
"Here is ..." might be better
There was a problem hiding this comment.
Maybe remove this comment, while correct, it seems unrelated here.
There was a problem hiding this comment.
Can you structure this example to type is sorted first in each object?
f95255d to
f11a55fCompareXadillaX
commented
May 27, 2017
Should this PR backport to 6.x and 4.x? |
`dns.resolveAny` and `dns.resolve` with `"ANY"` has the similar behavior like `$ dig <domain> any` and returns an array with several types of records. `dns.resolveAny` parses the result packet by several rules in turn. Supported types: * A * AAAA * CNAME * MX * NAPTR * NS * PTR * SOA * SRV * TXT Fixes: #2848 PR-URL: #13137 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io>
Notable changes: * **Async Hooks** * Multiple improvements to Promise support in `async_hooks` have been made. * **Build** * The compiler version requirement to build Node with GCC has been raised to GCC 4.9.4. [[`23d41f3118`](2abaa86ba8)] [#13466](#13466) * **DNS** * The server used for DNS queries can now use a custom port. [[`2bb6614904`](8506acc1b5)] [#13723](#13723) * Support for `dns.resolveAny()` has been added. [[`30bc9dc20f`](30bc9dc20f)] [#13137](#13137) * **V8** * The V8 engine has been upgraded to version 5.9, which has a significantly changed performance profile. [#13515](#13515) PR-URL: #13744
`dns.resolveAny` and `dns.resolve` with `"ANY"` has the similar behavior like `$ dig <domain> any` and returns an array with several types of records. `dns.resolveAny` parses the result packet by several rules in turn. Supported types: * A * AAAA * CNAME * MX * NAPTR * NS * PTR * SOA * SRV * TXT Fixes: #2848 PR-URL: #13137 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io>
Notable changes: * **Async Hooks** * Multiple improvements to Promise support in `async_hooks` have been made. * **Build** * The compiler version requirement to build Node with GCC has been raised to GCC 4.9.4. [[`23d41f3118`](2abaa86ba8)] [#13466](#13466) * **DNS** * The server used for DNS queries can now use a custom port. [[`2bb6614904`](8506acc1b5)] [#13723](#13723) * Support for `dns.resolveAny()` has been added. [[`30bc9dc20f`](30bc9dc20f)] [#13137](#13137) * **V8** * The V8 engine has been upgraded to version 5.9, which has a significantly changed performance profile. [#13515](#13515) PR-URL: #13744
Notable changes: * **Async Hooks** * Multiple improvements to Promise support in `async_hooks` have been made. * **Build** * The compiler version requirement to build Node with GCC has been raised to GCC 4.9.4. [[`23d41f3118`](2abaa86ba8)] [#13466](#13466) * **DNS** * The server used for DNS queries can now use a custom port. [[`2bb6614904`](8506acc1b5)] [#13723](#13723) * Support for `dns.resolveAny()` has been added. [[`30bc9dc20f`](30bc9dc20f)] [#13137](#13137) * **V8** * The V8 engine has been upgraded to version 5.9, which has a significantly changed performance profile. [#13515](#13515) PR-URL: #13744
Notable changes: * **Async Hooks** * Multiple improvements to Promise support in `async_hooks` have been made. * **Build** * The compiler version requirement to build Node with GCC has been raised to GCC 4.9.4. [[`23d41f3118`](2abaa86ba8)] [#13466](#13466) * **DNS** * The server used for DNS queries can now use a custom port. [[`2bb6614904`](8506acc1b5)] [#13723](#13723) * Support for `dns.resolveAny()` has been added. [[`30bc9dc20f`](30bc9dc20f)] [#13137](#13137) * **V8** * The V8 engine has been upgraded to version 5.9, which has a significantly changed performance profile. [#13515](#13515) PR-URL: #13744
Notable changes: * **Async Hooks** * Multiple improvements to Promise support in `async_hooks` have been made. * **Build** * The compiler version requirement to build Node with GCC has been raised to GCC 4.9.4. [[`23d41f3118`](2abaa86ba8)] [#13466](#13466) * **DNS** * The server used for DNS queries can now use a custom port. [[`2bb6614904`](8506acc1b5)] [#13723](#13723) * Support for `dns.resolveAny()` has been added. [[`30bc9dc20f`](30bc9dc20f)] [#13137](#13137) * **V8** * The V8 engine has been upgraded to version 5.9, which has a significantly changed performance profile. [#13515](#13515) PR-URL: #13744
Notable changes: * **Async Hooks** * Multiple improvements to Promise support in `async_hooks` have been made. * **Build** * The compiler version requirement to build Node with GCC has been raised to GCC 4.9.4. [[`23d41f3118`](2abaa86ba8)] [#13466](#13466) * **DNS** * The server used for DNS queries can now use a custom port. [[`2bb6614904`](8506acc1b5)] [#13723](#13723) * Support for `dns.resolveAny()` has been added. [[`30bc9dc20f`](30bc9dc20f)] [#13137](#13137) * **V8** * The V8 engine has been upgraded to version 5.9, which has a significantly changed performance profile. [#13515](#13515) PR-URL: #13744
`dns.resolveAny` and `dns.resolve` with `"ANY"` has the similar behavior like `$ dig <domain> any` and returns an array with several types of records. `dns.resolveAny` parses the result packet by several rules in turn. Supported types: * A * AAAA * CNAME * MX * NAPTR * NS * PTR * SOA * SRV * TXT Fixes: #2848 PR-URL: #13137 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io>
Notable changes: * **Async Hooks** * Multiple improvements to Promise support in `async_hooks` have been made. * **Build** * The compiler version requirement to build Node with GCC has been raised to GCC 4.9.4. [[`23d41f3118`](2abaa86ba8)] [#13466](#13466) * **DNS** * The server used for DNS queries can now use a custom port. [[`2bb6614904`](8506acc1b5)] [#13723](#13723) * Support for `dns.resolveAny()` has been added. [[`30bc9dc20f`](30bc9dc20f)] [#13137](#13137) * **V8** * The V8 engine has been upgraded to version 5.9, which has a significantly changed performance profile. [#13515](#13515) PR-URL: #13744
This is a bit of a check to see how people feel about having this kind of test. Ref: nodejs#13137 PR-URL: nodejs#13883 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com>
`dns.resolveAny` and `dns.resolve` with `"ANY"` has the similar behavior like `$ dig <domain> any` and returns an array with several types of records. `dns.resolveAny` parses the result packet by several rules in turn. Supported types: * A * AAAA * CNAME * MX * NAPTR * NS * PTR * SOA * SRV * TXT Fixes: #2848 PR-URL: #13137 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io>
Notable changes: * **Async Hooks** * Multiple improvements to Promise support in `async_hooks` have been made. * **Build** * The compiler version requirement to build Node with GCC has been raised to GCC 4.9.4. [[`820b011ed6`](820b011ed6)] [#13466](#13466) * **Cluster** * Users now have more fine-grained control over the inspector port used by individual cluster workers. Previously, cluster workers would simply increment from the master's debug port. [[`dfc46e262a`](dfc46e262a)] [#14140](#14140) * **DNS** * The server used for DNS queries can now use a custom port. [[`ebe7bb29aa`](ebe7bb29aa)] [#13723](#13723) * Support for `dns.resolveAny()` has been added. [[`6e30e2558e`](6e30e2558e)] [#13137](#13137) * **npm** * The `npm` CLI has been updated to version 5.3.0. In particular, it now comes with the `npx` binary, which is also shipped with Node. [[`dc3f6b9ac1`](dc3f6b9ac1)] [#14235](#14235) * `npm` Changelogs: - [v5.0.4](https://github.com/npm/npm/releases/tag/v5.0.4) - [v5.1.0](https://github.com/npm/npm/releases/tag/v5.1.0) - [v5.2.0](https://github.com/npm/npm/releases/tag/v5.2.0) - [v5.3.0](https://github.com/npm/npm/releases/tag/v5.3.0) PR-URL: #13744
Big thanks to @addaleax who prepared the vast majority of this release. Notable changes: * **Async Hooks** * Multiple improvements to Promise support in `async_hooks` have been made. * **Build** * The compiler version requirement to build Node with GCC has been raised to GCC 4.9.4. [[`820b011ed6`](nodejs@820b011ed6)] [nodejs#13466](nodejs#13466) * **Cluster** * Users now have more fine-grained control over the inspector port used by individual cluster workers. Previously, cluster workers would simply increment from the master's debug port. [[`dfc46e262a`](nodejs@dfc46e262a)] [nodejs#14140](nodejs#14140) * **DNS** * The server used for DNS queries can now use a custom port. [[`ebe7bb29aa`](nodejs@ebe7bb29aa)] [nodejs#13723](nodejs#13723) * Support for `dns.resolveAny()` has been added. [[`6e30e2558e`](nodejs@6e30e2558e)] [nodejs#13137](nodejs#13137) * **npm** * The `npm` CLI has been updated to version 5.3.0. In particular, it now comes with the `npx` binary, which is also shipped with Node. [[`dc3f6b9ac1`](nodejs@dc3f6b9ac1)] [nodejs#14235](nodejs#14235) * `npm` Changelogs: - [v5.0.4](https://github.com/npm/npm/releases/tag/v5.0.4) - [v5.1.0](https://github.com/npm/npm/releases/tag/v5.1.0) - [v5.2.0](https://github.com/npm/npm/releases/tag/v5.2.0) - [v5.3.0](https://github.com/npm/npm/releases/tag/v5.3.0) PR-URL: nodejs#13744
Big thanks to @addaleax who prepared the vast majority of this release. Notable changes: * **Async Hooks** * Multiple improvements to Promise support in `async_hooks` have been made. * **Build** * The compiler version requirement to build Node with GCC has been raised to GCC 4.9.4. [[`820b011ed6`](820b011ed6)] [#13466](#13466) * **Cluster** * Users now have more fine-grained control over the inspector port used by individual cluster workers. Previously, cluster workers would simply increment from the master's debug port. [[`dfc46e262a`](dfc46e262a)] [#14140](#14140) * **DNS** * The server used for DNS queries can now use a custom port. [[`ebe7bb29aa`](ebe7bb29aa)] [#13723](#13723) * Support for `dns.resolveAny()` has been added. [[`6e30e2558e`](6e30e2558e)] [#13137](#13137) * **npm** * The `npm` CLI has been updated to version 5.3.0. In particular, it now comes with the `npx` binary, which is also shipped with Node. [[`dc3f6b9ac1`](dc3f6b9ac1)] [#14235](#14235) * `npm` Changelogs: - [v5.0.4](https://github.com/npm/npm/releases/tag/v5.0.4) - [v5.1.0](https://github.com/npm/npm/releases/tag/v5.1.0) - [v5.2.0](https://github.com/npm/npm/releases/tag/v5.2.0) - [v5.3.0](https://github.com/npm/npm/releases/tag/v5.3.0) PR-URL: #13744
Big thanks to @addaleax who prepared the vast majority of this release. Notable changes: * **Async Hooks** * Multiple improvements to Promise support in `async_hooks` have been made. * **Build** * The compiler version requirement to build Node with GCC has been raised to GCC 4.9.4. [[`820b011ed6`](820b011ed6)] [#13466](#13466) * **Cluster** * Users now have more fine-grained control over the inspector port used by individual cluster workers. Previously, cluster workers would simply increment from the master's debug port. [[`dfc46e262a`](dfc46e262a)] [#14140](#14140) * **DNS** * The server used for DNS queries can now use a custom port. [[`ebe7bb29aa`](ebe7bb29aa)] [#13723](#13723) * Support for `dns.resolveAny()` has been added. [[`6e30e2558e`](6e30e2558e)] [#13137](#13137) * **npm** * The `npm` CLI has been updated to version 5.3.0. In particular, it now comes with the `npx` binary, which is also shipped with Node. [[`dc3f6b9ac1`](dc3f6b9ac1)] [#14235](#14235) * `npm` Changelogs: - [v5.0.4](https://github.com/npm/npm/releases/tag/v5.0.4) - [v5.1.0](https://github.com/npm/npm/releases/tag/v5.1.0) - [v5.2.0](https://github.com/npm/npm/releases/tag/v5.2.0) - [v5.3.0](https://github.com/npm/npm/releases/tag/v5.3.0) PR-URL: #13744
gibfahn
commented
Jan 15, 2018
Release team were -1 on landing this in 6.x |

dns.resolveAnyanddns.resolvewith"ANY"has the similar behavior like$ dig <domain> anyand returns an array with several types of records.dns.resolveAnyparses the result packet by several rules in turn.Refs: #2848
Supported Types
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passesAffected core subsystem(s)
dns