ssh

package
v0.1.4-alpha Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultPort    = 22
	DefaultUser    = "root"
	DefaultKeyFile = "~/.ssh/id_rsa"
)

default remote info

Variables

This section is empty.

Functions

This section is empty.

Types

type Command

type Command struct {
	Cmd   string
	Shell string
}

type RemoteOption

type RemoteOption struct {
	Host       string
	Port       string
	User       string
	KeyFile    *string
	Password   *string
	WorkDir    string
	Command    *Command
	File       *TransferFile
	Session    *ssh.Session
	SftpClient *sftp.Client
	NetDevice  string
}

func NewRemoteOption

func NewRemoteOption(host, port, user, password, key, netdevice string) (*RemoteOption, error)

NewRemoteOption return a new RemoteOption

func (*RemoteOption) Close

func (r *RemoteOption) Close()

func (*RemoteOption) CopyFileFromRemote

func (r *RemoteOption) CopyFileFromRemote() error

func (*RemoteOption) CopyFileToRmote

func (r *RemoteOption) CopyFileToRmote() error

func (*RemoteOption) RunCommand

func (r *RemoteOption) RunCommand() (string, error)

type TransferFile

type TransferFile struct {
	SrcFile string
	DstFile string
}

Jump to

Keyboard shortcuts

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