MCPcopy Index your code
hub / github.com/smallstep/cli / withDefaultDialer

Function withDefaultDialer

internal/sshutil/shell.go:77–92  ·  view source on GitHub ↗

withDefaultDialer adds a direct connection dialer.

(user, address string)

Source from the content-addressed store, hash-verified

75
76// withDefaultDialer adds a direct connection dialer.
77func withDefaultDialer(user, address string) ShellOption {
78 return func(s *Shell) error {
79 s.dialer = func(callback ssh.HostKeyCallback) (*ssh.Client, error) {
80 client, err := ssh.Dial("tcp", address, &ssh.ClientConfig{
81 User: user,
82 Auth: s.authMethods,
83 HostKeyCallback: callback,
84 })
85 if err != nil {
86 return nil, errors.Wrapf(err, "error connecting %s", address)
87 }
88 return client, nil
89 }
90 return nil
91 }
92}
93
94func formatAddress(address string) string {
95 if _, _, err := net.SplitHostPort(address); err != nil {

Callers 1

NewShellFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…