ifaceidx

package
v2.5.0-alpha.0...-0e2148d Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2020 License: Apache-2.0 Imports: 6 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
	HostIfName   string
}

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)

	// LookupByHostName retrieves a previously configured Linux interface
	// by the host interface name inside the given namespace.
	// If there is no such interface, <exists> is returned as *false* with <name>
	// and <metadata> both set to empty values.
	LookupByHostName(hostname string, ns *linux_namespace.NetNamespace) (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) error
}

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