veth

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package veth helps with creating transient virtual Ethernet network interfaces that always come in pairs. It leverages the Ginkgo testing framework and matching (erm, sic!) Gomega matchers.

These MACVLAN network interfaces are transient because they automatically get removed at the end of the a test (spec, block/group, suite, et cetera) using Ginkgo's DeferCleanup.

Index

Constants

View Source
const VethPrefix = "veth-"

VethPrefix is the name prefix used for transient VETH network interfaces.

Variables

This section is empty.

Functions

func NewTransient

func NewTransient(opts ...Opt) (dupond netlink.Link, dupont netlink.Link)

NewTransient creates and returns a new (and transient) VETH pair of network interfaces. The one VETH end is created in the current network namespace, while the other VETH end can optionally be created in a differend network namespace using WithPeerNamespace.

See also: https://en.wikipedia.org/wiki/Thomson_and_Thompson

Types

type Opt

type Opt func(*netlink.Veth) error

Opt is a configuration option when creating a new pair of VETH network interfaces.

func InNamespace added in v1.5.0

func InNamespace(fdref int) Opt

InNamespace configures the “first” VETH network interface to be created in the network namespace referenced by fdref, instead of creating it in the current network namespace. The “second” VETH network interface will be created in the current network namespace, use WithPeerNamespace to create this end in a different network namespace.

func WithPeerNamespace

func WithPeerNamespace(fd int) Opt

WithPeerNamespace configures the VETH peer end to be created inside the network namespace referenced by fd.

Jump to

Keyboard shortcuts

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