msg

package
v0.24.1 Latest Latest
Warning

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

Go to latest
Published: May 21, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MSG_TERMINAL_DATA = iota
	MSG_TERMINAL_RESIZE
)

Variables

This section is empty.

Functions

func ReadCommand

func ReadCommand(conn net.Conn) (byte, error)

func ReadMessage

func ReadMessage(conn net.Conn, v interface{}) error

func ReadMessageWithTimeout added in v0.23.0

func ReadMessageWithTimeout(conn net.Conn, v interface{}, timeout time.Duration) error

func SendAddPortForward added in v0.24.0

func SendAddPortForward(conn net.Conn, entry model.PortForwardEntry) error

func SendLogMessage added in v0.11.5

func SendLogMessage(conn net.Conn, message *LogMessage) error

func SendRemovePortForward added in v0.24.0

func SendRemovePortForward(conn net.Conn, localPort uint16) error

func SendSpaceGetVar added in v0.21.0

func SendSpaceGetVar(conn net.Conn, name string) (string, error)

func SendSpaceNote added in v0.18.0

func SendSpaceNote(conn net.Conn, note string) error

func SendSpaceRestart added in v0.18.0

func SendSpaceRestart(conn net.Conn) error

func SendSpaceStop added in v0.18.0

func SendSpaceStop(conn net.Conn) error

func SendSpaceVar added in v0.21.0

func SendSpaceVar(conn net.Conn, name, value string) error

func WriteCommand

func WriteCommand(conn net.Conn, cmdType CmdType) error

func WriteMessage

func WriteMessage(conn net.Conn, payload interface{}) error

Types

type AddPortForwardMsg added in v0.24.0

type AddPortForwardMsg struct {
	model.PortForwardEntry
}

type AgentState

type AgentState struct {
	HasCodeServer           bool
	SSHPort                 int
	VNCHttpPort             int
	HasTerminal             bool
	TcpPorts                map[string]string
	HttpPorts               map[string]string
	HasVSCodeTunnel         bool
	VSCodeTunnelName        string
	Healthy                 bool
	CPUPercent              float64
	MemoryUsedBytes         uint64
	MemoryLimitBytes        uint64
	DiskUsedBytes           uint64
	DiskLimitBytes          uint64
	ActivityWriteCount      uint32
	ActivityCreateCount     uint32
	ActivityDeleteCount     uint32
	ActivityRenameCount     uint32
	ActivityDistinctPaths   uint32
	ActivityBucketStartUnix int64
	ActivityBucketFinalized bool
	LastActivityAtUnix      int64
}

type AgentStateReply added in v0.18.0

type AgentStateReply struct {
	Endpoints []string
}

func SendState

func SendState(conn net.Conn, hasCodeServer bool, sshPort int, vncHttpPort int, hasTerminal bool, tcpPorts *map[string]string, httpPorts *map[string]string, hasVSCodeTunnel bool, vscodeTunnelName string, healthy bool, cpuPercent float64, memoryUsedBytes uint64, memoryLimitBytes uint64, diskUsedBytes uint64, diskLimitBytes uint64, activityWriteCount uint32, activityCreateCount uint32, activityDeleteCount uint32, activityRenameCount uint32, activityDistinctPaths uint32, activityBucketStartUnix int64, activityBucketFinalized bool, lastActivityAtUnix int64) (AgentStateReply, error)

type CmdType added in v0.11.5

type CmdType byte
const (
	CmdNone CmdType = iota
	CmdPing
	CmdUpdateState
	CmdUpdateAuthorizedKeys
	CmdTerminal
	CmdCodeServer
	CmdProxyTCPPort
	CmdProxyVNC
	CmdProxyHTTP
	CmdVSCodeTunnelTerminal
	CmdLogMessage
	CmdUpdateShell
	CmdUpdateSpaceNote
	CmdUpdateSpaceVar
	CmdGetSpaceVar
	CmdTunnelPort
	CmdTunnelPortConnection
	CmdSpaceStop
	CmdSpaceRestart
	CmdRunCommand
	CmdCopyFile
	CmdPortForward
	CmdPortList
	CmdPortStop
	CmdExecuteScript
	CmdExecuteScriptStream
	CmdAddPortForward
	CmdRemovePortForward
)

type CopyFileMessage added in v0.19.0

type CopyFileMessage struct {
	SourcePath string `msgpack:"source_path"`
	DestPath   string `msgpack:"dest_path"`
	Content    []byte `msgpack:"content,omitempty"`
	Direction  string `msgpack:"direction"` // "to_space" or "from_space"
	Workdir    string `msgpack:"workdir"`
}

type CopyFileResponse added in v0.19.0

type CopyFileResponse struct {
	Success bool   `msgpack:"success"`
	Error   string `msgpack:"error"`
	Content []byte `msgpack:"content,omitempty"`
}

type ExecuteScriptMessage added in v0.23.0

type ExecuteScriptMessage struct {
	Content      string   `msgpack:"content"`
	Arguments    []string `msgpack:"arguments"`
	IsSystemCall bool     `msgpack:"is_system_call"`
}

