Documentation
¶
Index ¶
- Constants
- func DetectProjectNetwork(ctx context.Context, dockerCLI command.Cli, suffix string) string
- func GenerateGostConfig(allowCIDRs, allowHosts []string) string
- func NewSandboxProject(pid, uid, gid int, buildContext, dockerfile, image string, ...) (*composetypes.Project, error)
- func NormalizeProjectName(name string) string
- func ProjectSandboxName(cwd string) string
- func RunHost(ctx context.Context, cmd string, stdout, stderr io.Writer) (int, error)
- type CleanResult
- type ComposeExecutor
- func (e *ComposeExecutor) ApplyNetworkPolicy(ctx context.Context) error
- func (e *ComposeExecutor) CleanStale(ctx context.Context) (CleanResult, error)
- func (e *ComposeExecutor) Down(ctx context.Context) error
- func (e *ComposeExecutor) IsRunning(ctx context.Context) (bool, error)
- func (e *ComposeExecutor) RunContainer(ctx context.Context, serviceName, cmd string, env []string, ...) (int, error)
- func (e *ComposeExecutor) RunContainerDirect(ctx context.Context, serviceName, cmd string, env []string, ...) (int, error)
- func (e *ComposeExecutor) StartBackground(ctx context.Context)
- func (e *ComposeExecutor) Up(ctx context.Context) error
- func (e *ComposeExecutor) WaitReady(ctx context.Context) error
Constants ¶
const SandboxServiceName = "workspace"
Variables ¶
This section is empty.
Functions ¶
func DetectProjectNetwork ¶
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 ¶
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 NormalizeProjectName ¶
NormalizeProjectName converts a directory name to a Docker Compose project name.
func ProjectSandboxName ¶
Types ¶
type CleanResult ¶
type ComposeExecutor ¶
type ComposeExecutor struct {
// contains filtered or unexported fields
}
func NewComposeExecutor ¶
func NewComposeExecutor(dockerCLI command.Cli, project *composetypes.Project, nonoProfile, nonoYoloProfile string) *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) IsRunning ¶
func (e *ComposeExecutor) IsRunning(ctx context.Context) (bool, error)
func (*ComposeExecutor) RunContainer ¶
func (*ComposeExecutor) RunContainerDirect ¶
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.