ssh

package
v1.4.0-rc.0 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Connection

type Connection interface {
	Exec(cmd string) (stdout string, stderr string, exitCode int, err error)
	POpen(cmd string, stdin io.Reader, stdout io.Writer, stderr io.Writer) (exitCode int, err error)
	io.Closer
}

Connection represents an established connection to an SSH server.

func NewConnection

func NewConnection(connector *Connector, o Opts) (Connection, error)

NewConnection attempts to create a new SSH connection to the host specified via the given options.

type Connector

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

Connector holds a map of Connections

func NewConnector

func NewConnector(ctx context.Context) *Connector

NewConnector constructor

func (*Connector) Connect

func (c *Connector) Connect(host kubeoneapi.HostConfig) (Connection, error)

Connect to the node

func (*Connector) Tunnel added in v1.0.0

func (c *Connector) Tunnel(host kubeoneapi.HostConfig) (Tunneler, error)

Tunnel returns established SSH tunnel

type Opts

type Opts struct {
	Context     context.Context
	Username    string
	Password    string
	Hostname    string
	Port        int
	PrivateKey  string
	KeyFile     string
	AgentSocket string
	Timeout     time.Duration
	Bastion     string
	BastionPort int
	BastionUser string
}

Opts represents all the possible options for connecting to a remote server via SSH.

type Tunneler added in v1.0.0

type Tunneler interface {
	// `network` can be tcp, tcp4, tcp6, unix
	TunnelTo(ctx context.Context, network, addr string) (net.Conn, error)
	io.Closer
}

Tunneler interface creates net.Conn originating from the remote ssh host to target `addr`

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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