txn2 / txeh

Go library and CLI utility for /etc/hosts management.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

supoort hosts with duplicate ip for one fqdn

yeluolei opened this issue · comments

commented

I know you have removed duplicate address for same fqdn, but if the hosts file is used by dnsmasq, it will need that to implement round robin dns address load balance. so maybe it's a good idea to keep these lines if a parameter is specified.

This is also needed to interact with files that you may want to have ipv4 and ipv6 addresses

For example it would be impossible for this library to create the following file:

127.0.0.1       localhost
::1     localhost ip6-localhost ip6-loopback

@yeluolei this is a controversial issue, most systems don't support round robin from /etc/hosts, only DNS, please see:

@addshore it does seem like it needs to support duplicates for IPv6, however, I don't fully understand why. Is that used for a reverse lookup? Most systems will see the first IP for localhost and use it.