Detect ipv6 addresses

This commit is contained in:
nivekuil 2021-09-05 06:21:40 -07:00
parent a7383a8a1c
commit 0fe9d2997b

View file

@ -24,7 +24,7 @@ func DetectedHostAddress() string {
for _, a := range addrs {
if ipNet, ok := a.(*net.IPNet); ok && !ipNet.IP.IsLoopback() {
if ipNet.IP.To4() != nil {
if ipNet.IP.To4() != nil || ipNet.IP.To16() != nil {
return ipNet.IP.String()
}
}