Documentation
¶
Overview ¶
Package rexec provides a Go SDK for interacting with Rexec - Terminal as a Service.
The SDK allows you to programmatically create, manage, and interact with sandboxed Linux environments through the Rexec API.
Basic usage:
client := rexec.NewClient("https://your-rexec-instance.com", "your-api-token")
// Create a container
container, err := client.Containers.Create(ctx, &rexec.CreateContainerRequest{
Image: "ubuntu:24.04",
Name: "my-sandbox",
})
// Connect to terminal
term, err := client.Terminal.Connect(ctx, container.ID)
term.Write([]byte("echo hello\n"))
Index ¶
- type APIError
- type Client
- type Container
- type ContainerService
- func (s *ContainerService) Create(ctx context.Context, req *CreateContainerRequest) (*Container, error)
- func (s *ContainerService) Delete(ctx context.Context, id string) error
- func (s *ContainerService) Get(ctx context.Context, id string) (*Container, error)
- func (s *ContainerService) List(ctx context.Context) ([]Container, error)
- func (s *ContainerService) Start(ctx context.Context, id string) error
- func (s *ContainerService) Stop(ctx context.Context, id string) error
- type CreateContainerRequest
- type ErrorResponse
- type FileInfo
- type FileService
- type Terminal
- type TerminalService
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// Services
Containers *ContainerService
Files *FileService
Terminal *TerminalService
// contains filtered or unexported fields
}
Client is the main Rexec API client.
func (*Client) SetHTTPClient ¶
SetHTTPClient sets a custom HTTP client.
type Container ¶
type Container struct {
ID string `json:"id"`
Name string `json:"name"`
Image string `json:"image"`
Status string `json:"status"`
CreatedAt time.Time `json:"created_at"`
StartedAt *time.Time `json:"started_at,omitempty"`
Labels map[string]string `json:"labels,omitempty"`
Environment map[string]string `json:"environment,omitempty"`
}
Container represents a Rexec container/sandbox.
type ContainerService ¶
type ContainerService struct {
// contains filtered or unexported fields
}
ContainerService handles container operations.
func (*ContainerService) Create ¶
func (s *ContainerService) Create(ctx context.Context, req *CreateContainerRequest) (*Container, error)
Create creates a new container.
func (*ContainerService) Delete ¶
func (s *ContainerService) Delete(ctx context.Context, id string) error
Delete deletes a container.
func (*ContainerService) List ¶
func (s *ContainerService) List(ctx context.Context) ([]Container, error)
List returns all containers for the authenticated user.
type CreateContainerRequest ¶
type CreateContainerRequest struct {
Name string `json:"name,omitempty"`
Image string `json:"image"`
Environment map[string]string `json:"environment,omitempty"`
Labels map[string]string `json:"labels,omitempty"`
}
CreateContainerRequest represents a request to create a container.
type ErrorResponse ¶
type ErrorResponse struct {
Error string `json:"error"`
}
ErrorResponse represents an API error response.
type FileInfo ¶
type FileInfo struct {
Name string `json:"name"`
Path string `json:"path"`
Size int64 `json:"size"`
Mode string `json:"mode"`
ModTime time.Time `json:"mod_time"`
IsDir bool `json:"is_dir"`
}
FileInfo represents file metadata.
type FileService ¶
type FileService struct {
// contains filtered or unexported fields
}
FileService handles file operations.
type Terminal ¶
type Terminal struct {
// contains filtered or unexported fields
}
Terminal represents a WebSocket terminal connection.
type TerminalService ¶
type TerminalService struct {
// contains filtered or unexported fields
}
TerminalService handles terminal connections.