Add validation for Endpoints

This commit is contained in:
gmarek
2015-03-20 15:40:20 +01:00
parent e44ec497ed
commit c20efb6bae
4 changed files with 218 additions and 11 deletions

View File

@@ -91,7 +91,7 @@ func IsValidPortNum(port int) bool {
return 0 < port && port < 65536
}
// IsValidIP tests that the argument is a valid IPv4 address.
func IsValidIP(value string) bool {
// IsValidIPv4 tests that the argument is a valid IPv4 address.
func IsValidIPv4(value string) bool {
return net.ParseIP(value) != nil && net.ParseIP(value).To4() != nil
}