prefix_pool

package
v1.0.13 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2020 License: Apache-2.0 Imports: 9 Imported by: 3

Documentation

Index

Constants

View Source
const (
	PrefixesFile            = "excluded_prefixes.yaml"
	NsmConfigDir            = "/var/lib/networkservicemesh/config"
	PrefixesFilePathDefault = NsmConfigDir + "/" + PrefixesFile
)

Variables

This section is empty.

Functions

func AddressCount

func AddressCount(prefixes ...string) uint64

func AddressRange

func AddressRange(network *net.IPNet) (net.IP, net.IP)

* AddressRange returns the first and last addresses in the given CIDR range.

func ExtractPrefix

func ExtractPrefix(prefixes []string, prefixLen uint32) (string, []string, error)

func ExtractPrefixes

func ExtractPrefixes(prefixes []string, requests ...*connectioncontext.ExtraPrefixRequest) (requested []string, remaining []string, err error)

func IncrementIP

func IncrementIP(sourceIp net.IP, ipNet *net.IPNet) (net.IP, error)

func IpToNet

func IpToNet(ipAddr net.IP) *net.IPNet

func MaxCommonPrefixSubnet

func MaxCommonPrefixSubnet(s1, s2 *net.IPNet) *net.IPNet

func ReleasePrefixes

func ReleasePrefixes(prefixes []string, released ...string) (remaining []string, err error)

Types

type PrefixPool

type PrefixPool interface {
	/*
		Process ExtraPrefixesRequest and provide a list of prefixes for clients to use.
	*/
	Extract(connectionId string, family connectioncontext.IpFamily_Family, requests ...*connectioncontext.ExtraPrefixRequest) (srcIP *net.IPNet, dstIP *net.IPNet, requested []string, err error)
	Release(connectionId string) error
	GetConnectionInformation(connectionId string) (string, []string, error)
	GetPrefixes() []string
	Intersect(prefix string) (bool, error)
	ExcludePrefixes(excludedPrefixes []string) ([]string, error)
	ReleaseExcludedPrefixes(excludedPrefixes []string) error
}

* All in one interface for managing prefixes.

func NewPrefixPool

func NewPrefixPool(prefixes ...string) (PrefixPool, error)

func NewPrefixPoolReader

func NewPrefixPoolReader(path string) PrefixPool

Jump to

Keyboard shortcuts

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