Skip to content

Add dns.resolve that returns all results #2848

Description

@skeggse

Similar to #736, it'd be nice if we had a dns.resolve that queries for all results.

Would the Node core maintainers be amenable to a pr that adds this functionality via c-ares, or should such an addition be delayed until after #1013 has been resolved?

Activity

  1. added
    dnsIssues and PRs related to the dns subsystem.
    feature requestIssues requesting new Node.js features.
    on Sep 13, 2015
  2. silverwind commented on Sep 14, 2015

    @silverwind
    Contributor

    resolve already returns an array of results, what's exactly the issue?

  3. skeggse commented on Sep 14, 2015

    @skeggse
    ContributorAuthor

    Unless I'm mistaken, resolve returns an array of results for one record type (like A, AAAA, CNAME, MX, etc). I'd like to be able to do a wildcard query, supported by c-ares with the ns_t_any type.

  4. silverwind commented on Sep 14, 2015

    @silverwind
    Contributor

    Oh, you're talking about the ANY query. Well, that'd be indeed something we should support imho.

  5. skeggse commented on Sep 14, 2015

    @skeggse
    ContributorAuthor

    Thoughts on whether we should wait for #1013? Or should I put together a pr?

    Edit: er... not sure how #1843 fits into this

  6. silverwind commented on Sep 14, 2015

    @silverwind
    Contributor

    Personally, I'd rather see #1843 reviewed, fixed and shipped. @mscdex's call if we should further extend c-ares now.

  7. skeggse commented on Sep 14, 2015

    @skeggse
    ContributorAuthor

    Sounds good. This isn't super critical for me atm.

  8. mscdex commented on Sep 14, 2015

    @mscdex
    Contributor

    Work is still ongoing with the js dns resolver. If it's a simple change and someone wants to add it for c-ares in the meantime, feel free to do so.

  9. silverwind commented on Sep 24, 2015

    @silverwind
    Contributor

    This shouldn't be too hard to add. dns.resolve should take a new rrtype ANY, and we likely want a resolveAny method as well.

  10. silverwind commented on Sep 24, 2015

    @silverwind
    Contributor

    On the other hand, there is the issue that we need to return the rrtype of the various records to the user, but we can't really change the addresses array on dns.resolve to something else. Maybe this special query should live only as resolveAny where we could return an array of objects like

    [
      {rrtype: 'A', record: 'something.com'},
      {rrtype: 'MX', record: 'mx.something.com'},
    ]
  11. kulkarniankita commented on Sep 25, 2015

    @kulkarniankita

    Is anyone working on adding this? If not, I can work on this. (cc: @jasnell, @silverwind )

  12. kulkarniankita commented on Oct 3, 2015

    @kulkarniankita

    Working on this one now. @jasnell @mhdawson

  13. bnoordhuis commented on Oct 3, 2015

    @bnoordhuis
    Member

    On the other hand, there is the issue that we need to return the rrtype of the various records to the user, but we can't really change the addresses array on dns.resolve to something else.

    Correct me if I'm wrong but dns.resolve() already returns differently shaped arrays for different query types, doesn't it? Having ANY records have a different shape doesn't look like an issue to me.

    $ node -e 'require("dns").resolve("google.com", "A", console.log)'
    null [ '74.125.136.138',
      '74.125.136.113',
      '74.125.136.139',
      '74.125.136.101',
      '74.125.136.102',
      '74.125.136.100' ]
    
    $ node -e 'require("dns").resolve("google.com", "MX", console.log)'
    null [ { exchange: 'alt1.aspmx.l.google.com', priority: 20 },
      { exchange: 'aspmx.l.google.com', priority: 10 },
      { exchange: 'alt3.aspmx.l.google.com', priority: 40 },
      { exchange: 'alt2.aspmx.l.google.com', priority: 30 },
      { exchange: 'alt4.aspmx.l.google.com', priority: 50 } ]
    
  14. 25 remaining items

  15. XadillaX commented on May 21, 2017

    @XadillaX
    Contributor

    @silverwind I'm working on it now at #13137.

  16. added a commit that references this issue on Jul 11, 2017
  17. added a commit that references this issue on Jul 18, 2017
  18. added a commit that references this issue on Jul 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    dnsIssues and PRs related to the dns subsystem.feature requestIssues requesting new Node.js features.good first issueIssues that are suitable for first-time contributors.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions