portspec

package
v10.201.0+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 11, 2019 License: Apache-2.0 Imports: 3 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PortSpec

type PortSpec struct {
	Min uint16 `json:"Min,omitempty"`
	Max uint16 `json:"Max,omitempty"`
	// contains filtered or unexported fields
}

PortSpec is the specification of a port or port range

func NewPortSpec

func NewPortSpec(min, max uint16, value interface{}) (*PortSpec, error)

NewPortSpec creates a new port spec

func NewPortSpecFromString

func NewPortSpecFromString(ports string, value interface{}) (*PortSpec, error)

NewPortSpecFromString creates a new port spec

func (*PortSpec) IsIncluded

func (s *PortSpec) IsIncluded(port int) bool

IsIncluded returns trues if a port is within the range of the portspec

func (*PortSpec) IsMultiPort

func (s *PortSpec) IsMultiPort() bool

IsMultiPort returns true if the spec is for multiple ports.

func (*PortSpec) Overlaps

func (s *PortSpec) Overlaps(p *PortSpec) bool

Overlaps returns true if the provided port spect overlaps with the given one.

func (*PortSpec) Range

func (s *PortSpec) Range() (uint16, uint16)

Range returns the range of a spec.

func (*PortSpec) SinglePort

func (s *PortSpec) SinglePort() (uint16, error)

SinglePort returns the port of a non multi-port spec

func (*PortSpec) String

func (s *PortSpec) String() string

MultiPort returns the multi-port range as a string.

func (*PortSpec) Value

func (s *PortSpec) Value() interface{}

Value returns the value of the portspec if one is there

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL