ssh

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2021 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SSHConfig = &SSHConfigType{}

Functions

func FixSSHAuth

func FixSSHAuth() error

func GetClientConfig

func GetClientConfig(host *config.Host) *gossh.ClientConfig

func GetSSHLocalHost

func GetSSHLocalHost() string

func GetTerminalWidth

func GetTerminalWidth() int

func NewAgent

func NewAgent() (agent.Agent, error)

func Start

func Start(cfg *SSHConfigType, targets []string) error

Types

type Client

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

func NewClient

func NewClient() *Client

func (*Client) Connect

func (c *Client) Connect(host *config.Host) (err error)

func (*Client) ConnectSftp

func (c *Client) ConnectSftp(host *config.Host) (err error)

func (*Client) Download

func (c *Client) Download(remotePath, localPath string) (err error)

func (*Client) Execute

func (c *Client) Execute(cmd string) (exitCode int, err error)

func (*Client) ForwardToAgent

func (c *Client) ForwardToAgent() (err error)

func (*Client) ListFilesAndDirs

func (c *Client) ListFilesAndDirs(remotePath string) (items []string, err error)

func (*Client) MakeSession

func (c *Client) MakeSession() (session *ssh.Session, finalize func(), err error)

func (*Client) Script

func (c *Client) Script(path string) (int, error)

func (*Client) Shell

func (c *Client) Shell() error

func (*Client) UpdateTerminalSize

func (c *Client) UpdateTerminalSize(session *ssh.Session)

监听窗口大小变化,并自动调节

func (*Client) Upload

func (c *Client) Upload(localPath, remotePath string) (err error)

type SSHConfigType

type SSHConfigType struct {
	Tasks          []*Task
	Tags           string
	Command        string
	Script         string
	Module         string
	UploadSrc      string
	UploadDest     string
	DownloadSrc    string
	DownloadDest   string
	FailedContinue bool
}

type Task

type Task struct {
	Index        int
	Target       *config.Host
	Command      string
	Message      string
	Outputer     string
	UploadSrc    string
	UploadDest   string
	DownloadSrc  string
	DownloadDest string
}

func (*Task) ParseCommand

func (task *Task) ParseCommand(command, script, module string) error

func (*Task) Start

func (task *Task) Start() (err error)

Jump to

Keyboard shortcuts

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