controllers

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2022 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthPreChecker

func AuthPreChecker(i AfterAuthenticated) func(w http.ResponseWriter, r *http.Request)

func DispatchMessage

func DispatchMessage(sshSession *ssh.Session, messageType websocket.MessageType, wsData []byte, wc io.WriteCloser) error

func SignIn

func SignIn(w http.ResponseWriter, r *http.Request)

Types

type AfterAuthenticated

type AfterAuthenticated interface {
	// make sure token and session is not nil.
	ServeAfterAuthenticated(w http.ResponseWriter, r *http.Request, token *utils.Claims, session utils.Session)
	ShouldClearSessionAfterExec() bool
}

type SSHWebSocketHandle

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

func NewSSHWSHandle added in v0.2.0

func NewSSHWSHandle(bfc int) *SSHWebSocketHandle

func (*SSHWebSocketHandle) SSHShellOverWS added in v0.2.1

func (c *SSHWebSocketHandle) SSHShellOverWS(ctx context.Context, ws *websocket.Conn, host string, port int, username string, auth ssh.AuthMethod, cols, rows uint32) error

ssh shell over websocket first,we establish a ssh connection to ssh server when a webSocket comes; then we deliver ssh data via ssh connection between browser and ssh server. That is, read webSocket data from browser (e.g. 'ls' command) and send data to ssh server via ssh connection; the other hand, read returned ssh data from ssh server and write back to browser via webSocket API.

func (*SSHWebSocketHandle) ServeAfterAuthenticated

func (c *SSHWebSocketHandle) ServeAfterAuthenticated(w http.ResponseWriter, r *http.Request, claims *utils.Claims, session utils.Session)

handle webSocket connection.

func (*SSHWebSocketHandle) ShouldClearSessionAfterExec

func (c *SSHWebSocketHandle) ShouldClearSessionAfterExec() bool

clear session after ssh closed.

type WebSocketBufferWriter

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

write data to WebSocket the data comes from ssh server.

func (*WebSocketBufferWriter) Flush

flush all data in this buff into WebSocket.

func (*WebSocketBufferWriter) Write

func (w *WebSocketBufferWriter) Write(p []byte) (int, error)

implement Write interface to write bytes from ssh server into bytes.Buffer.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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