portset

package
v1.10.1 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2024 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrZeroPort = errors.New("port number cannot be zero")

Functions

This section is empty.

Types

type PortRange

type PortRange struct {
	From uint16
	To   uint16
}

PortRange is an inclusive range of ports.

func (PortRange) Contains

func (r PortRange) Contains(port uint16) bool

Contains returns whether the given port is in the range.

type PortRangeSet

type PortRangeSet struct {
	// contains filtered or unexported fields
}

PortRangeSet is a set of port ranges.

func (PortRangeSet) Contains

func (s PortRangeSet) Contains(port uint16) bool

Contains returns whether the given port is in the set.

type PortSet

type PortSet struct {
	// contains filtered or unexported fields
}

PortSet is a bit set for ports.

func (*PortSet) Add

func (s *PortSet) Add(port uint16)

Add adds the given port to the set.

func (*PortSet) AddRange

func (s *PortSet) AddRange(from, to uint16)

AddRange adds the given port range to the set.

func (*PortSet) Contains

func (s *PortSet) Contains(port uint16) bool

Contains returns whether the given port is in the set.

func (*PortSet) Count

func (s *PortSet) Count() (count uint)

Count returns the number of ports in the set.

func (*PortSet) First

func (s *PortSet) First() uint16

First returns the first port in the set.

func (*PortSet) Parse

func (s *PortSet) Parse(portSetString string) error

Parse parses the given string as a comma-separated list of ports and port ranges, and adds them to the set on success, or returns an error.

func (*PortSet) RangeCount

func (s *PortSet) RangeCount() (count uint)

RangeCount returns the number of port ranges in the set.

func (*PortSet) RangeSet

func (s *PortSet) RangeSet() PortRangeSet

RangeSet returns the ports in the set as a port range set.

Jump to

Keyboard shortcuts

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