Giter Site home page Giter Site logo

Simpler DNS interface needed about io HOT 5 OPEN

schveiguy avatar schveiguy commented on May 13, 2024
Simpler DNS interface needed

from io.

Comments (5)

schveiguy avatar schveiguy commented on May 13, 2024

Also, I think it would be nice to put the wrapper function inside the dns module. Having to use the driver directly seems against the spirit of this library.

from io.

MartinNowak avatar MartinNowak commented on May 13, 2024

Hence it's private. I tried a couple of things, but getaddrinfo is really only designed to open a socket. On the good side, it can transparently handle IPv4 vs. IPv6 and multiple IPs if used correctly.
DNS isn't a hostname -> addr mapping. And what would you do with a list of addresses of different families?
My takeaway was to use the C resolver for sockets, but leave DNS to some other library. A real DNS library would also support other queries like MX, TXT, et.al.
This reasoning should be properly documented somewhere.

from io.

MartinNowak avatar MartinNowak commented on May 13, 2024

What's the use-case for a manual DNS resolution of the hostname @schveiguy?
Resolving names once on program startup is somewhat of an anti-pattern as it defies certain server-side failover/loadbalancer mechanisms (hence TTL in caching in recursive resolvers).
Also sockets can be used over longer times, so repeated lookup shouldn't be too much of a problem, and most ppl. have caching resolvers nearby anyhow.

from io.

schveiguy avatar schveiguy commented on May 13, 2024

Hence it's private

Huh? I was able to use it here: https://github.com/schveiguy/httpiopipe/blob/master/source/iopipe/http.d#L591

DNS isn't a hostname -> addr mapping

I have no idea what you mean by this statement. What other service would I use to open a socket to a named host?

I think there's a misunderstanding here. I'm not complaining about the service or the usage of getaddrinfo, just that I have to use the driver directly (which is completely different from most of std.io), and that the API requires me to write my code in a node.js callback style of code.

from io.

schveiguy avatar schveiguy commented on May 13, 2024

What's the use-case for a manual DNS resolution of the hostname @schveiguy?
Resolving names once on program startup is somewhat of an anti-pattern as it defies certain server-side failover/loadbalancer mechanisms (hence TTL in caching in recursive resolvers).
Also sockets can be used over longer times, so repeated lookup shouldn't be too much of a problem, and most ppl. have caching resolvers nearby anyhow.

Literally, I have no idea why you wrote any of this. I really do feel you are reading some other meaning than what I wanted to say.

from io.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.