Skip to content

Commit

Permalink
fixing ipv6 detection
Browse files Browse the repository at this point in the history
  • Loading branch information
ngn13 committed Jan 20, 2024
1 parent bc5f1d6 commit 1f5381d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,14 @@ func GetAddr(addrs []net.Addr) string {
for _, a := range addrs {
switch v := a.(type) {
case *net.IPNet:
if strings.Contains(v.IP.String(), ":") {
continue
}
return v.IP.String()
case *net.IPAddr:
if strings.Contains(v.IP.String(), ":") {
continue
}
return v.IP.String()
}
}
Expand Down

0 comments on commit 1f5381d

Please sign in to comment.