guumaster / hostctl

Your dev tool to manage /etc/hosts like a pro!
http://guumaster.github.io/hostctl
MIT License
1.04k stars 45 forks source link

hostctl strips ::0 off ipv6 addresses when adding any domain #88

Open alcroito opened 1 year ago

alcroito commented 1 year ago

Describe the bug My ubuntu 22.04 system has the following lines in /etc/hosts by default

# The following lines are desirable for IPv6 capable hosts
::1 localhost
::1 ip6-localhost
::1 ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts

Whenever hostctl is invoked to add any domain, the ::0 addresses get their 0 stripped.

hostctl add domains awesome my-awesome-ui.project.loc my-awesome-api.project.loc

and the resulting file ends up

# The following lines are desirable for IPv6 capable hosts
::1 localhost
::1 ip6-localhost
::1 ip6-loopback
fe00:: ip6-localnet # <------
ff00:: ip6-mcastprefix #  <------
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts

##################################################################
# Content under this line is handled by hostctl. DO NOT EDIT.
##################################################################

# profile.on awesome
127.0.0.1 my-awesome-ui.project.loc
127.0.0.1 my-awesome-api.project.loc
# end

Expected behavior the ipv6 addresses do not get their 0 stripped

System (please complete the following information):