package portutil

import "github.com/rootless-containers/rootlesskit/pkg/port/portutil"

Index

Functions

func ParsePortSpec

func ParsePortSpec(portSpec string) (*port.Spec, error)

ParsePortSpec parses a Docker-like representation of PortSpec, but with support for both "parent IP" and "child IP" (optional); e.g. "127.0.0.1:8080:80/tcp", or "127.0.0.1:8080:10.0.2.100:80/tcp"

Format is as follows:

<parent IP>:<parent port>[:<child IP>]:<child port>/<proto>

Note that (child IP being optional) the format can either contain 5 or 4 components. When using IPv6 IP addresses, addresses must use square brackets to prevent the colons being mistaken for delimiters. For example:

[::1]:8080:[::2]:80/udp

func ValidatePortSpec

func ValidatePortSpec(spec port.Spec, existingPorts map[int]*port.Status) error

ValidatePortSpec validates *port.Spec. existingPorts can be optionally passed for detecting conflicts.

Source Files

portutil.go

Version
v1.1.1 (latest)
Published
May 30, 2023
Platform
linux/amd64
Imports
6 packages
Last checked
3 weeks ago

Tools for package owners.