// SubnetCIDR checks if the given string is a valid CIDR for a master nodes or worker nodes subnet and returns an error if not.
SubnetCIDR checks if the given string is a valid CIDR for a master nodes or worker nodes subnet and returns an error if not.
// SubnetCIDR checks if the given string is a valid CIDR for a master nodes or worker nodes subnet and returns an error if not .
func SubnetCIDR(v string) error {
	if err := nonEmpty(v); err != nil {
		return err
	}
	split := strings.Split(v, "/")
	if len(split) == 1 {
		return errors.New("must provide a CIDR netmask (eg, /24)")
	}
	if len(split) != 2 {
		return errors.New("invalid IPv4 address")
	}
	ip := split[0]
	if err := IPv4(ip); err != nil {
		return errors.New("invalid IPv4 address")
	}
	if mask, err := strconv.Atoi(split[1]); err != nil || mask < 0 || mask > 32 {
		return errors.New("invalid netmask size (must be between 0 and 32)")
	}
	if _, _, err := net.ParseCIDR(v); err != nil {
		return errors.New("invalid CIDR")
	}
	if strings.HasPrefix(ip, "172.17.") {
		return errors.New("overlaps with default Docker Bridge subnet (172.17.0.0/16)")
	}
	return nil
}
func SubnetCIDR ( v string ) error { if err := nonEmpty ( v ) ; err != nil { return err } split := strings . Split ( v , " " ) if len ( split ) == 1 { return errors . New ( " " ) } if len ( split ) != 2 { return errors . New ( " " ) } ip := split [ 0 ] if err := IPv4 ( ip ) ; err != nil { return errors . New ( " " ) } if mask , err := strconv . Atoi ( split [ 1 ] ) ; err != nil || mask < 0 || mask > 32 { return errors . New ( " " ) } if _ , _ , err := net . ParseCIDR ( v ) ; err != nil { return errors . New ( " " ) } if strings . HasPrefix ( ip , " " ) { return errors . New ( " " ) } return nil }
SubnetCIDR checks if the given string is a valid CIDR for a master nodes or worker nodes subnet and returns an error if not.
SubnetCIDR checks if the given string is a valid CIDR for a master nodes or worker nodes subnet and returns an error if not .
// Catch any invalid CIDRs not caught by the checks above