sshclient

package
v1.8.5-beta5 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

sshclient ssh client library

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetLogger added in v1.8.6

func SetLogger(globalLogger log.Logger)

func TranslateContent added in v1.8.6

func TranslateContent(content []byte, decoder *encoding.Decoder) (string, error)

TranslateContent 使用给定的解码器将字节缓冲区中的内容转换为UTF-8编码的字符串。 这个函数接受一个字节数组和一个解码器作为输入,解码器用于将特定编码的字节数组转换为UTF-8。 函数返回转换后的UTF-8字符串以及可能出现的错误。

参数:

output: 一个[]byte类型的实例,包含需要转换的字节数组。
decoder: 一个*encoding.Decoder类型的指针,用于将字节数组解码为UTF-8。

返回值:

string: 转换后的UTF-8编码字符串。
error: 如果在读取或转换过程中发生错误,则返回该错误;否则返回nil。

Types

type SSHConnection added in v1.8.2

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

func NewSSHConnection added in v1.8.2

func NewSSHConnection(hostNameAndPort string, userName string, password string, timeout int) *SSHConnection

func (*SSHConnection) CloseConnection added in v1.8.2

func (thisConnection *SSHConnection) CloseConnection()

func (*SSHConnection) NewSession added in v1.8.2

func (thisConnection *SSHConnection) NewSession(encoder string) *SSHSession

type SSHSession added in v1.8.2

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

func (*SSHSession) BindInputOutput added in v1.8.2

func (thisSession *SSHSession) BindInputOutput() error

func (*SSHSession) CloseSession added in v1.8.2

func (thisSession *SSHSession) CloseSession()

func (*SSHSession) DownloadFile added in v1.8.2

func (thisSession *SSHSession) DownloadFile(remoteFilePath string, localFilePath string)

func (*SSHSession) ExecuteShellCommand added in v1.8.2

func (thisSession *SSHSession) ExecuteShellCommand(command string, moreCommand string,
	prompt string, clearLine string) (string, error)

ExecuteShellCommand 执行命令,当需要 huawei' clear line command is "\x1B[42D"

func (*SSHSession) ExecuteSingleCommand added in v1.8.2

func (thisSession *SSHSession) ExecuteSingleCommand(command string) (string, error)

func (*SSHSession) GetShellCommandResult added in v1.8.2

func (thisSession *SSHSession) GetShellCommandResult(prompt string,
	moreCommand string, clearLine string) string

func (*SSHSession) SendShellCommand added in v1.8.2

func (thisSession *SSHSession) SendShellCommand(command string) error

func (*SSHSession) UploadFile added in v1.8.2

func (thisSession *SSHSession) UploadFile(localFilePath string, remoteFilePath string)

Jump to

Keyboard shortcuts

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