func (p PortRange) Length() int {
	if err := p.Validate(); err != nil {
		return 0
	}
	return (p.ToPort - p.FromPort) + 1
}
// Length returns the number of ports in the range.  If the range is not valid,
// it returns 0. If this range uses ICMP as the protocol then a -1 is returned
// instead.
Length returns the number of ports in the range.  If the range is not valid,
it returns 0. If this range uses ICMP as the protocol then a -1 is returned
instead.
// Length returns the number of ports in the range . If the range is not valid // it returns 0 . If this range uses ICMP as the protocol then a - 1 is returned // instead .
func (p PortRange) Length() int {
	if err := p.Validate(); err != nil {
		return 0
	}
	return (p.ToPort - p.FromPort) + 1
}
func ( p PortRange ) Length ( ) int { if err := p . Validate ( ) ; err != nil { return 0 } return ( p . ToPort - p . FromPort ) + 1 }
Length returns the number of ports in the range.
Length returns the number of ports in the range .