Documentation
¶
Index ¶
- func GatherInventory(remote *ssh.Client) (*entity.Inventory, error)
- type ErrConnect
- type ErrInv
- type RemoteClient
- func (c *RemoteClient) Close() error
- func (c *RemoteClient) Connect(host entity.NetworkHost) error
- func (c *RemoteClient) ConnectWith(host entity.NetworkHost, dialer SSHDialFunc) error
- func (c *RemoteClient) DialThrough(net, addr string, config *ssh.ClientConfig) (*ssh.Client, error)
- func (c *RemoteClient) Download(remotePath, localPath string, silent bool) error
- func (c *RemoteClient) FetchEnvsWithTar() error
- func (c *RemoteClient) GenerateOnRemote(data []byte, remotePath string) error
- func (c RemoteClient) GetConnection() *ssh.Client
- func (c *RemoteClient) GetHost() string
- func (c *RemoteClient) GetInventory() *entity.Inventory
- func (c *RemoteClient) GetPassword() string
- func (c RemoteClient) GetSSHConfig() *ssh.ClientConfig
- func (c *RemoteClient) GetShell() string
- func (c RemoteClient) GetTube() string
- func (c *RemoteClient) Prefix() (string, int)
- func (c *RemoteClient) Run(task *entity.Task) error
- func (c *RemoteClient) SetConnection(client *ssh.Client)
- func (c *RemoteClient) SetPassword(pwd string)
- func (c *RemoteClient) SetTube(name string)
- func (c *RemoteClient) Signal(sig os.Signal) error
- func (c *RemoteClient) Stderr() io.Reader
- func (c *RemoteClient) Stdin() io.WriteCloser
- func (c *RemoteClient) Stdout() io.Reader
- func (c *RemoteClient) Upload(localPath, remotePath string) error
- func (c *RemoteClient) Wait() error
- func (c *RemoteClient) Write(p []byte) (n int, err error)
- func (c *RemoteClient) WriteClose() error
- type SSHDialFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ErrConnect ¶
ErrConnect describes a connection error.
func (ErrConnect) Error ¶
func (e ErrConnect) Error() string
Error returns a formatted string representation of the connection error.
type RemoteClient ¶
type RemoteClient struct {
ConnectOrder entity.ConnectOrder
User string
Host string
Password string
Env *entity.EnvList
Color string
Inventory *entity.Inventory
// contains filtered or unexported fields
}
RemoteClient is a wrapper over the SSH connection/sessions.
func (*RemoteClient) Close ¶
func (c *RemoteClient) Close() error
Close closes the underlying SSH connection and session.
func (*RemoteClient) Connect ¶
func (c *RemoteClient) Connect(host entity.NetworkHost) error
Connect creates SSH connection to a specified host. It expects the host of the form "[ssh://]host[:port]".
func (*RemoteClient) ConnectWith ¶
func (c *RemoteClient) 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 (*RemoteClient) DialThrough ¶
func (c *RemoteClient) DialThrough(net, addr string, config *ssh.ClientConfig) (*ssh.Client, error)
DialThrough will create a new connection from the ssh server sc is connected to. DialThrough is an SSHDialer.
func (*RemoteClient) Download ¶
func (c *RemoteClient) Download(remotePath, localPath string, silent bool) error
Download file from remote
func (*RemoteClient) FetchEnvsWithTar ¶
func (c *RemoteClient) FetchEnvsWithTar() error
func (*RemoteClient) GenerateOnRemote ¶
func (c *RemoteClient) GenerateOnRemote(data []byte, remotePath string) error
GenerateOnRemote basically cats file content to "~/" + entity.TASK_TAIL on remote
func (RemoteClient) GetConnection ¶
func (c RemoteClient) GetConnection() *ssh.Client
GetConnection returns the client configuration of the SSHClient.
func (*RemoteClient) GetHost ¶
func (c *RemoteClient) GetHost() string
GetHost returns the host of the SSHClient.
func (*RemoteClient) GetInventory ¶
func (c *RemoteClient) GetInventory() *entity.Inventory
func (*RemoteClient) GetPassword ¶
func (c *RemoteClient) GetPassword() string
GetPassword returns the password of the SSHClient.
func (RemoteClient) GetSSHConfig ¶
func (c RemoteClient) GetSSHConfig() *ssh.ClientConfig
GetConnection returns the client configuration of the SSHClient.
func (*RemoteClient) GetShell ¶
func (c *RemoteClient) GetShell() string
func (RemoteClient) GetTube ¶
func (c RemoteClient) GetTube() string
GetTube returns the tube of the SSHClient.
func (*RemoteClient) Prefix ¶
func (c *RemoteClient) Prefix() (string, int)
Prefix sets prefix for printing
func (*RemoteClient) Run ¶
func (c *RemoteClient) Run(task *entity.Task) error
Run runs the task.Run command remotely on c.host.
func (*RemoteClient) SetConnection ¶
func (c *RemoteClient) SetConnection(client *ssh.Client)
SetConnection sets the SSH client connection of the SSHClient.
func (*RemoteClient) SetPassword ¶
func (c *RemoteClient) SetPassword(pwd string)
SetPassword sets the password of the SSHClient.
func (*RemoteClient) SetTube ¶
func (c *RemoteClient) SetTube(name string)
SetTube sets the tube of the SSHClient.
func (*RemoteClient) Signal ¶
func (c *RemoteClient) Signal(sig os.Signal) error
Signal process command signals
func (*RemoteClient) Upload ¶
func (c *RemoteClient) Upload(localPath, remotePath string) error
Upload local file to remote server
func (*RemoteClient) Wait ¶
func (c *RemoteClient) Wait() error
Wait waits until the remote command finishes and exits. It closes the SSH session.
func (*RemoteClient) WriteClose ¶
func (c *RemoteClient) WriteClose() error
WriteClose well, writeCloser for client
type SSHDialFunc ¶
SSHDialFunc can dial an ssh server and return a client