ipprefix

package
v10.335.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FuncOnLpmIP

type FuncOnLpmIP func(val interface{}) bool

FuncOnLpmIP is the type of func which will operate on the value associated with the lpm ip.

type FuncOnVals

type FuncOnVals func(val interface{}) interface{}

FuncOnVals is the type of the func which will operate on each value and will return a new value for each associated value.

type IPcache

type IPcache interface {
	// Put takes an argument an ip address, mask and value.
	Put(net.IP, int, interface{})
	// Get takes an argument the IP address and mask and returns the value that is stored for
	// that key.
	Get(net.IP, int) (interface{}, bool)
	// RunFuncOnLpmIP function takes as an argument an IP address and a function. It finds the
	// subnet to which this IP belongs with the longest prefix match. It then calls the
	// function supplied by the user on the value stored and if it succeeds then it returns.
	RunFuncOnLpmIP(net.IP, FuncOnLpmIP)
	// RunFuncOnVals takes an argument a function which is called on all the values stored in
	// the cache. This can be used to update the old values with the new values. If the new
	// value is nil, it will delete the key.
	RunFuncOnVals(FuncOnVals)
}

IPcache is an interface which provides functionality to store ip's and do longest prefix match

func NewIPCache

func NewIPCache() IPcache

NewIPCache creates an object which is implementing the interface IPcache

Jump to

Keyboard shortcuts

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