diff --git a/plugins/services/credential_tester.go b/plugins/services/credential_tester.go index 9a1f210..b557420 100644 --- a/plugins/services/credential_tester.go +++ b/plugins/services/credential_tester.go @@ -255,10 +255,10 @@ func testCredentialWithRetry( // 根据错误类型决定是否重试 switch result.ErrorType { case ErrorTypeAuth: - // 认证错误,不重试 + // 认证错误(密码错误),不重试 return nil - case ErrorTypeNetwork: - // 网络错误,可以重试 + case ErrorTypeNetwork, ErrorTypeUnknown: + // 网络错误或未知错误,可以重试(可能是服务端限流等临时问题) if attempt < testConfig.MaxRetries-1 { select { case <-ctx.Done(): @@ -267,9 +267,6 @@ func testCredentialWithRetry( // 继续重试 } } - default: - // 未知错误,不重试 - return nil } } return nil diff --git a/plugins/services/ssh.go b/plugins/services/ssh.go index d6a54c9..2a843b3 100644 --- a/plugins/services/ssh.go +++ b/plugins/services/ssh.go @@ -160,12 +160,22 @@ func classifySSHErrorType(err error) ErrorType { return ErrorTypeUnknown } + // SSH 特有的认证错误(密码错误) sshAuthErrors := append(CommonAuthErrors, "unable to authenticate", "no supported methods remain", ) - return ClassifyError(err, sshAuthErrors, CommonNetworkErrors) + // SSH 特有的网络/临时错误(需要重试) + sshNetworkErrors := append(CommonNetworkErrors, + "handshake failed", // 握手失败,可能是服务端限流 + "ssh: disconnect", // SSH 主动断开 + "connection closed", // 连接被关闭 + "max startups", // SSH MaxStartups 限制 + "too many authentication", // 认证次数过多 + ) + + return ClassifyError(err, sshAuthErrors, sshNetworkErrors) } // scanWithKey 使用SSH私钥扫描