executor

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: May 31, 2026 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const SandboxServiceName = "workspace"

Variables

This section is empty.

Functions

func DetectProjectNetwork

func DetectProjectNetwork(ctx context.Context, dockerCLI command.Cli, suffix string) string

DetectProjectNetwork checks whether a Docker network named "<cwd-project>_<suffix>" exists. Returns the full network name if found, "" otherwise. If suffix is empty, "default" is used.

func GenerateGostConfig

func GenerateGostConfig(allowCIDRs, allowHosts []string) string

GenerateGostConfig produces a go-gost v3 YAML configuration with: - SOCKS5 proxy on :1080 - HTTP proxy on :3128 - default-deny bypass with whitelist of allowCIDRs and allowHosts

func NewSandboxProject

func NewSandboxProject(pid, uid, gid int, buildContext, dockerfile, image string, allowCIDRs, allowHosts []string, externalNetwork string) (*composetypes.Project, error)

func NormalizeProjectName

func NormalizeProjectName(name string) string

NormalizeProjectName converts a directory name to a Docker Compose project name.

func ProjectSandboxName

func ProjectSandboxName(cwd string) string

func RunHost

func RunHost(ctx context.Context, cmd string, stdout, stderr io.Writer) (int, error)

Types

type CleanResult

type CleanResult struct {
	Containers int
	Networks   int
}

type ComposeExecutor

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

func NewComposeExecutor

func NewComposeExecutor(dockerCLI command.Cli, project *composetypes.Project) *ComposeExecutor

func (*ComposeExecutor) ApplyNetworkPolicy

func (e *ComposeExecutor) ApplyNetworkPolicy(ctx context.Context) error

ApplyNetworkPolicy disconnects the workspace container from the default network and connects it to sandbox_internal, enforcing proxy-only outbound access. Call this after Up() completes.

func (*ComposeExecutor) CleanStale

func (e *ComposeExecutor) CleanStale(ctx context.Context) (CleanResult, error)

func (*ComposeExecutor) Down

func (e *ComposeExecutor) Down(ctx context.Context) error

func (*ComposeExecutor) IsRunning

func (e *ComposeExecutor) IsRunning(ctx context.Context) (bool, error)

func (*ComposeExecutor) RunContainer

func (e *ComposeExecutor) RunContainer(ctx context.Context, serviceName, cmd string, env []string, stdout, stderr io.Writer) (int, error)

func (*ComposeExecutor) RunContainerDirect

func (e *ComposeExecutor) RunContainerDirect(ctx context.Context, serviceName, cmd string, env []string, stdout, stderr io.Writer) (int, error)

func (*ComposeExecutor) StartBackground

func (e *ComposeExecutor) StartBackground(ctx context.Context)

StartBackground runs Up and ApplyNetworkPolicy in a goroutine. Call WaitReady before issuing commands to ensure the sandbox is available.

func (*ComposeExecutor) Up

func (e *ComposeExecutor) Up(ctx context.Context) error

func (*ComposeExecutor) WaitReady

func (e *ComposeExecutor) WaitReady(ctx context.Context) error

WaitReady blocks until StartBackground completes or ctx is cancelled.

Jump to

Keyboard shortcuts

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