core

package
v0.0.0-...-1fd6b9d Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2021 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HandleError

func HandleError(c *gin.Context, err error) bool

func JsonError

func JsonError(c *gin.Context, msg interface{})

func NewSshClient

func NewSshClient(server Server) (*ssh.Client, error)

func WshandleError

func WshandleError(ws *websocket.Conn, err error) bool

Types

type Server

type Server struct {
	Ip     string
	Port   int
	User   string
	Passwd string
}

type SshConn

type SshConn struct {
	// calling Write() to write data into ssh server
	StdinPipe io.WriteCloser
	// Write() be called to receive data from ssh server
	ComboOutput *wsBufferWriter
	Session     *ssh.Session
	SftpClient  *sftp.Client
}

SshConn connect to ssh server using ssh session.

func NewSshConn

func NewSshConn(cols, rows int, sshClient *ssh.Client) (*SshConn, error)

NewSshConn setup ssh shell session. set Session and StdinPipe here, and the Session.Stdout and Session.Sdterr are also set.

func (*SshConn) Close

func (s *SshConn) Close()

func (*SshConn) ReceiveWsMsg

func (s *SshConn) ReceiveWsMsg(wsConn *websocket.Conn, exitCh chan bool)

ReceiveWsMsg receive websocket msg do some handling then write into ssh.session.stdin

func (*SshConn) SendComboOutput

func (s *SshConn) SendComboOutput(wsConn *websocket.Conn, exitCh chan bool)

func (*SshConn) SessionWait

func (s *SshConn) SessionWait(quitChan chan bool)

Jump to

Keyboard shortcuts

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