Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func KnownHostsFile ¶
func KnownHostsFile(knownHostsFile string) ssh.HostKeyCallback
KnownHostsFile returns a host key callback function that checks the provided file for the host key
func NewSSHClientConfig ¶
func NewSSHClientConfig(user, password, keyfile, passphrase string) (*ssh.ClientConfig, error)
NewSSHClientConfig returns a new SSH client configuration
Types ¶
type Client ¶
type Client struct { Config *ssh.ClientConfig `json:"-"` // Internal use only Host string `json:"host" validate:"required,hostname|ipaddress"` User string `json:"user" validate:"required"` Password string `json:"password,omitempty"` Keyfile string `json:"keyfile,omitempty"` KeyPassphrase string `json:"keypassphrase,omitempty"` Port int `json:"port,omitempty" validate:"omitempty,min=1,max=65535"` // contains filtered or unexported fields }
Client is a struct to hold the SSH client details
func NewSSHClient ¶
func NewSSHClient(host, user, password, keyfile string, port int, keypassphrase string) (*Client, error)
NewSSHClient returns a new SSH client instance
func (*Client) DownloadFile ¶
DownloadFile downloads a file from the remote server
type Command ¶
type Command struct { Stdin io.Reader Stdout OutputWriter Stderr OutputWriter Path string Env []string }
Command is a struct to hold the SSH command details
type OutputWriter ¶
OutputWriter is an interface that wraps the Write method.
Click to show internal directories.
Click to hide internal directories.