fix private subnets bug

This commit is contained in:
sunyu 2020-09-25 14:48:44 +08:00
parent 2b7a8d01c7
commit a89fb34555
5 changed files with 52 additions and 15 deletions

View file

@ -57,7 +57,7 @@ func ValidateCIDR(cidr string) bool {
// ValidateCIDRList to validate a list of network CIDR
func ValidateCIDRList(cidrs []string) bool {
for _, cidr := range cidrs {
if ValidateCIDR(cidr) == false {
if cidr != "" && ValidateCIDR(cidr) == false {
return false
}
}
@ -72,6 +72,14 @@ func ValidateAllowedIPs(cidrs []string) bool {
return true
}
// ValidatePrivateSubnets to validate allowed ip addresses in CIDR format
func ValidatePrivateSubnets(cidrs []string) bool {
if ValidateCIDRList(cidrs) == false {
return false
}
return true
}
// ValidateServerAddresses to validate allowed ip addresses in CIDR format
func ValidateServerAddresses(cidrs []string) bool {
if ValidateCIDRList(cidrs) == false {