Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNoFreeAddresses is returned is there is no free IP addresses left in the pool ErrNoFreeAddresses = errors.New("no free addresses in the allocated range") )
Functions ¶
func CanonicalizeIP ¶
CanonicalizeIP makes sure a provided ip is in standard form
Types ¶
type IPAllocator ¶
type IPAllocator interface { // Allocate allocates IP address from the range for the container identified by ID and ifName Allocate(id string, ifName string, meta types.ReservationMetadata, staticIP net.IP) (*current.IPConfig, error) }
IPAllocator is the interface of the allocate package
func NewIPAllocator ¶
func NewIPAllocator(s *RangeSet, exclusions *RangeSet, poolKey string, session storePkg.Session) IPAllocator
NewIPAllocator create and initialize a new instance of IP allocator
type Range ¶
type Range struct { RangeStart net.IP `json:"rangeStart,omitempty"` // The first ip, inclusive RangeEnd net.IP `json:"rangeEnd,omitempty"` // The last ip, inclusive Subnet types.IPNet `json:"subnet"` Gateway net.IP `json:"gateway,omitempty"` }
Range contains IP range configuration
func (*Range) Canonicalize ¶
Canonicalize takes a given range and ensures that all information is consistent, filling out Start, End, and Gateway with sane values if missing
func (*Range) Contains ¶
Contains checks if a given ip is a valid, allocatable address in a given Range
type RangeIter ¶
type RangeIter struct {
// contains filtered or unexported fields
}
RangeIter implements iterator over the RangeSet
type RangeSet ¶
type RangeSet []Range
RangeSet is an alias type for list or Range objects
func (*RangeSet) Canonicalize ¶
Canonicalize ensures the RangeSet is in a standard form, and detects any invalid input. Call Range.Canonicalize() on every Range in the set