Documentation
¶
Overview ¶
Package ssh is a simple wrapper around an ssh.Client which implements utilities to be performed with a remote server.
Index ¶
- type Client
- func (sshc *Client) Close() error
- func (sshc *Client) DialContextF() func(context.Context, string, string) (net.Conn, error)
- func (sshc *Client) Download(src string, dst io.Writer, sudo bool) error
- func (sshc *Client) RunCommand(cmd string) ([]byte, error)
- func (sshc *Client) StartCommand(cmd string) error
- func (sshc *Client) Upload(src io.Reader, dst string, sudo bool) ([]byte, error)
- func (sshc *Client) UploadFile(src, dst string, sudo bool) ([]byte, error)
- type ExtAgent
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
IP string
// contains filtered or unexported fields
}
Client is a wrapper type over a ssh connection that takes care of creating a channel and running commands in a single method.
func (*Client) DialContextF ¶ added in v1.17.0
DialContextF returns the underlying client's DialContext function
func (*Client) RunCommand ¶
RunCommand runs a given command in a new ssh session.
func (*Client) StartCommand ¶
StartCommand starts a given command in a new ssh session. Unlike RunCommand this command does not wait command to finish. This is needed for running commands in the background.
type ExtAgent ¶
type ExtAgent struct {
// contains filtered or unexported fields
}
ExtAgent is a wrapper type over agent.ExtendedAgent provding a method to return a Client.
func NewAgent ¶
NewAgent connects to the local ssh agent and validates that it has at least one key added. It returns the agent if everything looks good.
func (*ExtAgent) NewClientWithPort ¶ added in v1.17.0
NewClientWithPort returns a Client object by dialing the ssh agent on the provided port
func (*ExtAgent) NewClientWithRetry ¶ added in v1.33.0
NewClientWithRetry attempts to create an SSH client connection with exponential backoff, retrying until the given timeout is reached. The backoff starts at 2s and doubles each attempt, capped at 30s.