Documentation ¶
Overview ¶
Package ippool provides service for managing ip addresses
Index ¶
- type IPPool
- func (tree *IPPool) Add(ip net.IP)
- func (tree *IPPool) AddNet(ipNet *net.IPNet)
- func (tree *IPPool) AddNetString(ipNetString string)
- func (tree *IPPool) AddString(in string)
- func (tree *IPPool) Clear()
- func (tree *IPPool) Clone() *IPPool
- func (tree *IPPool) Contains(ip net.IP) bool
- func (tree *IPPool) ContainsNet(ipNet *net.IPNet) bool
- func (tree *IPPool) ContainsNetString(ipNetRaw string) bool
- func (tree *IPPool) ContainsString(in string) bool
- func (tree *IPPool) Empty() bool
- func (tree *IPPool) Exclude(ipNet *net.IPNet)
- func (tree *IPPool) ExcludeString(ipNetString string)
- func (tree *IPPool) GetPrefixes() []string
- func (tree *IPPool) Pull() (net.IP, error)
- func (tree *IPPool) PullP2PAddrs(exclude ...*IPPool) (srcNet, dstNet *net.IPNet, err error)
- type PrefixPool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type IPPool ¶
type IPPool struct {
// contains filtered or unexported fields
}
IPPool holds available ip addresses in the structure of red-black tree
func NewWithNet ¶
NewWithNet instantiates a ip pool as red-black tree with the specified ip network
func NewWithNetString ¶
NewWithNetString instantiates a ip pool as red-black tree with the specified ip network
func (*IPPool) AddNetString ¶
AddNetString - adds ip addresses from network to the pool by string value
func (*IPPool) ContainsNet ¶ added in v1.3.0
ContainsNet checks that pool contains whole ipNet
func (*IPPool) ContainsNetString ¶ added in v1.3.0
ContainsNetString parses ipNetRaw string and checks that pool contains whole ipNet
func (*IPPool) ContainsString ¶
ContainsString - check the pool contains ip by string value
func (*IPPool) ExcludeString ¶
ExcludeString - exclude network from pool by string value
func (*IPPool) GetPrefixes ¶
GetPrefixes returns the list of saved prefixes
type PrefixPool ¶
type PrefixPool struct {
// contains filtered or unexported fields
}
PrefixPool - keeps prefixes for both IPv4 and IPv6 addresses
func NewPool ¶
func NewPool(prefixes ...string) (*PrefixPool, error)
NewPool - Creates new PrefixPool with initial prefixes list
func (*PrefixPool) AddPrefixes ¶
func (pool *PrefixPool) AddPrefixes(prefixes ...string) error
AddPrefixes - adds prefixes to the pool
func (*PrefixPool) ExcludePrefixes ¶
func (pool *PrefixPool) ExcludePrefixes(prefixes ...string) error
ExcludePrefixes - removes prefixes from the pool
func (*PrefixPool) GetPrefixes ¶
func (pool *PrefixPool) GetPrefixes() []string
GetPrefixes - returns the list of saved prefixes