netutils

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2015 License: Apache-2.0 Imports: 8 Imported by: 40

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 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 GetLocalIP

func GetLocalIP() (string, error)

GetLocalIP obtains the first IP on a local interface on the host.

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 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