ifaceidx

package
v2.0.0-beta+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2019 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package ifaceidx implements name-to-index mapping for Linux interfaces.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LinuxIfMetadata

type LinuxIfMetadata struct {
	LinuxIfIndex int
	VPPTapName   string // empty for VETHs
	Namespace    *linux_namespace.NetNamespace
}

LinuxIfMetadata collects metadata for Linux interface used in secondary lookups.

type LinuxIfMetadataIndex

type LinuxIfMetadataIndex interface {
	// LookupByName retrieves a previously stored metadata of interface
	// identified by logical <name>. If there is no interface associated with
	// the given name in the mapping, the <exists> is returned as *false* and
	// <metadata> as *nil*.
	LookupByName(name string) (metadata *LinuxIfMetadata, exists bool)

	// LookupByVPPTap retrieves a previously configured TAP_TO_VPP interface
	// by the logical name of the associated VPP-side of the TAP.
	// If there is no such interface, <exists> is returned as *false* with <name>
	// and <metadata> both set to empty values.
	LookupByVPPTap(vppTapName string) (name string, metadata *LinuxIfMetadata, exists bool)

	// ListAllInterfaces returns slice of names of all interfaces in the mapping.
	ListAllInterfaces() (names []string)

	// WatchInterfaces allows to subscribe to watch for changes in the mapping
	// of interface metadata.
	WatchInterfaces(subscriber string, channel chan<- LinuxIfMetadataIndexDto)
}

LinuxIfMetadataIndex provides read-only access to mapping with Linux interface metadata. It extends from NameToIndex.

type LinuxIfMetadataIndexDto

type LinuxIfMetadataIndexDto struct {
	idxmap.NamedMappingEvent
	Metadata *LinuxIfMetadata
}

LinuxIfMetadataIndexDto represents an item sent through watch channel in LinuxIfMetadataIndex. In contrast to NamedMappingGenericEvent, it contains typed interface metadata.

type LinuxIfMetadataIndexRW

type LinuxIfMetadataIndexRW interface {
	LinuxIfMetadataIndex
	idxmap.NamedMappingRW
}

LinuxIfMetadataIndexRW provides read-write access to mapping with interface metadata.

func NewLinuxIfIndex

func NewLinuxIfIndex(logger logging.Logger, title string) LinuxIfMetadataIndexRW

NewLinuxIfIndex creates a new instance implementing LinuxIfMetadataIndexRW.

Jump to

Keyboard shortcuts

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