(username string, passcode string, appSSHEndpoint string, appSSHHostKeyFingerprint string, skipHostValidation bool)
| 85 | } |
| 86 | |
| 87 | func (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 | |
| 108 | func (c *SecureShell) InteractiveSession(commands []string, terminalRequest TTYRequest) error { |
| 109 | session, err := c.secureClient.NewSession() |
nothing calls this directly
no test coverage detected