Documentation
¶
Index ¶
- Constants
- func ReadCommand(conn net.Conn) (byte, error)
- func ReadMessage(conn net.Conn, v interface{}) error
- func ReadMessageWithTimeout(conn net.Conn, v interface{}, timeout time.Duration) error
- func SendAddPortForward(conn net.Conn, entry model.PortForwardEntry) error
- func SendEvent(conn net.Conn, event *Event) error
- func SendLogMessage(conn net.Conn, message *LogMessage) error
- func SendRemovePortForward(conn net.Conn, localPort uint16) error
- func SendSpaceGetVar(conn net.Conn, name string) (string, error)
- func SendSpaceNote(conn net.Conn, note string) error
- func SendSpaceRestart(conn net.Conn) error
- func SendSpaceStop(conn net.Conn) error
- func SendSpaceVar(conn net.Conn, name, value string) error
- func WriteCommand(conn net.Conn, cmdType CmdType) error
- func WriteMessage(conn net.Conn, payload interface{}) error
- type AddPortForwardMsg
- type AgentState
- type AgentStateReply
- type CallMethodBatchItem
- type CallMethodBatchRequest
- type CallMethodBatchResponse
- type CallMethodRequest
- type CallMethodResponse
- type CmdType
- type CopyFileMessage
- type CopyFileResponse
- type EditFileMessage
- type EditFileResponse
- type Event
- type EventReply
- type ExecuteScriptMessage
- type ExecuteScriptResponse
- type ExecuteScriptStreamMessage
- type ExtractMatch
- type FindMessage
- type FindResponse
- type GrepMatch
- type GrepMessage
- type GrepResponse
- type HealthConfig
- type HttpPort
- type LogLevel
- type LogMessage
- type Pong
- type PortForwardInfo
- type PortForwardRequest
- type PortForwardResponse
- type PortListResponse
- type PortStopRequest
- type PortStopResponse
- type Register
- type RegisterMethodsRequest
- type RegisterMethodsResponse
- type RegisterResponse
- type RemovePortForwardMsg
- type RunCommandMessage
- type RunCommandResponse
- type SedMessage
- type SedResponse
- type SpaceGetVar
- type SpaceGetVarResponse
- type SpaceNote
- type SpaceVar
- type TcpPort
- type Terminal
- type TerminalWindowSize
- type TunnelInfo
- type TunnelListResponse
- type TunnelStartRequest
- type TunnelStartResponse
- type TunnelStopRequest
- type TunnelStopResponse
- type UpdateAuthorizedKeys
- type UpdateShell
Constants ¶
const ( MSG_TERMINAL_DATA = iota MSG_TERMINAL_RESIZE )
Variables ¶
This section is empty.
Functions ¶
func ReadMessage ¶
func ReadMessageWithTimeout ¶ added in v0.23.0
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 SendSpaceGetVar ¶ added in v0.21.0
func SendSpaceRestart ¶ added in v0.18.0
func SendSpaceStop ¶ added in v0.18.0
func WriteMessage ¶
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
MethodCallsTotal uint64
HTTPRequestsTotal uint64
TCPConnectionsTotal uint64
}
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, methodCallsTotal uint64, httpRequestsTotal uint64, tcpConnectionsTotal uint64) (AgentStateReply, error)
type CallMethodBatchItem ¶ added in v0.28.0
type CallMethodBatchItem struct {
Method string `json:"method" msgpack:"method"`
Params json.RawMessage `json:"params,omitempty" msgpack:"params,omitempty"`
ID any `json:"id,omitempty" msgpack:"id,omitempty"`
IsNotification bool `json:"-" msgpack:"is_notification,omitempty"`
}
CallMethodBatchItem is one call inside a batch sent from the knot server to the agent. The server has already routed and rewritten Method to local_name.
type CallMethodBatchRequest ¶ added in v0.28.0
type CallMethodBatchRequest struct {
Items []CallMethodBatchItem `json:"items" msgpack:"items"`
}
CallMethodBatchRequest carries a sub-batch of calls targeting the same agent/space. The server groups incoming batch items by destination space and sends each group as one CallMethodBatchRequest over a single yamux stream.
type CallMethodBatchResponse ¶ added in v0.28.0
type CallMethodBatchResponse struct {
Responses []methods.JSONRPCResponse `json:"responses" msgpack:"responses"`
}
CallMethodBatchResponse is the agent's reply to a batch. Responses are in the same order as the request items that had IDs. Notifications produce no response entry.
type CallMethodRequest ¶ added in v0.28.0
type CallMethodRequest struct {
Method string `json:"method" msgpack:"method"`
Params json.RawMessage `json:"params,omitempty" msgpack:"params,omitempty"`
ID any `json:"id,omitempty" msgpack:"id,omitempty"`
IsNotification bool `json:"-" msgpack:"is_notification,omitempty"`
}
type CallMethodResponse ¶ added in v0.28.0
type CallMethodResponse struct {
Response methods.JSONRPCResponse `json:"response" msgpack:"response"`
}
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 CmdRegisterMethods CmdCallMethod CmdCallMethodBatch CmdUnregisterMethods CmdUpdateHealthConfig CmdEvent CmdTunnelStart CmdTunnelStop CmdTunnelList CmdGrep CmdFind CmdSed CmdEditFile )
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"`
Mode string `msgpack:"mode,omitempty"` // to_space only: "overwrite" (default), "append", "prepend"
}
type CopyFileResponse ¶ added in v0.19.0
type EditFileMessage ¶ added in v0.30.0
type EditFileMessage struct {
Path string `msgpack:"path" json:"path"`
Search string `msgpack:"search" json:"search"`
Replace string `msgpack:"replace" json:"replace"`
Workdir string `msgpack:"workdir,omitempty" json:"workdir,omitempty"`
}
EditFileMessage performs a targeted search-and-replace on a single file in the space's agent via the scriptling extlibs EditFile function. The search text must appear exactly once (uniqueness check); the modification is written atomically (temp file + rename).
type EditFileResponse ¶ added in v0.30.0
type EventReply ¶ added in v0.28.0
type EventReply struct{}
type ExecuteScriptMessage ¶ added in v0.23.0
type ExecuteScriptResponse ¶ added in v0.23.0
type ExecuteScriptStreamMessage ¶ added in v0.23.0
type ExtractMatch ¶ added in v0.30.0
type ExtractMatch struct {
File string `msgpack:"file" json:"file"`
Line int `msgpack:"line" json:"line"`
Text string `msgpack:"text" json:"text"`
Groups []string `msgpack:"groups,omitempty" json:"groups,omitempty"`
}
ExtractMatch is a single match with capture groups (for extract mode).
type FindMessage ¶ added in v0.30.0
type FindMessage struct {
Path string `msgpack:"path" json:"path"`
Recursive bool `msgpack:"recursive" json:"recursive"`
Type string `msgpack:"type,omitempty" json:"type,omitempty"` // "any", "file", "dir"
Name string `msgpack:"name,omitempty" json:"name,omitempty"`
IncludeHidden bool `msgpack:"include_hidden" json:"include_hidden"`
FollowLinks bool `msgpack:"follow_links" json:"follow_links"`
MaxDepth int `msgpack:"max_depth,omitempty" json:"max_depth,omitempty"`
MtimeMin *float64 `msgpack:"mtime_min,omitempty" json:"mtime_min,omitempty"`
MtimeMax *float64 `msgpack:"mtime_max,omitempty" json:"mtime_max,omitempty"`
SizeMin *int64 `msgpack:"size_min,omitempty" json:"size_min,omitempty"`
SizeMax *int64 `msgpack:"size_max,omitempty" json:"size_max,omitempty"`
Workdir string `msgpack:"workdir,omitempty" json:"workdir,omitempty"`
}
FindMessage finds files/directories in the space's agent via the scriptling extlibs Find function (concurrent walker).
type FindResponse ¶ added in v0.30.0
type GrepMatch ¶ added in v0.30.0
type GrepMatch struct {
File string `msgpack:"file" json:"file"`
Line int `msgpack:"line" json:"line"`
Text string `msgpack:"text" json:"text"`
}
GrepMatch is a single matching line.
type GrepMessage ¶ added in v0.30.0
type GrepMessage struct {
Pattern string `msgpack:"pattern" json:"pattern"`
Path string `msgpack:"path" json:"path"`
Literal bool `msgpack:"literal" json:"literal"`
Recursive bool `msgpack:"recursive" json:"recursive"`
IgnoreCase bool `msgpack:"ignore_case" json:"ignore_case"`
Glob string `msgpack:"glob,omitempty" json:"glob,omitempty"`
FollowLinks bool `msgpack:"follow_links" json:"follow_links"`
MaxSize int64 `msgpack:"max_size,omitempty" json:"max_size,omitempty"`
Workdir string `msgpack:"workdir,omitempty" json:"workdir,omitempty"`
}
GrepMessage searches file contents in the space's agent via the scriptling extlibs Grep function (parallel worker pool, no interpreter).
type GrepResponse ¶ added in v0.30.0
type HealthConfig ¶ added in v0.28.0
type LogMessage ¶ added in v0.11.5
type PortForwardInfo ¶ added in v0.22.2
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 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 RegisterMethodsRequest ¶ added in v0.28.0
type RegisterMethodsRequest struct {
Registration methods.Registration `json:"registration" msgpack:"registration"`
}
type RegisterMethodsResponse ¶ added in v0.28.0
type RegisterResponse ¶
type RegisterResponse struct {
Version string
Success bool
SSHKeys []string
SSHPrivateKey string
GitHubUsernames []string
Shell string
SSHHostSigner string
WithTerminal bool
WithVSCodeTunnel bool
WithCodeServer bool
WithSSH bool
WithRunCommand bool
Freeze bool
AgentToken string
ServerURL string
AgentEndpoint 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 RunCommandResponse ¶ added in v0.19.0
type SedMessage ¶ added in v0.30.0
type SedMessage struct {
Mode string `msgpack:"mode" json:"mode"` // "replace", "replace_pattern", "extract"
Pattern string `msgpack:"pattern" json:"pattern"`
Replacement string `msgpack:"replacement,omitempty" json:"replacement,omitempty"`
Path string `msgpack:"path" json:"path"`
Recursive bool `msgpack:"recursive" json:"recursive"`
IgnoreCase bool `msgpack:"ignore_case" json:"ignore_case"`
Glob string `msgpack:"glob,omitempty" json:"glob,omitempty"`
FollowLinks bool `msgpack:"follow_links" json:"follow_links"`
MaxSize int64 `msgpack:"max_size,omitempty" json:"max_size,omitempty"`
Workdir string `msgpack:"workdir,omitempty" json:"workdir,omitempty"`
}
SedMessage performs an in-place edit or capture extraction in the space's agent via the scriptling extlibs Sed functions. Mode selects the operation: "replace" (literal), "replace_pattern" (regex), or "extract" (read-only capture-group extraction).
type SedResponse ¶ added in v0.30.0
type SedResponse struct {
Success bool `msgpack:"success" json:"success"`
Error string `msgpack:"error,omitempty" json:"error,omitempty"`
Mode string `msgpack:"mode,omitempty" json:"mode,omitempty"`
FilesModified int64 `msgpack:"files_modified,omitempty" json:"files_modified,omitempty"` // replace / replace_pattern
Matches []ExtractMatch `msgpack:"matches,omitempty" json:"matches,omitempty"` // extract
}
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 TerminalWindowSize ¶
type TunnelInfo ¶ added in v0.29.0
type TunnelListResponse ¶ added in v0.29.0
type TunnelListResponse struct {
Tunnels []TunnelInfo `json:"tunnels" msgpack:"tunnels"`
}
type TunnelStartRequest ¶ added in v0.29.0
type TunnelStartRequest struct {
Protocol string `json:"protocol" msgpack:"protocol"`
Port uint16 `json:"port" msgpack:"port"`
Name string `json:"name" msgpack:"name"`
TlsName string `json:"tls_name,omitempty" msgpack:"tls_name,omitempty"`
TlsSkipVerify bool `json:"tls_skip_verify,omitempty" msgpack:"tls_skip_verify,omitempty"`
}
type TunnelStartResponse ¶ added in v0.29.0
type TunnelStartResponse struct {
Success bool `json:"success" msgpack:"success"`
Error string `json:"error,omitempty" msgpack:"error,omitempty"`
URL string `json:"url,omitempty" msgpack:"url,omitempty"`
}
func SendTunnelStart ¶ added in v0.29.0
func SendTunnelStart(conn net.Conn, req *TunnelStartRequest) (*TunnelStartResponse, error)
type TunnelStopRequest ¶ added in v0.29.0
type TunnelStopRequest struct {
Name string `json:"name" msgpack:"name"`
}
type TunnelStopResponse ¶ added in v0.29.0
type UpdateAuthorizedKeys ¶
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
Source Files
¶
- messages.go
- msg_copy_file.go
- msg_event.go
- msg_execute_script.go
- msg_execute_script_stream.go
- msg_file_ops.go
- msg_health_config.go
- msg_logmsg.go
- msg_methods.go
- msg_ping.go
- msg_port.go
- msg_register.go
- msg_run_command.go
- msg_space.go
- msg_state.go
- msg_terminal.go
- msg_tunnel.go
- msg_update_authorized_keys.go
- msg_update_shell.go