trireme-lib: Index | Files

package portspec

import ""


Package Files


type PortSpec Uses

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 Uses

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

NewPortSpec creates a new port spec

func NewPortSpecFromString Uses

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

NewPortSpecFromString creates a new port spec

func (*PortSpec) IsIncluded Uses

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

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

func (*PortSpec) IsMultiPort Uses

func (s *PortSpec) IsMultiPort() bool

IsMultiPort returns true if the spec is for multiple ports.

func (*PortSpec) Overlaps Uses

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

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

func (*PortSpec) Range Uses

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

Range returns the range of a spec.

func (*PortSpec) SinglePort Uses

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

SinglePort returns the port of a non multi-port spec

func (*PortSpec) String Uses

func (s *PortSpec) String() string

MultiPort returns the multi-port range as a string.

func (*PortSpec) Value Uses

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

Value returns the value of the portspec if one is there

Package portspec imports 3 packages (graph) and is imported by 15 packages. Updated 2020-03-30. Refresh now. Tools for package owners.