guestagent

package
v0.2.9 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Guest agent runs inside the Firecracker VM and handles: 1. Command execution requests from the host 2. Ready signal to indicate VM is ready 3. VFS client connection to host for FUSE

Index

Constants

View Source
const (
	AF_VSOCK        = 40
	VMADDR_CID_HOST = 2

	VsockPortExec  = 5000
	VsockPortVFS   = 5001
	VsockPortReady = 5002

	MsgTypeExec        uint8 = 1
	MsgTypeExecResult  uint8 = 2
	MsgTypeStdout      uint8 = 3
	MsgTypeStderr      uint8 = 4
	MsgTypeSignal      uint8 = 5
	MsgTypeReady       uint8 = 6
	MsgTypeStdin       uint8 = 7
	MsgTypeResize      uint8 = 8
	MsgTypeExecTTY     uint8 = 9
	MsgTypeExit        uint8 = 10
	MsgTypeExecStream  uint8 = 11
	MsgTypeExecPipe    uint8 = 12
	MsgTypePortForward uint8 = 13
	MsgTypeWriteFile   uint8 = 14
	MsgTypeReadFile    uint8 = 15
	MsgTypeListFiles   uint8 = 16
	MsgTypeFileResult  uint8 = 17
)

Variables

View Source
var (
	// Vsock errors
	ErrSocket  = errors.New("socket")
	ErrBind    = errors.New("bind")
	ErrListen  = errors.New("listen")
	ErrConnect = errors.New("connect")
	ErrEOF     = errors.New("EOF")

	// User resolution errors
	ErrResolveUID    = errors.New("resolve uid")
	ErrResolveGID    = errors.New("resolve gid")
	ErrUserNotFound  = errors.New("user not found")
	ErrGroupNotFound = errors.New("group not found")
)

Functions

func Run

func Run()

Types

type ExecRequest

type ExecRequest struct {
	Command    string            `json:"command"`
	Args       []string          `json:"args"`
	WorkingDir string            `json:"working_dir"`
	Env        map[string]string `json:"env"`
	Stdin      []byte            `json:"stdin"`
	User       string            `json:"user,omitempty"`
}

type ExecResponse

type ExecResponse struct {
	ExitCode int    `json:"exit_code"`
	Stdout   []byte `json:"stdout"`
	Stderr   []byte `json:"stderr"`
	Error    string `json:"error"`
}

type ExecTTYRequest

type ExecTTYRequest struct {
	Command    string            `json:"command"`
	Args       []string          `json:"args"`
	WorkingDir string            `json:"working_dir"`
	Env        map[string]string `json:"env"`
	Rows       uint16            `json:"rows"`
	Cols       uint16            `json:"cols"`
	User       string            `json:"user,omitempty"`
}

type FileInfo added in v0.1.25

type FileInfo struct {
	Name  string `json:"name"`
	Size  int64  `json:"size"`
	Mode  uint32 `json:"mode"`
	IsDir bool   `json:"is_dir"`
}

type FileResponse added in v0.1.25

type FileResponse struct {
	Content []byte     `json:"content,omitempty"`
	Files   []FileInfo `json:"files,omitempty"`
	Error   string     `json:"error,omitempty"`
}

type ListFilesRequest added in v0.1.25

type ListFilesRequest struct {
	Path string `json:"path"`
}

type PortForwardRequest

type PortForwardRequest struct {
	Host string `json:"host,omitempty"`
	Port uint16 `json:"port"`
}

type ReadFileRequest added in v0.1.25

type ReadFileRequest struct {
	Path string `json:"path"`
}

type VFSClient

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

VFS client for FUSE daemon (placeholder - would need full FUSE implementation)

func NewVFSClient

func NewVFSClient() (*VFSClient, error)

func (*VFSClient) Close

func (c *VFSClient) Close() error

type WriteFileRequest added in v0.1.25

type WriteFileRequest struct {
	Path    string `json:"path"`
	Content []byte `json:"content"`
	Mode    uint32 `json:"mode"`
}

Jump to

Keyboard shortcuts

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