Documentation ¶
Index ¶
- func AddIPRoute(cidr, gw string) error
- func CIDRToMask(cidr string) (int, error)
- func ClearBitsOutsideRange(ipAllocMap *bitset.BitSet, ipRange string, subnetLen uint)
- func ClearIPAddrRange(ipAllocMap *bitset.BitSet, ipPool string, nwSubnetIP string, nwSubnetLen uint) error
- func ClearReservedEntries(b *bitset.BitSet, subnetLen uint)
- func ConvertBandwidth(bandwidth string) int64
- func CreateBitset(numBitsWide uint) *bitset.BitSet
- func DelIPRoute(cidr, gw string) error
- func GetDefaultAddr() (string, error)
- func GetFirstLocalAddr() (string, error)
- func GetHostIntfName(intf string) string
- func GetIPAddrRange(ipCIDR string, subnetLen uint) string
- func GetIPNumber(subnetIP string, subnetLen uint, allocSubnetLen uint, hostIP string) (uint, error)
- func GetIPv6HostID(subnetAddr string, subnetLen uint, hostAddr string) (string, error)
- func GetInterfaceIP(linkName string) (string, error)
- func GetLocalAddrList() ([]string, error)
- func GetMyAddr() (string, error)
- func GetNetlinkAddrList() ([]string, error)
- func GetNextIPv6HostID(hostID, subnetAddr string, subnetLen uint, IPv6AllocMap map[string]bool) (string, error)
- func GetSubnetAddr(ipStr string, length uint) string
- func GetSubnetIP(subnetIP string, subnetLen uint, allocSubnetLen, hostID uint) (string, error)
- func GetSubnetIPv6(subnetAddr string, subnetLen uint, hostID string) (string, error)
- func HostIPToGateway(hostIP string) (string, error)
- func InitSubnetBitset(b *bitset.BitSet, subnetLen uint)
- func IsAddrLocal(findAddr string) bool
- func IsIPv6(ip string) bool
- func IsOverlappingSubnet(inputSubnet string, existingSubnet string) bool
- func IsOverlappingSubnetv6(inputIPv6Subnet string, existingIPv6Subnet string) bool
- func ListAllocatedIPs(allocMap bitset.BitSet, ipPool string, subnetIP string, subnetLen uint) string
- func ListAvailableIPs(allocMap bitset.BitSet, subnetIP string, subnetLen uint) string
- func NextClear(allocMap bitset.BitSet, idx uint, subnetLen uint) (uint, bool)
- func ParseCIDR(cidrStr string) (string, uint, error)
- func PortToHostIPMAC(port, subnet int) (string, string)
- func ReserveIPv6HostID(hostID string, IPv6AllocMap *map[string]bool)
- func SetBitsOutsideRange(ipAllocMap *bitset.BitSet, ipRange string, subnetLen uint)
- func SetIPAddrRange(ipAllocMap *bitset.BitSet, ipPool string, nwSubnetIP string, nwSubnetLen uint) error
- func SetIPMasquerade(intf, netmask string) error
- func SetInterfaceIP(name string, ipstr string) error
- func SetInterfaceMac(name string, macaddr string) error
- func TestIPAddrRange(ipAllocMap *bitset.BitSet, ipPool string, nwSubnetIP string, nwSubnetLen uint) error
- func ValidateBindAddress(address string) error
- func ValidateNetworkRangeParams(ipRange string, subnetLen uint) error
- type TagRange
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CIDRToMask ¶
CIDRToMask converts a CIDR to corresponding network number
func ClearBitsOutsideRange ¶
ClearBitsOutsideRange sets all IPs outside range as used
func ClearIPAddrRange ¶
func ClearIPAddrRange(ipAllocMap *bitset.BitSet, ipPool string, nwSubnetIP string, nwSubnetLen uint) error
ClearIPAddrRange marks range of IP address as used
func ClearReservedEntries ¶
ClearReservedEntries clears reserved bits
func ConvertBandwidth ¶
ConvertBandwidth will change the format of the bandwidth to int64 format and return the updated bw. eg:- 2 kb bandwidth will be converted to 2*1024 and the result in Int64 format will be returned.
func CreateBitset ¶
CreateBitset initializes a bit set with 2^numBitsWide bits
func GetDefaultAddr ¶
GetDefaultAddr gets default address of local hostname
func GetFirstLocalAddr ¶
GetFirstLocalAddr returns the first ip address
func GetHostIntfName ¶
GetHostIntfName gets the host access interface name
func GetIPAddrRange ¶
GetIPAddrRange returns IP CIDR as a ip address range
func GetIPNumber ¶
GetIPNumber obtains the host id from the host IP. SEe `GetSubnetIP` for more information.
func GetIPv6HostID ¶
GetIPv6HostID obtains the host id from the host IP. SEe `GetSubnetIP` for more information.
func GetInterfaceIP ¶
GetInterfaceIP obtains the ip addr of a local interface on the host.
func GetLocalAddrList ¶
GetLocalAddrList returns a list of local IP addresses
func GetNetlinkAddrList ¶
GetNetlinkAddrList returns a list of local IP addresses
func GetNextIPv6HostID ¶
func GetNextIPv6HostID(hostID, subnetAddr string, subnetLen uint, IPv6AllocMap map[string]bool) (string, error)
GetNextIPv6HostID returns the next available hostId in the AllocMap
func GetSubnetAddr ¶
GetSubnetAddr returns a subnet given a subnet range
func GetSubnetIP ¶
GetSubnetIP given a subnet IP and host identifier, calculates an IP within the subnet for use.
func GetSubnetIPv6 ¶
GetSubnetIPv6 given a subnet IP and host identifier, calculates an IPv6 address within the subnet for use.
func HostIPToGateway ¶
HostIPToGateway gets the gateway based on the IP
func InitSubnetBitset ¶
InitSubnetBitset initializes a bit set with 2^(32 - subnetLen) bits
func IsOverlappingSubnet ¶
IsOverlappingSubnet verifies the Overlapping of subnet
func IsOverlappingSubnetv6 ¶
IsOverlappingSubnetv6 verifies the Overlapping of subnet for v6 networks
func ListAllocatedIPs ¶
func ListAllocatedIPs(allocMap bitset.BitSet, ipPool string, subnetIP string, subnetLen uint) string
ListAllocatedIPs returns a string of allocated IPs in a network
func ListAvailableIPs ¶
ListAvailableIPs returns a string of available IPs in a network
func PortToHostIPMAC ¶
PortToHostIPMAC gets IP and MAC based on port number
func ReserveIPv6HostID ¶
ReserveIPv6HostID sets the hostId in the AllocMap
func SetBitsOutsideRange ¶
SetBitsOutsideRange sets all IPs outside range as used
func SetIPAddrRange ¶
func SetIPAddrRange(ipAllocMap *bitset.BitSet, ipPool string, nwSubnetIP string, nwSubnetLen uint) error
SetIPAddrRange marks range of IP address as used
func SetIPMasquerade ¶
SetIPMasquerade sets a ip masquerade rule.
func SetInterfaceIP ¶
SetInterfaceIP : Set IP address of an interface
func SetInterfaceMac ¶
SetInterfaceMac : Set mac address of an interface
func TestIPAddrRange ¶
func TestIPAddrRange(ipAllocMap *bitset.BitSet, ipPool string, nwSubnetIP string, nwSubnetLen uint) error
TestIPAddrRange checks if any IP address from the subnet is already used
func ValidateBindAddress ¶
ValidateBindAddress format in "address:port"
func ValidateNetworkRangeParams ¶
ValidateNetworkRangeParams verifies the network range format