allocate

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2021 License: Apache-2.0 Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssignIP

func AssignIP(ipamConf types.IPAMConfig, reservelist []types.IPReservation, containerID string, podRef string) (net.IPNet, []types.IPReservation, error)

AssignIP assigns an IP using a range and a reserve list.

func DeallocateIP

func DeallocateIP(reservelist []types.IPReservation, containerID string) ([]types.IPReservation, net.IP, error)

DeallocateIP assigns an IP using a range and a reserve list.

func GetIPRange

func GetIPRange(ip net.IP, ipnet net.IPNet) (net.IP, net.IP, error)

GetIPRange returns the first and last IP in a range

func IPAddOffset

func IPAddOffset(ip net.IP, offset uint64) net.IP

IPAddOffset show IP address plus given offset

func IPGetOffset

func IPGetOffset(ip1, ip2 net.IP) uint64

IPGetOffset gets offset between ip1 and ip2. This assumes ip1 > ip2 (from IP representation point of view)

func IsIPv4

func IsIPv4(checkip net.IP) bool

IsIPv4 checks if an IP is v4.

func IterateForAssignment

func IterateForAssignment(ipnet net.IPNet, rangeStart net.IP, rangeEnd net.IP, reservelist []types.IPReservation, excludeRanges []string, containerID string, podRef string) (net.IP, []types.IPReservation, error)

IterateForAssignment iterates given an IP/IPNet and a list of reserved IPs

func IterateForDeallocation

func IterateForDeallocation(
	reservelist []types.IPReservation,
	containerID string,
	matchingFunction func(reservation []types.IPReservation, id string) int) ([]types.IPReservation, net.IP, error)

IterateForDeallocation iterates overs currently reserved IPs and the deallocates given the container id.

Types

type AssignmentError

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

AssignmentError defines an IP assignment error.

func (AssignmentError) Error

func (a AssignmentError) Error() string

Jump to

Keyboard shortcuts

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