func (s *ServerController) SSHConnect(payload *colonycore.Server) (sshclient.SshSetting, *ssh.Client, error) { client := sshclient.SshSetting{} client.SSHHost = "192.168.56.103:22" client.SSHAuthType = 0 client.SSHUser = "******" client.SSHPassword = "******" //fmt.Println(client) {192.168.56.103:22 eaciit1 12345 0} theClient, err := client.Connect() return client, theClient, err }
func (s *ServerController) SSHConnect(payload *colonycore.Server) (sshclient.SshSetting, *ssh.Client, error) { client := sshclient.SshSetting{} client.SSHHost = payload.Host if payload.SSHType == "File" { client.SSHAuthType = sshclient.SSHAuthType_Certificate client.SSHKeyLocation = payload.SSHFile } else { client.SSHAuthType = sshclient.SSHAuthType_Password client.SSHUser = payload.SSHUser client.SSHPassword = payload.SSHPass } theClient, err := client.Connect() return client, theClient, err }
func (s *Server) Connect() (sshclient.SshSetting, *ssh.Client, error) { client := sshclient.SshSetting{} client.SSHHost = s.Host if s.SSHType == "File" { client.SSHAuthType = sshclient.SSHAuthType_Certificate client.SSHKeyLocation = s.SSHFile } else { client.SSHAuthType = sshclient.SSHAuthType_Password client.SSHUser = s.SSHUser client.SSHPassword = s.SSHPass } theClient, err := client.Connect() return client, theClient, err }