Merge pull request #2310 from nivekuil/ipv6

Detect ipv6 addresses
This commit is contained in:
Chris Lu 2021-09-05 10:56:44 -07:00 committed by GitHub
commit 2348e8d8da
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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()
}
}