type ExecuteScriptResponse added in v0.23.0

type ExecuteScriptResponse struct {
	Success  bool   `msgpack:"success"`
	Error    string `msgpack:"error"`
	Output   string `msgpack:"output"`
	ExitCode int    `msgpack:"exit_code"`
}

type ExecuteScriptStreamMessage added in v0.23.0

type ExecuteScriptStreamMessage struct {
	Content   string   `msgpack:"content"`
	Arguments []string `msgpack:"arguments"`
}

type HttpPort

type HttpPort struct {
	Port       uint16
	ServerName string
}

type LogLevel added in v0.11.5

type LogLevel byte
const (
	LogLevelDebug LogLevel = iota
	LogLevelInfo
	LogLevelError
)

type LogMessage added in v0.11.5

type LogMessage struct {
	Level   LogLevel
	Service string
	Message string
	Date    time.Time
}

type Pong

type Pong struct {
	Payload string
}

type PortForwardInfo added in v0.22.2

type PortForwardInfo struct {
	LocalPort  uint16 `json:"local_port" msgpack:"local_port"`
	Space      string `json:"space" msgpack:"space"`
	RemotePort uint16 `json:"remote_port" msgpack:"remote_port"`
	Persistent bool   `json:"persistent" msgpack:"persistent"`
}

type PortForwardRequest added in v0.22.2

type PortForwardRequest struct {
	LocalPort  uint16 `json:"local_port" msgpack:"local_port"`
	Space      string `json:"space" msgpack:"space"`
	RemotePort uint16 `json:"remote_port" msgpack:"remote_port"`
	Persistent bool   `json:"persistent" msgpack:"persistent"`
	Force      bool   `json:"force" msgpack:"force"`
}

Port forward between spaces

type PortForwardResponse added in v0.22.2

type PortForwardResponse struct {
	Success bool   `json:"success" msgpack:"success"`
	Error   string `json:"error" msgpack:"error"`
}

type PortListResponse added in v0.22.2

type PortListResponse struct {
	Forwards []PortForwardInfo `json:"forwards" msgpack:"forwards"`
}

type PortStopRequest added in v0.22.2

type PortStopRequest struct {
	LocalPort uint16 `json:"local_port" msgpack:"local_port"`
}

type PortStopResponse added in v0.22.2

type PortStopResponse struct {
	Success bool   `json:"success" msgpack:"success"`
	Error   string `json:"error" msgpack:"error"`
}

type Register

type Register struct {
	SpaceId string
	Version string
}

message sent from an agent to the server to register itself

type RegisterResponse

type RegisterResponse struct {
	Version                  string
	Success                  bool
	SSHKeys                  []string
	GitHubUsernames          []string
	Shell                    string
	SSHHostSigner            string
	WithTerminal             bool
	WithVSCodeTunnel         bool
	WithCodeServer           bool
	WithSSH                  bool
	WithRunCommand           bool
	Freeze                   bool
	AgentToken               string
	ServerURL                string
	HealthCheckType          string
	HealthCheckConfig        string
	HealthCheckSkipSSLVerify bool
	HealthCheckTimeout       uint32
	HealthCheckInterval      uint32
	HealthCheckMaxFailures   uint32
	HealthCheckAutoRestart   bool
	PortForwards             []model.PortForwardEntry
}

message sent from the server to the agent in response to a register message

type RemovePortForwardMsg added in v0.24.0

type RemovePortForwardMsg struct {
	LocalPort uint16 `json:"local_port" msgpack:"local_port"`
}

type RunCommandMessage added in v0.19.0

type RunCommandMessage struct {
	Command string   `msgpack:"command"`
	Args    []string `msgpack:"args"`
	Timeout int      `msgpack:"timeout"`
	Workdir string   `msgpack:"workdir"`
}

type RunCommandResponse added in v0.19.0

type RunCommandResponse struct {
	Success bool   `msgpack:"success"`
	Error   string `msgpack:"error"`
	Output  []byte `msgpack:"output"`
}

type SpaceGetVar added in v0.21.0

type SpaceGetVar struct {
	Name string
}

type SpaceGetVarResponse added in v0.21.0

type SpaceGetVarResponse struct {
	Value string
}

type SpaceNote added in v0.18.0

type SpaceNote struct {
	Note string
}

type SpaceVar added in v0.21.0

type SpaceVar struct {
	Name  string
	Value string
}

type TcpPort

type TcpPort struct {
	Port uint16
}

type Terminal

type Terminal struct {
	Shell string
}

message for terminal

type TerminalWindowSize

type TerminalWindowSize struct {
	Rows uint16 `json:"rows"`
	Cols uint16 `json:"cols"`
	X    uint16
	Y    uint16
}

type UpdateAuthorizedKeys

type UpdateAuthorizedKeys struct {
	SSHKeys         []string
	GitHubUsernames []string
}

message sent to update the authorized keys within an agent

type UpdateShell added in v0.11.5

type UpdateShell struct {
	Shell string
}

message sent to update the authorized keys within an agent

Jump to

Keyboard shortcuts

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