Added more documentation and prepared some structural changes
This commit is contained in:
@@ -4,20 +4,22 @@ import (
|
||||
"net"
|
||||
)
|
||||
|
||||
// ValidIP4 tells you if a given string is a valid IPv4 address.
|
||||
func ValidIP4(ipAddress string) bool {
|
||||
testInput := net.ParseIP(ipAddress)
|
||||
if testInput == nil {
|
||||
return false
|
||||
}
|
||||
|
||||
return (testInput.To4() != nil)
|
||||
return testInput.To4() != nil
|
||||
}
|
||||
|
||||
// ValidIP6 tells you if a given string is a valid IPv6 address.
|
||||
func ValidIP6(ip6Address string) bool {
|
||||
testInputIP6 := net.ParseIP(ip6Address)
|
||||
if testInputIP6 == nil {
|
||||
return false
|
||||
}
|
||||
|
||||
return (testInputIP6.To16() != nil)
|
||||
return testInputIP6.To16() != nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user