Documentation ¶
Index ¶
- func Close(a *Client)
- func ConvertYamlToJSON(i interface{}) interface{}
- func PasswordKey(username string, password string, keyCallBack ssh.HostKeyCallback) (ssh.ClientConfig, error)
- func PrivateKey(username string, path string, keyCallBack ssh.HostKeyCallback) (ssh.ClientConfig, error)
- func PrivateKeyWithPassphrase(username string, passpharase []byte, path string, ...) (ssh.ClientConfig, error)
- type Client
- type ClientConfigurer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertYamlToJSON ¶
func ConvertYamlToJSON(i interface{}) interface{}
ConvertYamlToJSON will return a json interface
func PasswordKey ¶
func PasswordKey(username string, password string, keyCallBack ssh.HostKeyCallback) (ssh.ClientConfig, error)
PasswordKey uses username and password to authenticate with the server
func PrivateKey ¶
func PrivateKey(username string, path string, keyCallBack ssh.HostKeyCallback) (ssh.ClientConfig, error)
PrivateKey Loads a private and public key from "path" and returns a SSH ClientConfig to authenticate with the server
func PrivateKeyWithPassphrase ¶
func PrivateKeyWithPassphrase(username string, passpharase []byte, path string, keyCallBack ssh.HostKeyCallback) (ssh.ClientConfig, error)
PrivateKeyWithPassphrase Loads a private and public key from "path" having passphrase and returns a SSH ClientConfig to authenticate with the server
Types ¶
type Client ¶
type Client struct { // the host to connect to Host string // the client config to use ClientConfig *ssh.ClientConfig // stores the SSH session while the connection is running Session *ssh.Session // stores the SSH connection itself in order to close it after transfer Conn ssh.Conn // the clients waits for the given timeout until given up the connection Timeout time.Duration // *ssh.client for sftp Sshclient *ssh.Client }
Client is our ssh client struct
type ClientConfigurer ¶
type ClientConfigurer struct {
// contains filtered or unexported fields
}
ClientConfigurer struct containing all the configuration options
func NewConfigurer ¶
func NewConfigurer(host string, config *ssh.ClientConfig) *ClientConfigurer
NewConfigurer Creates a new client configurer. It takes the required parameters: the host and the ssh.ClientConfig and returns a configurer populated with the default values for the optional parameters.
These optional parameters can be set by using the methods provided on the ClientConfigurer struct.
func (*ClientConfigurer) ClientConfig ¶
func (c *ClientConfigurer) ClientConfig(config *ssh.ClientConfig) *ClientConfigurer
ClientConfig Alters the ssh.ClientConfig
func (*ClientConfigurer) Create ¶
func (c *ClientConfigurer) Create() Client
Create Builds a client with the configuration stored within the ClientConfigurer
func (*ClientConfigurer) Host ¶
func (c *ClientConfigurer) Host(host string) *ClientConfigurer
Host Alters the host of the client connects to
func (*ClientConfigurer) Timeout ¶
func (c *ClientConfigurer) Timeout(timeout time.Duration) *ClientConfigurer
Timeout Changes the connection timeout. Defaults to one minute