Skip to content

Feature. Set DNS server port for DNS client #7903

Description

@amit777

the Docs on the DNS client say that the dns.setServers(servers) method will strip out any custom ports provided. "If a port specified on the address it will be removed."

I'm curious if there is a specific reason for not wanting to support it, or is it planned to be supported?

Activity

  1. added
    questionIssues asking questions about Node.js.
    dnsIssues and PRs related to the dns subsystem.
    on Jul 28, 2016
  2. bnoordhuis commented on Jul 28, 2016

    @bnoordhuis
    Member

    We could add support for port numbers. dns.setServers() is currently glue for ares_set_servers(), which ignores port numbers, but that could be changed to ares_set_servers_ports(), which respects them.

    Can you explain your use case though? I've never seen a DNS server on a non-standard port, not even in testing setups.

  3. amit777 commented on Jul 28, 2016

    @amit777
    Author

    It's mainly for an e2e test suite to be run on a production server that already is serving DNS. I didn't want to have to spin up another server or shutdown the existing DNS server. Maybe to reduce impact, we could keep the existing behavior and have an options flag to use the ares_set_server_ports() function?

  4. added
    feature requestIssues requesting new Node.js features.
    and removed
    questionIssues asking questions about Node.js.
    on Jul 28, 2016
  5. bnoordhuis commented on Jul 28, 2016

    @bnoordhuis
    Member

    I've added the 'feature request' label.

    Pull requests welcome but I won't vouch they'll get accepted. It seems like a rather esoteric feature when you can't even configure /etc/resolv.conf to use a non-standard port.

  6. imyller commented on Aug 1, 2016

    @imyller
    Member

    System resolvers rarely allow non-standard ports - rightfully so - but application resolvers often do allow them for various reasons.

    I wouldn't consider Node.js to be a system level resolver and thus supporting non-standard ports might not be so "esoteric feature".

    In addition to network domains, DNS can be used for other purposes. For example as a P2P service discovery protocol, where use of custom ports is desired. In this case, port is not used to differentiate the technical protocol, but the type of content served.

    Right now, Node.js can not be used to implement clients for these kinds of service discovery implementations; or at least not by using it's built-in resolver.

  7. silverwind commented on Aug 3, 2016

    @silverwind
    Contributor

    Not against it, but also not really thrilled about a likely required sync-style method like dns.setPort(if we wanna keep the API consistent with setServers), for cases where you want to use the system's servers on an alternative port.

    I'd generally recommend dns-socket which can do pretty much everything tools like dig can do.

  8. jasnell commented on Aug 3, 2016

    @jasnell
    Member

    To be honest, the entire DNS module is a bit ripe for refactoring. There are challenges with setServers() when it's called at the wrong time and the APIs are a bit messy in general. I'm not against making this change, but perhaps we should give some thought to more extensive changes?

  9. silverwind commented on Aug 3, 2016

    @silverwind
    Contributor

    Yeah, dns is lacking both feature-wise and API-wise. Adding more API surface now is not going to make a future transition easier, so I think that should be kept in mind.

  10. imyller commented on Aug 3, 2016

    @imyller
    Member

    I remember seeing some discussion / PRs for transitioning to pure JS DNS resolver.

    What is the status of that?

  11. jasnell commented on Aug 3, 2016

    @jasnell
    Member

    @mscdex can comment more specifically but it stalled out due to an inability to get the necessary performance.

  12. mscdex commented on Aug 3, 2016

    @mscdex
    Contributor
  13. imyller commented on Aug 3, 2016

    @imyller
    Member

    @mscdex Just curious, what type of performance degradation? DNS isn't exactly a high frequency, high bandwidth protocol by it's nature.

    I'd expect native c-ares to offer better latency and more queries per second, but does minor performance degradation even matter for a any real world DNS usage scenario?

  14. 6 remaining items

  15. tamsky commented on Sep 20, 2016

    @tamsky

    @bnoordhuis

    I've never seen a DNS server on a non-standard port, not even in testing setups.

    https://www.consul.io/docs/agent/dns.html
    by default, consul runs their DNS service on udp/8600.

  16. fvdm commented on Nov 23, 2016

    @fvdm

    +1 for custom port

    I run two different DNS resolvers on my production box. One of them runs with normal settings and is for the system and generic apps, the other is for an app that requires custom settings and very short cache retention.

    For now I'm going to use dns-socket native-dns to resolve this, but I believe the dns module should support custom ports.

    Edit: switched to native-dns as I can't get dns-socket to work somehow.

  17. amit777 commented on Jan 9, 2017

    @amit777
    Author

    I also want to run the dnsmasq service locally on a non-standard port, and then query against it with my nodejs app (since my node app runs on port 53).. I want to leverage the dnsmasq caching etc..

  18. added
    caresIssues and PRs related to the c-ares dependency or the cares_wrap binding.
    on Jul 15, 2017
  19. refack commented on Jul 15, 2017

    @refack
    Contributor

    Fixed in #13723

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

    caresIssues and PRs related to the c-ares dependency or the cares_wrap binding.dnsIssues and PRs related to the dns subsystem.feature requestIssues requesting new Node.js features.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions