Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewReachableChecker ¶
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 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.