server

package
v0.3.6 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2018 License: Apache-2.0 Imports: 51 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateAttachHandler added in v0.2.6

func CreateAttachHandler(path string) http.Handler

CreateAttachHandler is called from main for /v1/sockjs

func WaitForTerminal added in v0.2.6

func WaitForTerminal(k8sClient kubernetes.Interface, cfg *rest.Config, request *restful.Request, sessionId string)

WaitForTerminal is called from apihandler.handleAttach as a goroutine Waits for the SockJS connection to be opened by the client the session to be bound in handleTerminalSession

Types

type App

type App struct {
	Config          config.Config
	ServiceProvider *serviceprovider.Container
}

App is the structure to set config & service provider of APP

func (*App) AppRoute

func (a *App) AppRoute() *mux.Router

AppRoute will add router

func (*App) InitilizeService

func (a *App) InitilizeService()

InitilizeService weavering services with global variables inside server package

func (*App) LoadConfig

func (a *App) LoadConfig(configPath string) *App

LoadConfig consumes a string of path to the json config file and read config file into Config.

func (*App) Start

func (a *App) Start(host, port string) error

Start consumes two strings, host and port, invoke service initilization and serve on desired host:port

type PtyHandler added in v0.2.6

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

PtyHandler is what remotecommand expects from a pty

type TerminalMessage added in v0.2.6

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 --------------------------------------------------------------------- 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 TerminalResponse added in v0.2.6

type TerminalResponse struct {
	Id string `json:"id"`
}

TerminalResponse is sent by handleExecShell. The Id is a random session id that binds the original REST request and the SockJS connection. Any clientapi in possession of this Id can hijack the terminal session.

type TerminalSession added in v0.2.6

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

TerminalSession implements PtyHandler (using a SockJS connection)

func (TerminalSession) Close added in v0.2.6

func (t TerminalSession) Close(status uint32, reason string)

Close shuts down the SockJS connection and sends the status code and reason to the client Can happen if the process exits or if there is an error starting up the process For now the status code is unused and reason is shown to the user (unless "")

func (TerminalSession) Next added in v0.2.6

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

func (TerminalSession) Read added in v0.2.6

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 v0.2.6

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 v0.2.6

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

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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