Closed cfcs closed 4 years ago
On fedora it's
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
I'd not go with "debian's /etc/hosts", but instead use good old RFCs. In https://github.com/mirage/ocaml-dns/blob/v4.4.0/resolver/dns_resolver_root.ml#L37 we already have a list with references to RFCs of top-level domain names and networks that are not supposed to (a) leave the local host (b) leave the link-local scope (c) leave the private network. I'd suggest we revise this list to separate it into these cases more clearly, and then reuse this in the dns-client.
Wikipedia has a bunch of references to RFCs: https://en.wikipedia.org/wiki/Localhost
@cfcs hmm, I think they're mostly out of date / link to obsolete RFCs. From the code comments:
Maybe relevant:
On Debian the default
/etc/hosts
file ships with:It appears users are confused by
dns-client
trying to resolve at leastlocalhost
upstream. We should consider if we want to support at leastlocalhost
, and perhaps the others. Which then begs the question of whether we should have a/etc/hosts
-equivalent in the library that users are able to override, e.g. this could be part of theS.create
API.Where to put it: Intuitively I'd say the cache would seem like a good place?
For anecdotal real-world evidence of this being confusing to users: https://github.com/roburio/openvpn/issues/28