-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathtypes.go
50 lines (42 loc) · 1.41 KB
/
types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package k8s_exec_pod
import "k8s.io/client-go/tools/remotecommand"
type HttpRequest struct {
}
type HttpResponse struct {
Code int `json:"code"`
Message string `json:"message"`
Token string `json:"token"`
}
type TermMsg struct {
MsgType TermMessageType `json:"type"`
Input string `json:"input"`
Rows uint16 `json:"rows"`
Cols uint16 `json:"cols"`
}
type TermMessageType string
const (
TermResize TermMessageType = "resize"
TermInput TermMessageType = "input"
TermPing TermMessageType = "ping"
)
// TerminalSession implements PtyHandler (using a SockJS connection)
type TerminalSession struct {
id string
bound chan error
websocketSession Proxy
sizeChan chan remotecommand.TerminalSize
doneChan chan struct{}
}
// TerminalMessage is the messaging protocol between ShellController and TerminalSession.
//
// OP DIRECTION FIELD(S) USED DESCRIPTION
// ---------------------------------------------------------------------
// bind fe->be SessionID Id sent back from TerminalResponse
// stdin fe->be Data Keystrokes/paste buffer
// resize fe->be Rows, Cols New terminal size
// stdout be->fe Data Output from the process
// toast be->fe Data OOB message to be shown to the user
type TerminalMessage struct {
Op, Data, SessionID string
Rows, Cols uint16
}