Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type TerminalMessage ¶
type TerminalMessage struct { Operation string `json:"operation"` Data string `json:"data"` Rows uint16 `json:"rows"` Cols uint16 `json:"cols"` }
TerminalMessage 定义了终端和容器 shell 交互内容的格式 Operation 是操作类型 Data 是具体数据内容 Rows和Cols 可以理解为终端的行数和列数,也就是宽、高
type TerminalSession ¶
type TerminalSession struct {
// contains filtered or unexported fields
}
TerminalSession 定义 TerminalSession 结构体,实现 PtyHandler 接口 // wsConn 是 websocket 连接 // sizeChan 用来定义终端输入和输出的宽和高 // doneChan 用于标记退出终端
func NewTerminalSession ¶
func NewTerminalSession(w http.ResponseWriter, r *http.Request) (*TerminalSession, error)
NewTerminalSession 该方法用于升级 http 协议至 websocket,并new一个 TerminalSession 类型的对象返回
func (*TerminalSession) Next ¶
func (t *TerminalSession) Next() *remotecommand.TerminalSize
Next 获取web端是否resize,以及是否退出终端
Click to show internal directories.
Click to hide internal directories.