plugin

package
v0.0.0-...-ae1d4cc Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: Apache-2.0, MIT Imports: 4 Imported by: 0

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 {
	// Queue is the socket corresponding event queue.
	Wq *waiter.Queue

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

	// Ready represents events has been currently reported.
	Ready waiter.EventMask

	// Waiting represents whether there is any waiting event.
	Waiting bool
}

EventInfo is a struct that holds information necessary to a socket notification mechanisms.

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 new socket fd and its corresponding
	// event notification info into the global fdMap.
	AddFD(fd uint32, eventinfo *EventInfo) error

	// RemoveFD unregisters a socket fd and its corresponding
	// event notification info from the global fdMap.
	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