github.com/ooni/psiphon/tunnel-core@v0.0.0-20230105123940-fe12a24c96ee/oovendor/quic-go/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 }