ssh

package
v0.0.0-...-a753888 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2024 License: AGPL-3.0 Imports: 9 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewReachableChecker

func NewReachableChecker(dialer Dialer, timeout time.Duration) *reachableChecker

NewReachableChecker creates a ReachableChecker that can be used to check for Hosts that are viable SSH targets. When FindHost is called, we will dial the entries in the given hostPorts, in parallel, using the given dialer, closing successfully established connections after checking the ssh key. Individual connection errors are discarded, and an error is returned only if none of the hostPorts can be reached when the given timeout expires. If publicKeys is a non empty list, then the SSH host public key will be checked. If it is not in the list, that host is not considered valid.

Usually, a net.Dialer initialized with a non-empty Timeout field is passed for dialer.

Types

type Dialer

type Dialer interface {
	Dial(network, address string) (net.Conn, error)
}

Dialer defines a Dial() method matching the signature of net.Dial().

type ReachableChecker

type ReachableChecker interface {
	// FindHost tries to connect to all of the host+port combinations supplied,
	// and tries to do an SSH key negotiation. The first successful negotiation
	// that includes one of the public keys supplied will be returned. If none
	// of them can be validated, then an error will be returned.
	FindHost(hostPorts network.HostPorts, publicKeys []string) (network.HostPort, error)
}

ReachableChecker tries to find ssh hosts that have a public key that matches our expectations.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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