handler

package
v0.0.0-...-cc9cac3 Latest Latest
Warning

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

Go to latest
Published: May 15, 2025 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Clients      = make(map[string]*xwebsocket.Conn)
	OptionAgents = make(map[string]*agent.Agent)
)

Functions

func AddAgent

func AddAgent(hostTag, clientId string, ws *xwebsocket.Conn)

func AgentOption

func AgentOption(w http.ResponseWriter, r *http.Request)

func CheckConnection

func CheckConnection(w http.ResponseWriter, r *http.Request)

func CheckConnections

func CheckConnections(w http.ResponseWriter, r *http.Request)

func HandleAttach

func HandleAttach(wsAttach *xwebsocket.Conn)

func HandleAttachV2

func HandleAttachV2(w http.ResponseWriter, r *http.Request)

Client 连接处理函数

func HandleTerminalWS

func HandleTerminalWS(w http.ResponseWriter, r *http.Request)

HandleTerminalWS 处理Web终端的WebSocket连接

func HandleWebSocket

func HandleWebSocket(ws *xwebsocket.Conn)

func HandleWebSocketV2

func HandleWebSocketV2(w http.ResponseWriter, r *http.Request)

func IndexHelper

func IndexHelper(w http.ResponseWriter, r *http.Request)

func ListAgents

func ListAgents(w http.ResponseWriter, r *http.Request)

func RemoveAgent

func RemoveAgent(hostTag, clientId string)

func ServeIndexPage

func ServeIndexPage(w http.ResponseWriter, r *http.Request)

func ServeTerminal

func ServeTerminal(w http.ResponseWriter, r *http.Request)

ServeTerminal 提供终端页面

func StableVersion

func StableVersion(w http.ResponseWriter, r *http.Request)

Types

type AgentConnection

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

type ClientConnection

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

type ConnectionManager

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

定义连接管理结构

func NewConnectionManager

func NewConnectionManager() *ConnectionManager

创建新的连接管理器

func (*ConnectionManager) CheckAgentConnection

func (cm *ConnectionManager) CheckAgentConnection(hostTag, clientId string) error

添加新的检查连接方法

func (*ConnectionManager) HandleAgentConnection

func (cm *ConnectionManager) HandleAgentConnection(ws *websocket.Conn, hostTag, clientId string, r *http.Request)

处理 Agent 连接

func (*ConnectionManager) HandleClientConnection

func (cm *ConnectionManager) HandleClientConnection(ws *websocket.Conn, hostTag, clientId string, r *http.Request) error

处理 Client 连接

func (*ConnectionManager) RemoveAgent

func (cm *ConnectionManager) RemoveAgent(hostTag, clientId string)

添加 RemoveAgent 方法到 ConnectionManager

type TerminalMessage

type TerminalMessage struct {
	Type string `json:"type"`
	Rows int    `json:"rows,omitempty"`
	Cols int    `json:"cols,omitempty"`
	Data string `json:"data,omitempty"`
}

TerminalMessage 定义终端消息结构

Jump to

Keyboard shortcuts

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