func ConvertToPortsRange(ports string) (*PortsRange, error) {

	sp := strings.Split(ports, ":")

	if len(sp) != 2 {
		return nil, fmt.Errorf("%s is not a valid range format. It should be of form fromPort:toPort", ports)
	}

	fromPort, err := ConvertToSinglePort(sp[0])
	if err != nil {
		return nil, err
	}

	toPort, err := ConvertToSinglePort(sp[1])
	if err != nil {
		return nil, err
	}

	if fromPort >= toPort {
		return nil, fmt.Errorf("left bound is greater or equal to right bound")
	}

	return &PortsRange{fromPort, toPort}, nil
}
// ConvertToPortsRange converts a :-separated string to a min and max port.
ConvertToPortsRange converts a :-separated string to a min and max port.
// ConvertToPortsRange converts a : - separated string to a min and max port .
func ConvertToPortsRange(ports string) (*PortsRange, error) {
	sp := strings.Split(ports, ":")
	if len(sp) != 2 {
		return nil, fmt.Errorf("%s is not a valid range format. It should be of form fromPort:toPort", ports)
	}
	fromPort, err := ConvertToSinglePort(sp[0])
	if err != nil {
		return nil, err
	}
	toPort, err := ConvertToSinglePort(sp[1])
	if err != nil {
		return nil, err
	}
	if fromPort >= toPort {
		return nil, fmt.Errorf("left bound is greater or equal to right bound")
	}
	return &PortsRange{fromPort, toPort}, nil
}
func ConvertToPortsRange ( ports string ) ( * PortsRange , error ) { sp := strings . Split ( ports , " " ) if len ( sp ) != 2 { return nil , fmt . Errorf ( " " , ports ) } fromPort , err := ConvertToSinglePort ( sp [ 0 ] ) if err != nil { return nil , err } toPort , err := ConvertToSinglePort ( sp [ 1 ] ) if err != nil { return nil , err } if fromPort >= toPort { return nil , fmt . Errorf ( " " ) } return & PortsRange { fromPort , toPort } , nil }
ConvertToPortsRange converts a :-separated string to a min and max port.
ConvertToPortsRange converts a : - separated string to a min and max port .