mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-10-13 02:28:29 +00:00
Make IsValidIP return error strings
Also treat 0.0.0.0 as special, like loopback and multicast.
This commit is contained in:
@@ -210,8 +210,11 @@ func IsValidPortName(port string) []string {
|
||||
}
|
||||
|
||||
// IsValidIP tests that the argument is a valid IP address.
|
||||
func IsValidIP(value string) bool {
|
||||
return net.ParseIP(value) != nil
|
||||
func IsValidIP(value string) []string {
|
||||
if net.ParseIP(value) == nil {
|
||||
return []string{"must be a valid IP address, (e.g. 10.9.8.7)"}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
const percentFmt string = "[0-9]+%"
|
||||
|
Reference in New Issue
Block a user