debuglet

package
v0.3.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2026 License: Apache-2.0 Imports: 39 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrOutputIncomplete = errors.New("guest output was not fully accepted")

ErrOutputIncomplete means a nonempty stdout/stderr suffix was refused.

Functions

func ExpectedTagging added in v0.3.0

func ExpectedTagging(iface *net.Interface, counter string) tagger.Mode

ExpectedTagging is the mode a run on this node is set up to get: the kernel tagger where the eBPF packet counter loaded on the interface, since the tagger attaches to the same interface the same way, otherwise the pure-Go tagger. A run whose kernel tagger then fails to load falls back to the pure-Go tagger; Tagging reports what it actually got.

func IPv6PublicHost added in v0.3.0

func IPv6PublicHost(host string) bool

IPv6PublicHost reports whether host is an IPv6 literal (IPv4-mapped counts as IPv4), under which a run that refuses IPv6 cannot offer a listener.

func UserspaceTagging added in v0.3.0

func UserspaceTagging() string

UserspaceTagging is the IPv4 mode the pure-Go tagger gives a run on this host: userspace where it can send tagged datagrams through raw sockets (Linux with CAP_NET_RAW), none elsewhere.

func WorkerMain added in v0.3.0

func WorkerMain()

WorkerMain dispatches the executor's private inherited-descriptor mode before normal configuration or credentials are loaded. It opens no network listener. Tests use the identical entry point in their test executable.

Types

type CompileError

type CompileError struct{ Err error }

CompileError is a module that wazero did not compile. Err is wazero's description of the failure, which can quote names from the module itself.

func (*CompileError) Error

func (e *CompileError) Error() string

func (*CompileError) Unwrap

func (e *CompileError) Unwrap() error

type Debuglet

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

Debuglet is the engine that loads, initialises, and runs a single WASM debuglet module. One Debuglet instance corresponds to one session.

func New

func New(logger *zap.Logger, debugletID uuid.UUID, transactionID string, policy scheduler.Policy, operator netpolicy.Operator, schedule *tesla.KeySchedule, limiter *app.Limiter, pc ratelimit.PacketCount, iface *net.Interface, portManager *socket.PortManager, budget *socket.Budget) *Debuglet

New creates a ready-to-initialise Debuglet backed by a wazero Runtime. operator is the executor's network policy; together with the run's declared destinations it decides every transport the guest can use.

func (*Debuglet) Close

func (d *Debuglet) Close(ctx context.Context) error

Close terminates owned I/O and runtime resources exactly once. While InitRuntime is still running, Close leaves the runtime and any compiled module it published to InitRuntime, which releases them once on return. It does not wait for Run or its caller's watcher: the executor joins those separately. The context reaches wazero; it cannot force an arbitrary socket Close to end.

func (*Debuglet) GetSCIONAddr

func (d *Debuglet) GetSCIONAddr() string

GetSCIONAddr returns the local SCION address of the server listener started during Init.

func (*Debuglet) ID

func (d *Debuglet) ID() uuid.UUID

func (*Debuglet) InitRuntime

func (d *Debuglet) InitRuntime(ctx context.Context, wasmBytes []byte) error

InitRuntime starts the network servers and compiles and instantiates the WASM module. It must be called exactly once before Run.

func (*Debuglet) Registry

func (d *Debuglet) Registry() *socket.SocketRegistry

func (*Debuglet) Run

func (d *Debuglet) Run(ctx context.Context, outputCh chan<- []byte, args []string) error

Run executes the debuglet's "_start" WASM export, streams stdout/stderr back through outputCh, and returns any execution error. The outputCh channel is closed when the debuglet finishes execution.

func (*Debuglet) StartServers

func (d *Debuglet) StartServers(ctx context.Context, req StartServersReq) error

StartServers starts the network listeners required by this run after reserving each listener against its run and node budgets.

func (*Debuglet) TCPListenerEndpoint added in v0.3.0

func (d *Debuglet) TCPListenerEndpoint() string

func (*Debuglet) Tagging added in v0.3.0

func (d *Debuglet) Tagging() tagger.Mode

Tagging is this run's effective tagging mode, fixed when it was created.

type StartServersReq

type StartServersReq struct {
	UDP   bool
	TCP   bool
	SCION bool
}

type Worker added in v0.3.0

type Worker struct {
	*Debuglet
	// contains filtered or unexported fields
}

Worker preserves the parent's networking environment. Only WASM compilation, WASI and linear memory live in the supervised process.

func NewWorker added in v0.3.0

func NewWorker(parent *Debuglet, supervisor *isolation.Supervisor) *Worker

func (*Worker) Close added in v0.3.0

func (w *Worker) Close(ctx context.Context) error

func (*Worker) InitRuntime added in v0.3.0

func (w *Worker) InitRuntime(ctx context.Context, module []byte) error

func (*Worker) Run added in v0.3.0

func (w *Worker) Run(ctx context.Context, output chan<- []byte, args []string) (result error)

Directories

Path Synopsis
Package netpolicy holds the one network policy the executor applies to guest traffic: which transports a guest may use, which destinations it may reach, and on which ports.
Package netpolicy holds the one network policy the executor applies to guest traffic: which transports a guest may use, which destinations it may reach, and on which ports.
Package wasm contains the WASM host function implementations that are imported by WASM modules at runtime.
Package wasm contains the WASM host function implementations that are imported by WASM modules at runtime.

Jump to

Keyboard shortcuts

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