websocket

package
v2.21.1 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2022 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const END_OF_TRANSMISSION = "\u0004"

Variables

This section is empty.

Functions

func EncodeUserEmailtoID added in v2.21.0

func EncodeUserEmailtoID(email string) string

func Terminal added in v2.21.0

func Terminal(ctx context.Context, ws *websocket.Conn, client ctrlruntimeclient.Client, k8sClient kubernetes.Interface, cfg *restclient.Config, podName string)

Terminal is called for any new websocket connection.

func WriteSettings

func WriteSettings(ctx context.Context, providers watcher.Providers, ws *websocket.Conn)

func WriteUser

func WriteUser(ctx context.Context, providers watcher.Providers, ws *websocket.Conn, userEmail string)

Types

type PtyHandler added in v2.21.0

type PtyHandler interface {
	io.Reader
	io.Writer
	remotecommand.TerminalSizeQueue
}

PtyHandler is what remote command expects from a pty.

type TerminalMessage added in v2.21.0

type TerminalMessage struct {
	Op, Data, SessionID string
	Rows, Cols          uint16
}

TerminalMessage is the messaging protocol between ShellController and TerminalSession.

OP DIRECTION FIELD(S) USED DESCRIPTION --------------------------------------------------------------------- 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 TerminalSession added in v2.21.0

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

TerminalSession implements PtyHandler (using a websocket connection).

func (TerminalSession) Next added in v2.21.0

TerminalSize handles pty->process resize events. Called in a loop from remotecommand as long as the process is running.

func (TerminalSession) Read added in v2.21.0

func (t TerminalSession) Read(p []byte) (int, error)

Read handles pty->process messages (stdin, resize). Called in a loop from remotecommand as long as the process is running.

func (TerminalSession) Toast added in v2.21.0

func (t TerminalSession) Toast(p string) error

Toast can be used to send the user any OOB messages. hterm puts these in the center of the terminal.

func (TerminalSession) Write added in v2.21.0

func (t TerminalSession) Write(p []byte) (int, error)

Write handles process->pty stdout. Called from remotecommand whenever there is any output.

Jump to

Keyboard shortcuts

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