Documentation
¶
Index ¶
- Constants
- func EnsureImageTag(image string) string
- func GetCommand(cmd string, args []string) []string
- func GetEnvVars(env map[string]string) []string
- func GetImage(image string) string
- func JoinArgs(args []string) string
- func MapToEnv(env map[string]string) []string
- func PrepareLabels(boxID string, p *model.LinuxAndroidBoxCreateParam) map[string]string
- func ProcessPullProgress(reader io.Reader, writer io.Writer) error
- func WaitForResponse(reader io.Reader) ([]byte, error)
- type ImageService
- type Service
- func (s *Service) BoxActionClick(ctx context.Context, id string, params *model.BoxActionClickParams) (*model.BoxActionClickResult, error)
- func (s *Service) BoxActionDrag(ctx context.Context, id string, params *model.BoxActionDragParams) (*model.BoxActionDragResult, error)
- func (s *Service) BoxActionMove(ctx context.Context, id string, params *model.BoxActionMoveParams) (*model.BoxActionMoveResult, error)
- func (s *Service) BoxActionPress(ctx context.Context, id string, params *model.BoxActionPressParams) (*model.BoxActionPressResult, error)
- func (s *Service) BoxActionScreenshot(ctx context.Context, id string, params *model.BoxActionScreenshotParams) (*model.BoxActionScreenshotResult, error)
- func (s *Service) BoxActionScroll(ctx context.Context, id string, params *model.BoxActionScrollParams) (*model.BoxActionScrollResult, error)
- func (s *Service) BoxActionTouch(ctx context.Context, id string, params *model.BoxActionTouchParams) (*model.BoxActionTouchResult, error)
- func (s *Service) BoxActionType(ctx context.Context, id string, params *model.BoxActionTypeParams) (*model.BoxActionTypeResult, error)
- func (s *Service) Close() error
- func (s *Service) CreateAndroidBox(ctx context.Context, params *model.AndroidBoxCreateParam) (*model.Box, error)
- func (s *Service) CreateLinuxBox(ctx context.Context, params *model.LinuxAndroidBoxCreateParam) (*model.Box, error)
- func (s *Service) Delete(ctx context.Context, id string, req *model.BoxDeleteParams) (*model.BoxDeleteResult, error)
- func (s *Service) DeleteAll(ctx context.Context, req *model.BoxesDeleteParams) (*model.BoxesDeleteResult, error)
- func (s *Service) Exec(ctx context.Context, id string, req *model.BoxExecParams) (*model.BoxExecResult, error)
- func (s *Service) ExecWS(ctx context.Context, id string, params *model.BoxExecWSParams, ...) (*model.BoxExecResult, error)
- func (s *Service) ExtractArchive(ctx context.Context, id string, req *model.BoxArchiveExtractParams) error
- func (s *Service) Get(ctx context.Context, id string) (*model.Box, error)
- func (s *Service) GetArchive(ctx context.Context, id string, req *model.BoxArchiveGetParams) (*model.BoxArchiveResult, io.ReadCloser, error)
- func (s *Service) GetExternalPort(ctx context.Context, id string, internalPort int) (int, error)
- func (s *Service) HeadArchive(ctx context.Context, id string, req *model.BoxArchiveHeadParams) (*model.BoxArchiveHeadResult, error)
- func (s *Service) List(ctx context.Context, params *model.BoxListParams) (*model.BoxListResult, error)
- func (s *Service) ListFiles(ctx context.Context, id string, params *model.BoxFileListParams) (*model.BoxFileListResult, error)
- func (s *Service) ReadFile(ctx context.Context, id string, params *model.BoxFileReadParams) (*model.BoxFileReadResult, error)
- func (s *Service) Reclaim(ctx context.Context) (*model.BoxReclaimResult, error)
- func (s *Service) RunCode(ctx context.Context, id string, req *model.BoxRunCodeParams) (*model.BoxRunCodeResult, error)
- func (s *Service) Start(ctx context.Context, id string) (*model.BoxStartResult, error)
- func (s *Service) Stop(ctx context.Context, id string) (*model.BoxStopResult, error)
- func (s *Service) WriteFile(ctx context.Context, id string, params *model.BoxFileWriteParams) (*model.BoxFileWriteResult, error)
Constants ¶
const (
DefaultImage = "ubuntu:latest"
)
const (
GboxExtraLabelPrefix = "gbox.extra"
)
Variables ¶
This section is empty.
Functions ¶
func EnsureImageTag ¶
EnsureImageTag ensures an image name has a tag, using various fallback strategies
func GetCommand ¶
GetCommand returns the command to run, falling back to default if none specified
func GetEnvVars ¶
GetEnvVars converts environment variables map to string slice
func PrepareLabels ¶
func PrepareLabels(boxID string, p *model.LinuxAndroidBoxCreateParam) map[string]string
func ProcessPullProgress ¶
ProcessPullProgress reads Docker pull progress from reader and writes to the writer Returns error if encountered
Types ¶
type ImageService ¶
type ImageService struct {
// contains filtered or unexported fields
}
ImageService manages Docker images in the background via triggers.
func NewImageService ¶
func NewImageService(dockerClient *client.Client, logger *logger.Logger) *ImageService
NewImageService creates a new ImageService.
func (*ImageService) PruneImages ¶
func (s *ImageService) PruneImages(imageRef string)
PruneImages sends a trigger to prune old versions of an image.
func (*ImageService) PullImage ¶
func (s *ImageService) PullImage(imageRef string, writer io.Writer)
PullImage sends a trigger to pull an image.
func (*ImageService) Start ¶
func (s *ImageService) Start()
Start begins the background image management goroutine.
func (*ImageService) Stop ¶
func (s *ImageService) Stop()
Stop gracefully stops the image management service.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service implements the box service interface using Docker.
func NewService ¶
func NewService(tracker tracker.AccessTracker) (*Service, error)
NewService creates a new Docker service instance.
func (*Service) BoxActionClick ¶
func (s *Service) BoxActionClick(ctx context.Context, id string, params *model.BoxActionClickParams) (*model.BoxActionClickResult, error)
func (*Service) BoxActionDrag ¶
func (s *Service) BoxActionDrag(ctx context.Context, id string, params *model.BoxActionDragParams) (*model.BoxActionDragResult, error)
func (*Service) BoxActionMove ¶
func (s *Service) BoxActionMove(ctx context.Context, id string, params *model.BoxActionMoveParams) (*model.BoxActionMoveResult, error)
func (*Service) BoxActionPress ¶
func (s *Service) BoxActionPress(ctx context.Context, id string, params *model.BoxActionPressParams) (*model.BoxActionPressResult, error)
func (*Service) BoxActionScreenshot ¶
func (s *Service) BoxActionScreenshot(ctx context.Context, id string, params *model.BoxActionScreenshotParams) (*model.BoxActionScreenshotResult, error)
func (*Service) BoxActionScroll ¶
func (s *Service) BoxActionScroll(ctx context.Context, id string, params *model.BoxActionScrollParams) (*model.BoxActionScrollResult, error)
func (*Service) BoxActionTouch ¶
func (s *Service) BoxActionTouch(ctx context.Context, id string, params *model.BoxActionTouchParams) (*model.BoxActionTouchResult, error)
func (*Service) BoxActionType ¶
func (s *Service) BoxActionType(ctx context.Context, id string, params *model.BoxActionTypeParams) (*model.BoxActionTypeResult, error)
func (*Service) CreateAndroidBox ¶
func (s *Service) CreateAndroidBox(ctx context.Context, params *model.AndroidBoxCreateParam) (*model.Box, error)
not implemented
func (*Service) CreateLinuxBox ¶
func (s *Service) CreateLinuxBox(ctx context.Context, params *model.LinuxAndroidBoxCreateParam) (*model.Box, error)
CreateLinuxBox creates an Alpine Linux box with specific parameters
func (*Service) Delete ¶
func (s *Service) Delete(ctx context.Context, id string, req *model.BoxDeleteParams) (*model.BoxDeleteResult, error)
Delete implements Service.Delete
func (*Service) DeleteAll ¶
func (s *Service) DeleteAll(ctx context.Context, req *model.BoxesDeleteParams) (*model.BoxesDeleteResult, error)
DeleteAll implements Service.DeleteAll
func (*Service) Exec ¶
func (s *Service) Exec(ctx context.Context, id string, req *model.BoxExecParams) (*model.BoxExecResult, error)
Exec implements Service.Exec
func (*Service) ExecWS ¶
func (s *Service) ExecWS(ctx context.Context, id string, params *model.BoxExecWSParams, wsConn *websocket.Conn) (*model.BoxExecResult, error)
ExecWS implements Service.ExecWS for WebSocket connections
func (*Service) ExtractArchive ¶
func (s *Service) ExtractArchive(ctx context.Context, id string, req *model.BoxArchiveExtractParams) error
ExtractArchive implements Service.ExtractArchive
func (*Service) GetArchive ¶
func (s *Service) GetArchive(ctx context.Context, id string, req *model.BoxArchiveGetParams) (*model.BoxArchiveResult, io.ReadCloser, error)
GetArchive implements Service.GetArchive
func (*Service) GetExternalPort ¶
GetExternalPort implements Service.GetExternalPort
func (*Service) HeadArchive ¶
func (s *Service) HeadArchive(ctx context.Context, id string, req *model.BoxArchiveHeadParams) (*model.BoxArchiveHeadResult, error)
HeadArchive implements Service.HeadArchive
func (*Service) List ¶
func (s *Service) List(ctx context.Context, params *model.BoxListParams) (*model.BoxListResult, error)
List implements Service.List
func (*Service) ListFiles ¶
func (s *Service) ListFiles(ctx context.Context, id string, params *model.BoxFileListParams) (*model.BoxFileListResult, error)
ListFiles lists files in a directory within a container
func (*Service) ReadFile ¶
func (s *Service) ReadFile(ctx context.Context, id string, params *model.BoxFileReadParams) (*model.BoxFileReadResult, error)
ReadFile reads the content of a file within a container
func (*Service) RunCode ¶
func (s *Service) RunCode(ctx context.Context, id string, req *model.BoxRunCodeParams) (*model.BoxRunCodeResult, error)
RunCode implements Service.RunCode