connector

package
v0.0.0-...-ca30cd6 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthMethod

type AuthMethod func(*ssh.ClientConfig)

AuthMethod is the method to use to authenticate agaist the device

func AuthByKey

func AuthByKey(username string, key io.Reader) (AuthMethod, error)

AuthByKey uses public key authentication

func AuthByPassword

func AuthByPassword(username, password string) AuthMethod

AuthByPassword uses password authentication

type Device

type Device struct {
	Host         string
	Port         string
	Auth         AuthMethod
	ClientConfig ssh.ClientConfig
	DeviceConfig *config.DeviceConfig
}

func (*Device) String

func (d *Device) String() string

type SSHConnection

type SSHConnection struct {
	Host string
	// contains filtered or unexported fields
}

SSHConnection encapsulates the connection to the device

func NewSSSHConnection

func NewSSSHConnection(device *Device, cfg *config.Config) (*SSHConnection, error)

NewSSSHConnection connects to device

func (*SSHConnection) BlindSend

func (c *SSHConnection) BlindSend(cmds []string)

BlindSend sends commands to a device and doesn't wait for output

func (*SSHConnection) Close

func (c *SSHConnection) Close()

Close closes connection

func (*SSHConnection) Connect

func (c *SSHConnection) Connect() error

Connect connects to the device

func (*SSHConnection) RunCommand

func (c *SSHConnection) RunCommand(cmds []string) (string, error)

RunCommand runs a command or commands against the device

Jump to

Keyboard shortcuts

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