Documentation
¶
Index ¶
- Constants
- func WithCommandTimeout(timeout time.Duration) func(*Client)
- func WithConcurrency(count int) func(*Client)
- func WithConnTimeout(timeout time.Duration) func(*Client)
- func WithProxyServer(proxyServer, user string, port int, auths []ssh.AuthMethod) func(*Client)
- type Client
- func (c *Client) BatchRun(hosts []*Host, sshTask Task) <-chan *Result
- func (c *Client) ExecuteCmd(host *Host, command, lang, runAs string, sudo bool) (string, error)
- func (c *Client) ExecuteScript(host *Host, srcFile, dstDir, lang, runAs string, ...) (string, error)
- func (c *Client) FetchFiles(host *Host, srcFiles []string, dstDir, tmpDir string, sudo bool, runAs string) (string, error)
- func (c *Client) PushFiles(host *Host, srcFiles, srcZipFiles []string, dstDir string, allowOverwrite bool) (string, error)
- type Host
- type Proxy
- type Result
- type Task
Constants ¶
View Source
const ( // SuccessIdentifier for result output. SuccessIdentifier = "SUCCESS" // FailedIdentifier for result output. FailedIdentifier = "FAILED" )
Variables ¶
This section is empty.
Functions ¶
func WithCommandTimeout ¶
WithCommandTimeout task connection timeout option.
func WithConcurrency ¶
WithConcurrency concurrency tasks number option.
func WithConnTimeout ¶
WithConnTimeout ssh connection timeout option.
func WithProxyServer ¶
func WithProxyServer(proxyServer, user string, port int, auths []ssh.AuthMethod) func(*Client)
WithProxyServer connect remote hosts by proxy server.
Types ¶
type Client ¶
type Client struct { ConnTimeout time.Duration CommandTimeout time.Duration Concurrency int Proxy *Proxy }
Client for ssh.
func (*Client) ExecuteCmd ¶
ExecuteCmd on remote host.
func (*Client) ExecuteScript ¶
func (c *Client) ExecuteScript( host *Host, srcFile, dstDir, lang, runAs string, sudo, remove, allowOverwrite bool, ) (string, error)
ExecuteScript on remote host.
type Host ¶
type Host struct { Alias string Host string Port int User string Password string Keys []string Passphrase string SSHAuths []ssh.AuthMethod }
Host target host.
Click to show internal directories.
Click to hide internal directories.