top | item 33286022

(no title)

mcstafford | 3 years ago

TL;DR "Using IP Address Instead of Domain Name"

Everything else remains pretty much the same...

discuss

order

ignoramous|3 years ago

> Everything else remains pretty much the same...

Slightly worse, in that, the code only ever uses the first IP returned from the DNS lookups it initiates. Some domains may return 16 IPs but that code would use only the first, at least until the cached-entry expires.

ldoughty|3 years ago

If I recall correctly, that's how the Node maintainers want it in the core to...

I was investigating errors in node code for a few weeks, and traced it to DNS returning a bad IP address. Node didn't even try to call the second IP address, it just returned a "request made but no response" error

Looked deeper, and saw other similar complaints asking for nice to support failover and try the second IP, but it was highly opposed. They suggested writing your own DNS handling code (which is exactly what this person is doing, though for a different reason)

Already__Taken|3 years ago

That's kind of mad the udp host field always does a DNS lookup and ignores TTL though.

hermanradtke|3 years ago

Using an IP address will still call dns.lookup and waste an extra tick. The tl;dr is that you need to write your own lookup function.