Documentation ¶
Index ¶
- type Address
- type Client
- func (c *Client) Close() error
- func (c *Client) Copy(srcFile, destFile string) ([]byte, error)
- func (c *Client) DirectConnect(addr Address) error
- func (c *Client) JumpConnect(jumpAddr, remoteAddr Address) error
- func (c *Client) Run(cmd string) ([]byte, error)
- func (c *Client) Sudo(cmd string) ([]byte, error)
- type ClientError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Address ¶
Address is used to specify the user and address of the target machine.
func NewAddress ¶
NewAddress is a constructor for an ssh address. If the addr does not contain a port (of the form "address:port"), it will add port 22 to the end of the addr.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClient ¶
NewClient is a the Client constructor. It connects to the running ssh-agent and sets up the user name. The user name can be overridden using the SSH_USER environment variable.
func (*Client) Copy ¶
Copy uses the scp protocol to copy the given srcfile from the local host to the destFile on the remote host. The scp protocol is explain here:
https://blogs.oracle.com/janp/entry/how_the_scp_protocol_works
The returned byte slice is the combined stout and stderr output from the command.
func (*Client) DirectConnect ¶
DirectConnect establishes an authenticated ssh connection to the given address. If the connection succeeds it will need to be closed.
func (*Client) JumpConnect ¶
JumpConnect established an authenticated ssh connection via a jump host (aka bastion), meaning that this will first connect to the jump host, then connect to the remote address. If the connection succeeds it will need to be closed.
type ClientError ¶
type ClientError struct {
// contains filtered or unexported fields
}
func (ClientError) Error ¶
func (e ClientError) Error() string