plugin

package
v0.0.0-...-6f9b381 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2026 License: Apache-2.0, BSD-3-Clause, MIT Imports: 5 Imported by: 4

Documentation

Overview

Package plugin provides a set of interfaces to interact with third-party netstack. It will be used during sandbox network setup when NetworkType is set as NetworkPlugin.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterPluginStack

func RegisterPluginStack(stack PluginStack)

RegisterPluginStack registers given stack as plugin stack.

func SeccompFilters

func SeccompFilters() seccomp.SyscallRules

SeccompFilters defines seccomp allowed rules that are needed by cgo.

Types

type EventInfo

type EventInfo struct {
	// Wq is the socket's event queue, initialized before registration.
	// The pointer is immutable; the queue synchronizes its own entries.
	Wq *waiter.Queue

	// Mask represents events this socket registered.
	Mask waiter.EventMask

	// Ready caches reported events. The notifier updates it concurrently with
	// socket readiness checks, which consume cached IN/OUT events.
	//
	// +checkatomic
	Ready atomicbitops.Uint64

	// Waiting is the notifier's record of whether this socket is registered
	// with the plugin stack's epoll instance.
	Waiting bool
}

EventInfo holds a socket's notification queue and readiness cache.

Mask and Waiting are protected by the owning notifier's mutex. EventInfo does not retain that notifier, so checklocks cannot express these guards.

type InitStackArgs

type InitStackArgs struct {
	// InitStr represents arguments needed to initialize plugin stack.
	InitStr string

	// FDs represents files opened during stack pre-init stage, which will
	// be used in stack initialization.
	FDs []int
}

InitStackArgs is a struct that holds arguments needed by PluginStack.Init.

type PluginNotifier

type PluginNotifier interface {
	// AddFD registers a socket fd and its event notification state with
	// the notifier.
	AddFD(fd uint32, eventinfo *EventInfo) error

	// RemoveFD unregisters a socket fd from the notifier.
	RemoveFD(fd uint32)

	// UpdateFD updates the set of events the socket fd needs
	// to be notified on.
	UpdateFD(fd uint32) error
}

PluginNotifier represents a set of operations to handle plugin network stack's event notification mechanisms.

type PluginStack

type PluginStack interface {
	inet.Stack

	// Init initializes plugin stack.
	Init(args *InitStackArgs) error

	// PreInit handles prepare steps before initializing plugin stack.
	// It may include joining namespace, mounting NIC, etc.
	PreInit(args *PreInitStackArgs) (string, []int, error)
}

PluginStack defines a set of stack operations to work with a third-party plugin stack.

func GetPluginStack

func GetPluginStack() PluginStack

GetPluginStack fetches the current registered plugin stack.

type PreInitStackArgs

type PreInitStackArgs struct {
	// Pid represents current process that invokes plugin stack
	// pre-init.
	Pid int
}

PreInitStackArgs is a struct that holds arguments needed by PluginStack.PreInit.

Directories

Path Synopsis
Package cgo provides interfaces definition to interact with third-party network stack.
Package cgo provides interfaces definition to interact with third-party network stack.
Package stack provides an implementation of plugin.PluginStack interface and an implementation of socket.Socket interface.
Package stack provides an implementation of plugin.PluginStack interface and an implementation of socket.Socket interface.

Jump to

Keyboard shortcuts

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