remote

package
v0.0.0-...-6113c70 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Close

func Close()

func GetSSHClient

func GetSSHClient(info *ServerInfo) (*ssh.Client, error)

func GetSession

func GetSession(info *ServerInfo) (*ssh.Session, error)

func GetSftpClient

func GetSftpClient(info *ServerInfo) (*sftp.Client, error)

Types

type BatchCusReader

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

func NewBatchCusReader

func NewBatchCusReader(serverList []*ServerInfo) (*BatchCusReader, error)

func (*BatchCusReader) Exec

func (b *BatchCusReader) Exec(cmd string) ([]*ResponseMsg, error)

func (*BatchCusReader) ExecGetResult

func (b *BatchCusReader) ExecGetResult() []*ResponseMsg

func (*BatchCusReader) UseBashExecScript

func (b *BatchCusReader) UseBashExecScript(remoteFile, script string) ([]*ResponseMsg, error)

type BatchRemoteClient

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

func NewBatchRemoteClient

func NewBatchRemoteClient(serverList []*ServerInfo) (*BatchRemoteClient, error)

func (*BatchRemoteClient) Close

func (b *BatchRemoteClient) Close()

func (*BatchRemoteClient) CopyDir

func (b *BatchRemoteClient) CopyDir(localDir, remoteDir string) ([]*ResponseMsg, error)

func (*BatchRemoteClient) CopyFile

func (b *BatchRemoteClient) CopyFile(localFile string, remoteFile string) ([]*ResponseMsg, error)

func (*BatchRemoteClient) Exec

func (b *BatchRemoteClient) Exec(cmd string) ([]*ResponseMsg, error)

func (*BatchRemoteClient) Foreach

func (b *BatchRemoteClient) Foreach(f func(r *RemoteClient) (string, error)) ([]*ResponseMsg, error)

func (*BatchRemoteClient) ScpDir

func (b *BatchRemoteClient) ScpDir(localDir, remoteDir string) ([]*ResponseMsg, error)

func (*BatchRemoteClient) ScpFile

func (b *BatchRemoteClient) ScpFile(localFile string, remoteFile string) ([]*ResponseMsg, error)

func (*BatchRemoteClient) UseBashExecScript

func (b *BatchRemoteClient) UseBashExecScript(remoteFile, script string) ([]*ResponseMsg, error)

type CusReader

type CusReader struct {
	*ServerInfo
	// contains filtered or unexported fields
}

func NewCusReader

func NewCusReader(info *ServerInfo) (*CusReader, error)

func NewCusReaderWithSession

func NewCusReaderWithSession(info *ServerInfo, session *ssh.Session) *CusReader

func (*CusReader) Close

func (c *CusReader) Close() error

func (*CusReader) Exec

func (c *CusReader) Exec(cmd string) (string, error)

func (*CusReader) ExecGetResult

func (c *CusReader) ExecGetResult() string

func (*CusReader) UseBashExecScript

func (c *CusReader) UseBashExecScript(remoteFile, script string) (string, error)

func (*CusReader) Write

func (c *CusReader) Write(p []byte) (n int, err error)

type RemoteClient

type RemoteClient struct {
	*ServerInfo
}

func NewRemoteClient

func NewRemoteClient(info *ServerInfo) (*RemoteClient, error)

func (*RemoteClient) Close

func (r *RemoteClient) Close()

func (*RemoteClient) CopyDir

func (r *RemoteClient) CopyDir(localDir, remoteDir string) error

func (*RemoteClient) CopyFile

func (r *RemoteClient) CopyFile(localFile string, remoteFile string) error

func (*RemoteClient) Exec

func (r *RemoteClient) Exec(cmd string) (string, error)

func (*RemoteClient) ExecWithTimeout

func (r *RemoteClient) ExecWithTimeout(cmd string, t time.Duration) (string, error)

func (*RemoteClient) ScpDir

func (r *RemoteClient) ScpDir(localDir, remoteDir string) error

func (*RemoteClient) ScpFile

func (r *RemoteClient) ScpFile(file string, remoteFile string) error

func (*RemoteClient) UseBashExecScript

func (r *RemoteClient) UseBashExecScript(remoteFile, script string) (string, error)

type ResponseMsg

type ResponseMsg struct {
	Host  string `json:"host,omitempty"`
	Msg   string `json:"msg,omitempty"`
	Error error  `json:"-"`
}

type ServerInfo

type ServerInfo struct {
	User     string
	Password string
	Key      string
	Host     string
	Port     int
}

Jump to

Keyboard shortcuts

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