ssh

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 6, 2016 License: BSD-3-Clause Imports: 14 Imported by: 0

Documentation

Index

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 New

func New(config *Config) (client *Client)

*

New creates a new client connection to the server specified by the configuration

func (*Client) Connect

func (client *Client) Connect() error

*

Connect the client to the configured server

func (*Client) Copy

func (client *Client) Copy(srcPath, destPath string) error

*

Copy a file or a directory from the source to the remote destination

func (*Client) CopyDir

func (client *Client) CopyDir(srcPath, destination string) error

*

Copy a directory from the source to the destination

func (*Client) CopyFile

func (client *Client) CopyFile(srcPath, destination string) error

*

Copy a file from the source to the destination

func (*Client) Disconnect

func (client *Client) Disconnect()

func (*Client) Download

func (client *Client) Download(srcPath, destination string) error

*

Download a file or directory from the server

func (*Client) Execute

func (client *Client) Execute(command string) (string, error)

*

Execute a command on the server

func (*Client) InitIOPipes

func (client *Client) InitIOPipes(session *ssh.Session) error

*

InitIOPipes binds session IO streams to the output
@Deprecated

func (*Client) Shell

func (client *Client) Shell() error

*

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

func (*Client) StartSession

func (client *Client) StartSession(bindIOStreams bool, createPty bool) (*ssh.Session, error)

*

Connect to the server base on a client auth config

func (*Client) TryConnection

func (client *Client) TryConnection() error

*

Try the connection to the server

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL