subnet

package
v2.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CIDRFromRange added in v2.4.0

func CIDRFromRange(startStr, endStr string) string

CIDRFromRange inverts FirstIPInSubnet/LastIPInSubnet: it rebuilds the CIDR from the start and end they produced. Returns "" for empty or unparsable bounds. A /31 or /127 has no distinct network and broadcast, so it recomputes as /32 or /128.

func FirstIPInSubnet

func FirstIPInSubnet(addr *net.IPNet) (net.IP, error)

firstIPInSubnet gets the first IP in a subnet https://github.com/containers/podman/blob/v4.0.0-rc1/libpod/network/util/ip.go#L36

func GetFreeSubnet

func GetFreeSubnet(n *net.IPNet, usedNetworks []*net.IPNet) (*net.IPNet, error)

GetFreeSubnet try to find a free subnet in the given network

func GetLiveNetworkSubnets

func GetLiveNetworkSubnets() ([]*net.IPNet, error)

func IntersectsWithNetworks

func IntersectsWithNetworks(n *net.IPNet, networklist []*net.IPNet) bool

func LastIPInSubnet

func LastIPInSubnet(addr *net.IPNet) (net.IP, error)

lastIPInSubnet gets the last IP in a subnet https://github.com/containers/podman/blob/v4.0.0-rc1/libpod/network/util/ip.go#L18

Types

This section is empty.

Jump to

Keyboard shortcuts

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