juju: github.com/juju/juju/network/ssh Index | Files | Directories

package ssh

import "github.com/juju/juju/network/ssh"

Index

Package Files

reachable.go

func NewReachableChecker Uses

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.

type Dialer Uses

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

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

type ReachableChecker Uses

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

PathSynopsis
testing

Package ssh imports 9 packages (graph) and is imported by 5 packages. Updated 2019-10-18. Refresh now. Tools for package owners.