Documentation ¶
Index ¶
- Variables
- func GenerateDefaultGateway(sna *net.IPNet) net.IP
- func GetHostIPNetworks(skipInterfaces []string) ([]*net.IPNet, []net.IP, error)
- func GetNodeIP(nodeName string) (string, error)
- func IPToUint32(ip net.IP) uint32
- func IsPrivateAddress(addr string) bool
- func ParseCIDRMask(cidr string) (*net.IPNet, error)
- func Uint32ToIP(u uint32) net.IP
- type SubnetAllocator
Constants ¶
This section is empty.
Variables ¶
var ErrSubnetAllocatorFull = fmt.Errorf("No subnets available.")
Functions ¶
func GenerateDefaultGateway ¶
Generate the default gateway IP Address for a subnet
func GetHostIPNetworks ¶
Return Host IP Networks Ignores provided interfaces and filters loopback and non IPv4 addrs.
func IPToUint32 ¶
func IsPrivateAddress ¶
IsPrivateAddress returns true if given address in format "<host>[:<port>]" is a localhost or an ip from private network range (e.g. 172.30.0.1, 192.168.0.1).
func ParseCIDRMask ¶
ParseCIDRMask parses a CIDR string and ensures that it has no bits set beyond the network mask length. Use this when the input is supposed to be either a description of a subnet (eg, "192.168.1.0/24", meaning "192.168.1.0 to 192.168.1.255"), or a mask for matching against (eg, "192.168.1.15/32", meaning "must match all 32 bits of the address "192.168.1.15"). Use net.ParseCIDR() when the input is a host address that also describes the subnet that it is on (eg, "192.168.1.15/24", meaning "the address 192.168.1.15 on the network 192.168.1.0/24").
func Uint32ToIP ¶
Types ¶
type SubnetAllocator ¶
type SubnetAllocator struct {
// contains filtered or unexported fields
}
func NewSubnetAllocator ¶
func NewSubnetAllocator(network string, hostBits uint32, inUse []string) (*SubnetAllocator, error)
func (*SubnetAllocator) GetNetwork ¶
func (sna *SubnetAllocator) GetNetwork() (*net.IPNet, error)
func (*SubnetAllocator) ReleaseNetwork ¶
func (sna *SubnetAllocator) ReleaseNetwork(ipnet *net.IPNet) error