terminal

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WebsocketTerminal

func WebsocketTerminal(c *gin.Context)

WebsocketTerminal WebSocket 连接(终端)

Types

type Conn

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

Conn 单个终端连接

type DiskInfo

type DiskInfo struct {
	MountPoint string `json:"mount"` // 挂载点路径
	Total      uint64 `json:"total"` // 总大小 (字节)
	Used       uint64 `json:"used"`  // 已用 (字节)
}

DiskInfo 单个磁盘/挂载点信息

type Hub

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

Hub 管理所有终端连接

func GetHub

func GetHub() *Hub

GetHub 获取全局终端 Hub

type Message

type Message struct {
	Type    string       `json:"type"` // "data", "resize", "auth", "monitor", "monitor_toggle"
	Data    string       `json:"data,omitempty"`
	Size    *Size        `json:"size,omitempty"`
	Monitor *MonitorData `json:"monitor,omitempty"`
	Enabled *bool        `json:"enabled,omitempty"` // monitor_toggle 时使用
}

Message WebSocket 消息结构

type MonitorData

type MonitorData struct {
	CPU      float64    `json:"cpu"`       // CPU 使用率 (百分比)
	MemTotal uint64     `json:"mem_total"` // 总内存 (字节)
	MemUsed  uint64     `json:"mem_used"`  // 已用内存 (字节)
	Disks    []DiskInfo `json:"disks"`     // 多磁盘/挂载点信息
}

MonitorData 远程监控数据

type Size

type Size struct {
	Cols int `json:"cols"`
	Rows int `json:"rows"`
}

Size 终端尺寸

Jump to

Keyboard shortcuts

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