net

package
v1.137.0 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2026 License: Apache-2.0 Imports: 6 Imported by: 7

Documentation

Index

Constants

View Source
const (
	// IPv4Family represents the IPv4 IP family.
	IPv4Family = "ipv4"
	// IPv6Family represents the IPv6 IP family.
	IPv6Family = "ipv6"
)

Variables

This section is empty.

Functions

func CheckDualStackForKubeComponents added in v1.101.0

func CheckDualStackForKubeComponents(cidrs []net.IPNet, networkType string) error

CheckDualStackForKubeComponents checks if the given list of CIDRs does not include more than one element of the same IP family.

func GetBitLen

func GetBitLen(address string) (int, error)

GetBitLen returns the bit length of the given IP address.

func GetByIPFamily added in v1.117.0

func GetByIPFamily(cidrs []net.IPNet, ipFamily string) []net.IPNet

GetByIPFamily returns a list of CIDRs that belong to the given IP family.

func Join added in v1.99.0

func Join(cidrs []net.IPNet, sep string) string

Join concatenates the CIDRs of the given networks to create a single string with a custom separator character.

func JoinByComma added in v1.99.0

func JoinByComma(cidrs []net.IPNet) string

JoinByComma concatenates the CIDRs of the given networks to create a single string with comma as separator.

func OverLapAny added in v1.124.0

func OverLapAny(nw net.IPNet, otherNws ...net.IPNet) bool

OverLapAny checks if any of the given IP networks overlap with the first parameter.

func Overlap added in v1.124.0

func Overlap(a, b net.IPNet) bool

Overlap checks if two IP networks overlap.

func SuggestPort added in v1.115.0

func SuggestPort(listenHost string) (port int, resolvedHost string, err error)

SuggestPort suggests an address a process can listen on. It returns a tuple consisting of a free port and the hostname resolved to its IP. It makes sure that new port allocated does not conflict with old ports allocated within 1 minute.

Types

This section is empty.

Jump to

Keyboard shortcuts

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