utils

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PortRange

type PortRange struct {
	Start, End uint16
}

PortRange represents a range of ports. Start and End are inclusive. [Start, End]

type PortUnion

type PortUnion []PortRange

PortUnion is a collection of multiple port ranges.

func ParsePortUnion

func ParsePortUnion(s string) PortUnion

ParsePortUnion parses a string of comma-separated port ranges (or single ports) into a PortUnion. Returns nil if the input is invalid. The returned PortUnion is guaranteed to be normalized.

func (PortUnion) Contains

func (u PortUnion) Contains(port uint16) bool

Contains returns true if the PortUnion contains the given port.

func (PortUnion) Normalize

func (u PortUnion) Normalize() PortUnion

Normalize normalizes a PortUnion. No overlapping ranges, ranges are sorted from low to high.

func (PortUnion) Ports

func (u PortUnion) Ports() []uint16

Ports returns all ports in the PortUnion as a slice.

Jump to

Keyboard shortcuts

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