Documentation ¶
Index ¶
- type ErrConnect
- type SSHClient
- func (c *SSHClient) Close() error
- func (c *SSHClient) Connect(host entity.NetworkHost) error
- func (c *SSHClient) ConnectWith(host entity.NetworkHost, dialer SSHDialFunc) error
- func (c *SSHClient) DialThrough(net, addr string, config *ssh.ClientConfig) (*ssh.Client, error)
- func (c *SSHClient) Download(remotePath, localPath string, silent bool) error
- func (c *SSHClient) GenerateOnRemote(data []byte) error
- func (c *SSHClient) GetHost() string
- func (c SSHClient) GetTube() string
- func (c *SSHClient) Prefix() (string, int)
- func (c *SSHClient) Run(task *entity.Task) error
- func (c *SSHClient) SetRcloneCfg(config string)
- func (c *SSHClient) SetTube(name string)
- func (c *SSHClient) Signal(sig os.Signal) error
- func (c *SSHClient) Stderr() io.Reader
- func (c *SSHClient) Stdin() io.WriteCloser
- func (c *SSHClient) Stdout() io.Reader
- func (c *SSHClient) Upload(localPath, remotePath string, config string) error
- func (c *SSHClient) Wait() error
- func (c *SSHClient) Write(p []byte) (n int, err error)
- func (c *SSHClient) WriteClose() error
- type SSHDialFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ErrConnect ¶
ErrConnect describes connection error
func (ErrConnect) Error ¶
func (e ErrConnect) Error() string
type SSHClient ¶
type SSHClient struct { User string Host string Password string Env *entity.EnvList Color string RcloneCfg string // contains filtered or unexported fields }
SSHClient is a wrapper over the SSH connection/sessions.
func (*SSHClient) Connect ¶
func (c *SSHClient) Connect(host entity.NetworkHost) error
Connect creates SSH connection to a specified host. It expects the host of the form "[ssh://]host[:port]".
func (*SSHClient) ConnectWith ¶
func (c *SSHClient) ConnectWith(host entity.NetworkHost, dialer SSHDialFunc) error
ConnectWith creates a SSH connection to a specified host. It will use dialer to establish the connection. TODO: Split Signers to its own method.
func (*SSHClient) DialThrough ¶
DialThrough will create a new connection from the ssh server sc is connected to. DialThrough is an SSHDialer.
func (*SSHClient) GenerateOnRemote ¶
GenerateOnRemote basically cats file content to "~/" + entity.TASK_TAIL on remote
func (*SSHClient) SetRcloneCfg ¶
func (*SSHClient) Wait ¶
Wait waits until the remote command finishes and exits. It closes the SSH session.
func (*SSHClient) WriteClose ¶
WriteClose well, writeCloser for client
type SSHDialFunc ¶
SSHDialFunc can dial an ssh server and return a client