Documentation ¶
Index ¶
- type Client
- func (client *Client) Connect() error
- func (client *Client) Copy(srcPath, destPath string) error
- func (client *Client) CopyDir(srcPath, destination string) error
- func (client *Client) CopyFile(srcPath, destination string) error
- func (client *Client) Disconnect()
- func (client *Client) Download(srcPath, destination string) error
- func (client *Client) Execute(command string) (string, error)
- func (client *Client) InitIOPipes(session *ssh.Session) error
- func (client *Client) Shell() error
- func (client *Client) StartSession(bindIOStreams bool, createPty bool) (*ssh.Session, error)
- func (client *Client) TryConnection() error
- type Config
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { Config *Config // contains filtered or unexported fields }
*
Client holds an active connection to a SSH server
func (*Client) Disconnect ¶
func (client *Client) Disconnect()
func (*Client) Shell ¶
*
Shell creates a shell connection to the host and allows the user to run commands on the server @Todo Fix issue using arrow keys in a shell connection
type Config ¶
type Config struct { // connection properties Host string Port int // authentication properties User string Password string AuthFile string SSHAgent bool // session properties CreatePty bool BindIOStreams bool // active connection properties Config *ssh.ClientConfig }
Config holds the configuration properties for one server connection
func NewConfig ¶
func NewConfig(uri string, authFile string, sshAgent bool, createPty bool, bindIoStreams bool) *Config
New Config creates a new Config object based on the given URI and other data
func (*Config) AuthViaKey ¶
func (config *Config) AuthViaKey(file string) ssh.AuthMethod
*
AuthViaKey returns an authentication method using a private credential file
func (*Config) AuthViaPassword ¶
func (config *Config) AuthViaPassword(pass string) ssh.AuthMethod
*
AuthViaPassword returns an authentication method using a password as a credential
func (*Config) AuthViaSSHAgent ¶
func (config *Config) AuthViaSSHAgent() ssh.AuthMethod
*
AuthViaSSHAgent returns an authentication method using an SSH Agent with loaded keys
func (*Config) GetAuthConfig ¶
func (config *Config) GetAuthConfig() (*ssh.ClientConfig, error)
*
GetAuthConfig loads an authentication configuration based on the user and auth method provided
Click to show internal directories.
Click to hide internal directories.