helper

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2025 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package helper runs external helpers with optional sandboxing.

Index

Constants

View Source
const (
	// FortifyHelper is set to 1 when args fd is enabled and 0 otherwise.
	FortifyHelper = "FORTIFY_HELPER"
	// FortifyStatus is set to 1 when stat fd is enabled and 0 otherwise.
	FortifyStatus = "FORTIFY_STATUS"
)

Variables

View Source
var WaitDelay = 2 * time.Second

Functions

func InternalHelperStub added in v0.3.0

func InternalHelperStub()

InternalHelperStub is an internal function but exported because it is cross-package; it is part of the implementation of the helper stub.

func MustNewCheckedArgs

func MustNewCheckedArgs(args []string) io.WriterTo

MustNewCheckedArgs returns a checked null-terminated argument writer for a copy of args. If s contains a NUL byte this function panics instead of returning an error.

func NewCheckedArgs

func NewCheckedArgs(args []string) (wt io.WriterTo, err error)

NewCheckedArgs returns a checked null-terminated argument writer for a copy of args.

Types

type Helper

type Helper interface {
	// Start starts the helper process.
	Start() error
	// Wait blocks until Helper exits.
	Wait() error

	fmt.Stringer
}

func New

func New(
	ctx context.Context,
	name string,
	wt io.WriterTo,
	stat bool,
	argF func(argsFd, statFd int) []string,
	cmdF func(container *sandbox.Container),
	extraFiles []*os.File,
) Helper

New initialises a Helper instance with wt as the null-terminated argument writer.

func NewDirect added in v0.3.0

func NewDirect(
	ctx context.Context,
	name string,
	wt io.WriterTo,
	stat bool,
	argF func(argsFd, statFd int) []string,
	cmdF func(cmd *exec.Cmd),
	extraFiles []*os.File,
) Helper

NewDirect initialises a new direct Helper instance with wt as the null-terminated argument writer. Function argF returns an array of arguments passed directly to the child process.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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