验证
(host string, port int, userName, password string, idRsa string)
| 83 | |
| 84 | // 验证 |
| 85 | func (instance *SSHRemote) CheckDail(host string, port int, userName, password string, idRsa string) error { |
| 86 | |
| 87 | if (instance.Connection == &ssh.Client{}) || instance.Connection == nil { |
| 88 | |
| 89 | connection, err := connectionDial(host, port, userName, password, idRsa) |
| 90 | |
| 91 | if err != nil { |
| 92 | return err |
| 93 | } |
| 94 | |
| 95 | defer connection.Close() |
| 96 | } |
| 97 | |
| 98 | return nil |
| 99 | } |
| 100 | |
| 101 | // 判断端口是否可以(未被占用) |
| 102 | func (instance *SSHRemote) IsPortAvailable(port int) bool { |
no test coverage detected