netutils

package
v0.0.0-12-25-2015.10-1... Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2015 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateBitset

func CreateBitset(numBitsWide uint) *bitset.BitSet

CreateBitset initializes a bit set with 2^numBitsWide bits

func GetFirstLocalAddr

func GetFirstLocalAddr() (string, error)

GetFirstLocalAddr returns the first ip address

func GetIPNumber

func GetIPNumber(subnetIP string, subnetLen uint, allocSubnetLen uint, hostIP string) (uint, error)

GetIPNumber obtains the host id from the host IP. SEe `GetSubnetIP` for more information.

func GetInterfaceIP

func GetInterfaceIP(linkName string) (string, error)

GetInterfaceIP obtains the ip addr of a local interface on the host.

func GetLocalAddrList

func GetLocalAddrList() ([]string, error)

GetLocalAddrList returns a list of local IP addresses

func GetNetlinkAddrList

func GetNetlinkAddrList() ([]string, error)

GetNetlinkAddrList returns a list of local IP addresses

func GetSubnetIP

func GetSubnetIP(subnetIP string, subnetLen uint, allocSubnetLen, hostID uint) (string, error)

GetSubnetIP given a subnet IP and host identifier, calculates an IP within the subnet for use.

func InitSubnetBitset

func InitSubnetBitset(b *bitset.BitSet, subnetLen uint)

InitSubnetBitset initializes a bit set with 2^(32 - subnetLen) bits

func IsAddrLocal

func IsAddrLocal(findAddr string) bool

IsAddrLocal check if an address is local

func ParseCIDR

func ParseCIDR(cidrStr string) (string, uint, error)

ParseCIDR parses a CIDR string into a gateway IP and length.

func SetInterfaceMac

func SetInterfaceMac(name string, macaddr string) error

SetInterfaceMac : Set mac address of an interface

Types

type TagRange

type TagRange struct {
	Min int
	Max int
}

TagRange represents a range of integers, intended for VLAN and VXLAN tagging.

func ParseTagRanges

func ParseTagRanges(ranges string, tagType string) ([]TagRange, error)

ParseTagRanges takes a string such as 12-24,48-64 and turns it into a series of TagRange.

Jump to

Keyboard shortcuts

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