ssh

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2017 License: Apache-2.0 Imports: 5 Imported by: 4 modules, 3 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package ssh provides the API for connecting to a SSH node. Once connected, reader and writer interface can be retrieved for the given connection using the GetVTY method. The reader and writer can be later used to receive/send data from/to the connected host. The package currently supports only the password authentication. Example of the usage:

conn, err := ssh.Connect("10.10.10.10", 22, "cisco", "cisco")
// handle error!
defer conn.Close()

r, w, err := conn.GetVTY()

This package can be used as a transport for the vty package, that provides the API to execute remote commands on a VTY connection.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Connection

type Connection struct {
	// contains filtered or unexported fields
}

Connection represents a SSH connection.

func Connect

func Connect(host string, port uint32, userName string, password string) (*Connection, error)

Connect connects top a host via SSH using password authentication.

func (*Connection) Close

func (c *Connection) Close()

Close closes the SSH connection.

func (*Connection) GetVTY

func (c *Connection) GetVTY() (io.Reader, io.Writer, error)

GetVTY returns the interface to VTY for reading and writing.

Jump to

Keyboard shortcuts

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