bridge

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanupTAPs

func CleanupTAPs(vmIDs []string) []string

CleanupTAPs removes bridge TAP devices for the given VM IDs. It does not require a Bridge instance and is safe to call even when no bridge TAPs exist (no-op per VM).

func GCModule

func GCModule(rootDir string) gc.Module[bridgeSnapshot]

GCModule returns a GC module that reclaims orphan bt* TAP devices. It does not require a Bridge instance — only rootDir for the lock file.

Types

type Bridge

type Bridge struct {
	// contains filtered or unexported fields
}

Bridge implements network.Network by creating TAP devices and adding them directly to an existing Linux bridge. An external DHCP server on the bridge (e.g. dnsmasq) serves VM IPs. No veth, no TC, no netns — just TAP-on-bridge, the simplest possible VM networking.

This backend is designed to work with cocoon-net's cni0 bridge or any pre-existing bridge that has DHCP + routing already set up.

func New

func New(conf *config.Config, bridgeDev string) (*Bridge, error)

New creates a Bridge network provider. The bridge device must exist.

func (*Bridge) Config

func (b *Bridge) Config(ctx context.Context, vmID string, numNICs int, vmCfg *types.VMConfig, existing ...*types.NetworkConfig) ([]*types.NetworkConfig, error)

Config creates TAP devices and adds them to the bridge.

func (*Bridge) Delete

func (b *Bridge) Delete(_ context.Context, vmIDs []string) ([]string, error)

Delete removes TAP devices for the given VMs.

func (*Bridge) Inspect

func (b *Bridge) Inspect(_ context.Context, _ string) (*types.Network, error)

Inspect is not supported — bridge mode has no persistent records.

func (*Bridge) List

func (b *Bridge) List(_ context.Context) ([]*types.Network, error)

List is not supported — bridge mode has no persistent records.

func (*Bridge) RegisterGC

func (b *Bridge) RegisterGC(orch *gc.Orchestrator)

RegisterGC registers the bridge GC module that reclaims orphan bt* TAP devices.

func (*Bridge) Type

func (b *Bridge) Type() string

Type returns the provider identifier.

func (*Bridge) Verify

func (b *Bridge) Verify(_ context.Context, vmID string) error

Verify checks whether the TAP for a VM exists.

Jump to

Keyboard shortcuts

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