MCPcopy
hub / github.com/1Panel-dev/KubePi / New

Function New

thirdparty/gotty/webtty/webtty.go:43–61  ·  view source on GitHub ↗

New creates a new instance of WebTTY. masterConn is a connection to the PTY master, typically it's a websocket connection to a client. slave is a PTY slave such as a local command with a PTY.

(masterConn Master, slave Slave, options ...Option)

Source from the content-addressed store, hash-verified

41// typically it's a websocket connection to a client.
42// slave is a PTY slave such as a local command with a PTY.
43func New(masterConn Master, slave Slave, options ...Option) (*WebTTY, error) {
44 wt := &WebTTY{
45 masterConn: masterConn,
46 slave: slave,
47
48 permitWrite: false,
49 columns: 0,
50 rows: 0,
51
52 bufferSize: MaxBufferSize,
53 lastPingTime: time.Now(),
54 }
55
56 for _, option := range options {
57 option(wt)
58 }
59
60 return wt, nil
61}
62
63// Run starts the main process of the WebTTY.
64// This method blocks until the context is canceled.

Callers 2

TestWriteFromPTYFunction · 0.70
TestWriteFromConnFunction · 0.70

Calls

no outgoing calls

Tested by 2

TestWriteFromPTYFunction · 0.56
TestWriteFromConnFunction · 0.56