golang 判断IPv4 or IPv6 address
import strings func IsIPv4(address string) bool { return strings.Count(address, ":") < 2 } func IsIPv6(address string) bool { return strings.Count(address, ":") >= 2 }
import strings func IsIPv4(address string) bool { return strings.Count(address, ":") < 2 } func IsIPv6(address string) bool { return strings.Count(address, ":") >= 2 }