When attempting to use kuard where /etc/resolv.conf contained an IPv6 for the nameserver, it would error when making the DNS query due to net.Dial expecting the IP to be surround with square brackets. In order to detect if it's IPv6, it parses the IP string to a net.IP and relies on To4() returning nil for determining it's not a v4 and so must be a v6.
When attempting to use kuard where
/etc/resolv.conf
contained an IPv6 for the nameserver, it would error when making the DNS query due to net.Dial expecting the IP to be surround with square brackets. In order to detect if it's IPv6, it parses the IP string to anet.IP
and relies on To4() returning nil for determining it's not a v4 and so must be a v6.