Documentation
¶
Index ¶
- func CheckDockerAvailability() error
- func EnsureIOContainerImage(imageName string) error
- func ExecuteInPooledContainer(ctx context.Context, pool *ContainerPool, command string, repoRoot string) (string, error)
- func PullDockerImage(image string) error
- func ReadFileInContainer(filePath, repoRoot, containerImage string, timeout time.Duration, ...) (string, error)
- func ReadFileInContainerPooled(ctx context.Context, pool *ContainerPool, filePath, repoRoot string) (string, error)
- func RunIOContainer(repoRoot, containerImage, command string, timeout time.Duration, ...) (string, error)
- func ValidateContainerImageName(image string) error
- func ValidateExecCommand(command string, whitelist []string) error
- func ValidateIOContainer(repoRoot, containerImage string) error
- func ValidatePath(requestedPath string, repositoryRoot string, excludedPaths []string) (string, error)
- func ValidateWriteExtension(filePath string, allowedExtensions []string) error
- func WriteFileInContainer(filePath, content, repoRoot, containerImage string, timeout time.Duration, ...) error
- func WriteFileInContainerPooled(ctx context.Context, pool *ContainerPool, filePath, content, repoRoot string) error
- type AuditLogger
- type ContainerConfig
- type ContainerPool
- type ContainerResult
- type PoolConfig
- type PooledContainer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckDockerAvailability ¶
func CheckDockerAvailability() error
CheckDockerAvailability verifies Docker is installed and accessible
func EnsureIOContainerImage ¶
EnsureIOContainerImage verifies the I/O container image exists
func ExecuteInPooledContainer ¶
func ExecuteInPooledContainer(ctx context.Context, pool *ContainerPool, command string, repoRoot string) (string, error)
ExecuteInPooledContainer executes a command using a container from the pool
func PullDockerImage ¶
PullDockerImage ensures the required image is available
func ReadFileInContainer ¶
func ReadFileInContainer(filePath, repoRoot, containerImage string, timeout time.Duration, memLimit string, cpuLimit int) (string, error)
ReadFileInContainer reads a file using the I/O container
func ReadFileInContainerPooled ¶
func ReadFileInContainerPooled(ctx context.Context, pool *ContainerPool, filePath, repoRoot string) (string, error)
ReadFileInContainerPooled reads a file using a pooled container
func RunIOContainer ¶
func RunIOContainer(repoRoot, containerImage, command string, timeout time.Duration, memLimit string, cpuLimit int) (string, error)
RunIOContainer executes a containerized I/O operation
func ValidateContainerImageName ¶
ValidateContainerImageName ensures the image name is well-formed and free of shell metacharacters
func ValidateExecCommand ¶
ValidateExecCommand checks if the command is allowed to execute Note: Exec is always enabled in container-only mode
func ValidateIOContainer ¶
ValidateIOContainer runs pre-flight checks for containerized I/O
func ValidatePath ¶
func ValidateWriteExtension ¶
ValidateWriteExtension checks if the file extension is allowed for writing
func WriteFileInContainer ¶
func WriteFileInContainer(filePath, content, repoRoot, containerImage string, timeout time.Duration, memLimit string, cpuLimit int) error
WriteFileInContainer writes a file using the I/O container
func WriteFileInContainerPooled ¶
func WriteFileInContainerPooled(ctx context.Context, pool *ContainerPool, filePath, content, repoRoot string) error
WriteFileInContainerPooled writes a file using a pooled container
Types ¶
type AuditLogger ¶
type AuditLogger struct {
// contains filtered or unexported fields
}
AuditLogger handles audit logging operations
func NewAuditLogger ¶
func NewAuditLogger(logPath string) (*AuditLogger, error)
NewAuditLogger creates a new audit logger
type ContainerConfig ¶
type ContainerConfig struct {
Image string
Command string
RepoRoot string
MemoryLimit string
CPULimit int
Timeout time.Duration
Stdin string // NEW: stdin content to pass to container
}
ContainerConfig holds configuration for running a container
type ContainerPool ¶
type ContainerPool struct {
// contains filtered or unexported fields
}
ContainerPool manages a pool of reusable Docker containers
func NewContainerPool ¶
func NewContainerPool(ctx context.Context, cfg PoolConfig) (*ContainerPool, error)
NewContainerPool creates a new container pool
func (*ContainerPool) Close ¶
func (p *ContainerPool) Close() error
Close shuts down the pool and cleans up all containers
func (*ContainerPool) Get ¶
func (p *ContainerPool) Get(ctx context.Context) (*PooledContainer, error)
Get acquires a container from the pool
func (*ContainerPool) Return ¶
func (p *ContainerPool) Return(ctx context.Context, container *PooledContainer) error
Return releases a container back to the pool
func (*ContainerPool) Stats ¶
func (p *ContainerPool) Stats() map[string]interface{}
Stats returns pool statistics
type ContainerResult ¶
ContainerResult holds the result of container execution
func RunContainer ¶
func RunContainer(cfg ContainerConfig) (ContainerResult, error)
RunContainer executes a command in a Docker container with security restrictions