iprange

package
v1.9.6 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BytesToIP

func BytesToIP(r []byte) net.IP

BytesToIP translate []bytes to net.IP

func ListAllCIDRIPRangeIndexs

func ListAllCIDRIPRangeIndexs(subnetCIDR *net.IPNet, sa networkingv1alpha1.SubnetAllocation) (indexRanges []*big.Int, err error)

ListAllCIDRIPRangeIndexs The IP address range is listed in a list. Every two elements of the returned array are a group eg: [1,10, 10,100, 109,107] In the example array: if v=2, then v is in this element list. If v=101, v is not in this list

func ListAllCustomIPRangeIndexs

func ListAllCustomIPRangeIndexs(subnetCIDR *net.IPNet, customs []networkingv1alpha1.CustomAllocation) (indexRanges []*big.Int, err error)

ListAllCustomIPRangeIndexs The IP address range is listed in a list. Every two elements of the returned array are a group eg: [1,10, 10,100, 109,107] In the example array: if v=2, then v is in this element list. If v=101, v is not in this list

Types

type IPFilter

type IPFilter interface {
	FilterIP(ip net.IP) bool
}

IPFilter filte unavailable IP addresses this interface is used for filtering IP addresses which have been allocated by ipam

type RangePool

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

RangePool manager ip pool control by range of ip

func NewCIDRRangePool

func NewCIDRRangePool(psts *networkingv1alpha1.PodSubnetTopologySpread, ipFilter ...IPFilter) (*RangePool, error)

NewCIDRRangePool create new ip range manager This object is used by fixed IP and manually assigned IP

func NewCustomRangePool

func NewCustomRangePool(psts *networkingv1alpha1.PodSubnetTopologySpread, ipFilter ...IPFilter) (*RangePool, error)

NewCustomRangePool create new ip range manager This object is used by custom mode of ipam

func (*RangePool) FilterIP

func (pool *RangePool) FilterIP(ip net.IP) bool

FilteIP return true if the IP can be used

func (*RangePool) FirstAvailableIP

func (pool *RangePool) FirstAvailableIP(sbnID string) net.IP

FirstAvailableIP try to get the first available IP Return: IP address can be use for pod

nil if no ip can be used

func (*RangePool) IPInRange

func (pool *RangePool) IPInRange(ip string) bool

IPInRange Whether to include the specified IP in the custom IPRange

func (*RangePool) String

func (pool *RangePool) String() string

Jump to

Keyboard shortcuts

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