connection

package
v0.3.0-alpha Latest Latest
Warning

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

Go to latest
Published: May 28, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package connection implements various Connection plugins that can be run over Hosts

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientConfigFn

type ClientConfigFn func(*gornir.Host, gornir.Logger) (*ssh.ClientConfig, error)

ClientConfigFn is an interface that allows users to implement their own SSH auth mechanisms

type SSH

type SSH struct {
	Client *ssh.Client
}

SSH is a Connection plugins that connects to device via ss using the golang.org/x/crypto/ssh package. Current implementation only supports authentication with a password and has ssh.InsecureIgnoreHostKey set

func (*SSH) Close

func (s *SSH) Close(context.Context) error

Close closes the connection

func (SSH) String

func (s SSH) String() string

String implemente Stringer interface

type SSHClose

type SSHClose struct {
	Meta *gornir.TaskMetadata // Task metadata
}

SSHClose is a Connection plugin that closes an already opened ssh connection

func (*SSHClose) Metadata

func (t *SSHClose) Metadata() *gornir.TaskMetadata

Metadata returns the task metadata

func (*SSHClose) Run

Run implements gornir.Task interface

type SSHOpen

type SSHOpen struct {
	Meta           *gornir.TaskMetadata // Task metadata
	ClientConfigFn ClientConfigFn       // SSH client configuration
}

SSHOpen is a Connection plugin that opens a connection with a device

func (*SSHOpen) Metadata

func (t *SSHOpen) Metadata() *gornir.TaskMetadata

Metadata returns the task metadata

func (*SSHOpen) Run

func (t *SSHOpen) Run(ctx context.Context, logger gornir.Logger, host *gornir.Host) (gornir.TaskInstanceResult, error)

Run implements gornir.Task interface

Jump to

Keyboard shortcuts

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