Added more documentation and prepared some structural changes

This commit is contained in:
Ben
2021-07-27 13:12:16 +02:00
parent d84bcbeef6
commit ef96496474
8 changed files with 169 additions and 116 deletions
+4 -2
View File
@@ -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
}