dcnet

package
v2.4.5 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LinkTypeVeth = LinkType("veth")
	LinkTypeTap  = LinkType("tap")
)

Variables

This section is empty.

Functions

func CleanupAllLinks()

CleanupAllLinks removes all links placemat added

func CleanupNatRules

func CleanupNatRules()

CleanupNatRules destroys nat rules

func CreateNatRules

func CreateNatRules() error

CreateNatRules creates nat rules with iptables

func RandomLinkName

func RandomLinkName(typ LinkType) (string, error)

RandomLinkName generates a random link name

Types

type LinkType

type LinkType string

type NetNS

type NetNS interface {
	// Setup creates a linux network namespace and runs applications as specified
	Setup(context.Context, int, bool) error
	// Cleanup removes network namespaces and veths placemat added
	Cleanup()
	// HostVethNames returns host veth names placemat added
	HostVethNames() []string
}

NetNS represents a NetworkNamespace resource.

func NewNetNS

func NewNetNS(spec *types.NetNSSpec) (NetNS, error)

NewNetNS creates a NetNS from spec.

type Network

type Network interface {
	// Setup creates a virtual L2 switch using Linux bridge.
	Setup(int, bool) error
	// IsType checks whether this Network's type is specified type or not
	IsType(types.NetworkType) bool
	// Contains checks whether this Network's address includes specified ip
	Contains(net.IP) bool
	// AddAddr adds IP address to this Network
	AddAddr(string) error
	// Cleanup deletes all the created bridges and restores all the modified configs.
	Cleanup()
}

Network represents a network configuration

func NewNetwork

func NewNetwork(spec *types.NetworkSpec) (Network, error)

NewNetwork creates *Network from spec.

Jump to

Keyboard shortcuts

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