MCPcopy Index your code
hub / github.com/cloudfoundry/cli / Connect

Method Connect

util/clissh/ssh.go:87–106  ·  view source on GitHub ↗
(username string, passcode string, appSSHEndpoint string, appSSHHostKeyFingerprint string, skipHostValidation bool)

Source from the content-addressed store, hash-verified

85}
86
87func (c *SecureShell) Connect(username string, passcode string, appSSHEndpoint string, appSSHHostKeyFingerprint string, skipHostValidation bool) error {
88 hostKeyCallbackFunction := fingerprintCallback(skipHostValidation, appSSHHostKeyFingerprint)
89
90 clientConfig := &ssh.ClientConfig{
91 User: username,
92 Auth: []ssh.AuthMethod{ssh.Password(passcode)},
93 HostKeyCallback: hostKeyCallbackFunction,
94 }
95
96 secureClient, err := c.secureDialer.Dial("tcp", appSSHEndpoint, clientConfig)
97 if err != nil {
98 if strings.Contains(err.Error(), "ssh: unable to authenticate") {
99 return ssherror.UnableToAuthenticateError{Err: err}
100 }
101 return err
102 }
103
104 c.secureClient = secureClient
105 return nil
106}
107
108func (c *SecureShell) InteractiveSession(commands []string, terminalRequest TTYRequest) error {
109 session, err := c.secureClient.NewSession()

Callers

nothing calls this directly

Implementers 4

secureShellcf/ssh/ssh.go
FakeSecureShellcf/ssh/sshfakes/fake_secure_shell.go
FakeSecureShellClientactor/sharedaction/sharedactionfakes/f
SecureShellutil/clissh/ssh.go

Calls 3

fingerprintCallbackFunction · 0.70
DialMethod · 0.65
ErrorMethod · 0.65

Tested by

no test coverage detected