修改ssh登录

pull/79/head^2
zhangchenhao 2025-05-15 11:03:07 +08:00
parent 282224df28
commit cb9ad88426
2 changed files with 26 additions and 15 deletions

View File

@ -48,7 +48,18 @@ func buildAuthMethods(password, privateKey string) ([]ssh.AuthMethod, error) {
} }
func writeMultipleFilesViaSSH(config SSHConfig, files []RemoteFile, preCmd, postCmd string) error { func writeMultipleFilesViaSSH(config SSHConfig, files []RemoteFile, preCmd, postCmd string) error {
addr := fmt.Sprintf("%s:%s", config.Host, config.Port) var port string
switch v := config.Port.(type) {
case float64:
port = strconv.Itoa(int(v))
case string:
port = v
case int:
port = strconv.Itoa(v)
default:
port = "22"
}
addr := fmt.Sprintf("%s:%s", config.Host, port)
authMethods, err := buildAuthMethods(config.Password, config.PrivateKey) authMethods, err := buildAuthMethods(config.Password, config.PrivateKey)
if err != nil { if err != nil {