github.com/MerlinKodo/quic-go@v0.39.2/internal/utils/ip.go (about) 1 package utils 2 3 import "net" 4 5 func IsIPv4(ip net.IP) bool { 6 // If ip is not an IPv4 address, To4 returns nil. 7 // Note that there might be some corner cases, where this is not correct. 8 // See https://stackoverflow.com/questions/22751035/golang-distinguish-ipv4-ipv6. 9 return ip.To4() != nil 10 }