ssh

package
v0.4.11-alpha4 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2025 License: Apache-2.0 Imports: 10 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSshClient

func NewSshClient(user, password string, port string) (*ssh.Client, error)

func ReceiveWsMsgPassword

func ReceiveWsMsgPassword(wsConn *websocket.Conn, logBuff *bytes.Buffer) string

func ReceiveWsMsgUser

func ReceiveWsMsgUser(wsConn *websocket.Conn, logBuff *bytes.Buffer) string

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

func WsReaderCopy

func WsReaderCopy(reader *websocket.Conn, writer io.Writer)

将前端的输入转发到终端

func WsWriterCopy

func WsWriterCopy(reader io.Reader, writer *websocket.Conn)

将终端的输出转发到前端

Types

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
}

func NewSshConn

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

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) Login

func (ssConn *SshConn) Login(wsConn *websocket.Conn, logBuff *bytes.Buffer, exitCh chan bool)

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

func (*SshConn) ReceiveWsMsg

func (ssConn *SshConn) ReceiveWsMsg(wsConn *websocket.Conn, logBuff *bytes.Buffer, exitCh chan bool)

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

func (*SshConn) SendComboOutput

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

func (*SshConn) SessionWait

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

Jump to

Keyboard shortcuts

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