netutils

package
v0.0.0-...-05563ff Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2019 License: Apache-2.0 Imports: 5 Imported by: 115

README

netutils

Miscellaneous network utilities

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateDefaultGateway

func GenerateDefaultGateway(sna *net.IPNet) net.IP

Generate the default gateway IP Address for a subnet

func GetHostIPNetworks

func GetHostIPNetworks(skipInterfaces []string) ([]*net.IPNet, error)

Return Host IP Networks Ignores provided interfaces and filters loopback and non IPv4 addrs.

func GetNodeIP

func GetNodeIP(nodeName string) (string, error)

func IPToUint32

func IPToUint32(ip net.IP) uint32

func Uint32ToIP

func Uint32ToIP(u uint32) net.IP

Types

type NetIDAllocator

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

func NewNetIDAllocator

func NewNetIDAllocator(min uint, max uint, inUse []uint) (*NetIDAllocator, error)

func (*NetIDAllocator) GetNetID

func (nia *NetIDAllocator) GetNetID() (uint, error)

func (*NetIDAllocator) ReleaseNetID

func (nia *NetIDAllocator) ReleaseNetID(netid uint) error

type SubnetAllocator

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

func NewSubnetAllocator

func NewSubnetAllocator(network string, hostBits uint, 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

Jump to

Keyboard shortcuts

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