实例
(host string, port int, userName, password string, idRsa string)
| 61 | |
| 62 | // 实例 |
| 63 | func NewSSHRemote(host string, port int, userName, password string, idRsa string) (instance SSHRemote, err error) { |
| 64 | |
| 65 | instance = SSHRemote{} |
| 66 | |
| 67 | if (instance.Connection == &ssh.Client{}) || instance.Connection == nil { |
| 68 | instance.SSHHost = host |
| 69 | instance.SSHPort = port |
| 70 | instance.SSHUserName = userName |
| 71 | instance.SSHPassword = password |
| 72 | |
| 73 | connection, err := connectionDial(host, port, userName, password, idRsa) |
| 74 | if err != nil { |
| 75 | return instance, err |
| 76 | } |
| 77 | |
| 78 | instance.Connection = connection |
| 79 | } |
| 80 | |
| 81 | return instance, nil |
| 82 | } |
| 83 | |
| 84 | // 验证 |
| 85 | func (instance *SSHRemote) CheckDail(host string, port int, userName, password string, idRsa string) error { |
nothing calls this directly
no test coverage detected