sandbox

package
v0.0.0-...-e14d18c Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2021 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BaseFileDirectory       = "/tmp"
	DefaultImage            = "node"
	DefaultRunner           = "node"
	DefaultScriptFile       = "index.js"
	DockerNetworkNameLength = 16
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Sandbox

type Sandbox struct {
	SandboxOptions
	// contains filtered or unexported fields
}

func NewSandbox

func NewSandbox(options SandboxOptions) (*Sandbox, error)

func (*Sandbox) Destroy

func (sandbox *Sandbox) Destroy() error

Destroy stops and deletes the sandbox and its associated resources.

func (*Sandbox) GetLogs

func (sandbox *Sandbox) GetLogs() (io.Writer, io.Writer, error)

GetLogs retrieves stdout and stderr logs from the sandbox.

func (*Sandbox) Start

func (sandbox *Sandbox) Start() error

Start begins executing untrusted code in the sandbox.

func (*Sandbox) Stop

func (sandbox *Sandbox) Stop() error

Stop terminates the execution of the sandbox.

func (*Sandbox) WaitUntilStopped

func (sandbox *Sandbox) WaitUntilStopped() (int64, string, error)

WaitUntilStopped blocks program execution until the sandbox has stopped running. It returns an exit status and error message.

type SandboxOptions

type SandboxOptions struct {
	ExecutableFilesPath  string
	ExecutableArguments  string
	ExecutableCommand    string
	PublishedPorts       []string
	EnvironmentVariables []string
}

Jump to

Keyboard shortcuts

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