mirror of
https://github.com/rancher/rke.git
synced 2025-05-07 07:47:41 +00:00
This defaults to using the SSH Agent or a passwordless key file. It also refactors the Dialer methods a bit to simplify and decouple the host object from the dialer.
20 lines
454 B
Go
20 lines
454 B
Go
package hosts
|
|
|
|
import (
|
|
"fmt"
|
|
"net"
|
|
)
|
|
|
|
func LocalHealthcheckFactory(h *Host) (func(network, address string) (net.Conn, error), error) {
|
|
dialer, err := newDialer(h, "health")
|
|
return dialer.DialHealthcheckLocally, err
|
|
}
|
|
|
|
func (d *dialer) DialHealthcheckLocally(network, addr string) (net.Conn, error) {
|
|
conn, err := net.Dial(network, addr)
|
|
if err != nil {
|
|
return nil, fmt.Errorf("Failed to dial address [%s]: %v", addr, err)
|
|
}
|
|
return conn, err
|
|
}
|