From 7e08ee54a59df903099288840a14fda9a92e1c76 Mon Sep 17 00:00:00 2001 From: illusia <64828020+EchoSixHIYA@users.noreply.github.com> Date: Sat, 12 Sep 2026 08:09:52 +0800 Subject: [PATCH] fix: classify TeamSpeak connection failures --- src/admin/admin-router.ts | 10 +- src/errors.ts | 127 ++++++++++++++++++++--- src/server/teamspeak-probe.ts | 5 + src/server/ts-client.ts | 16 ++- src/server/voice-bridge.ts | 12 ++- web/src/composables/useVoiceWebSocket.ts | 5 +- web/src/views/AdminView.vue | 31 ++++-- 7 files changed, 177 insertions(+), 29 deletions(-) diff --git a/src/admin/admin-router.ts b/src/admin/admin-router.ts index f2b0cc1..0c52280 100644 --- a/src/admin/admin-router.ts +++ b/src/admin/admin-router.ts @@ -20,6 +20,7 @@ export interface AdminConnectionRecord { durationSeconds: number | null; status: "active" | "connecting" | "disconnected" | "failed"; reason: string | null; + failureDetail: string | null; } export interface AdminRouterOptions { @@ -473,6 +474,7 @@ export function readConnectionHistory(logFile: string | undefined, limit: number durationSeconds: number | null; status: AdminConnectionRecord["status"]; reason: string | null; + failureDetail: string | null; }>(); for (const log of readStructuredLogs(logFile)) { const entryId = typeof log.raw.entryId === "string" ? log.raw.entryId : ""; @@ -490,6 +492,7 @@ export function readConnectionHistory(logFile: string | undefined, limit: number durationSeconds: null, status: "connecting" as const, reason: null, + failureDetail: null, }; const nickname = typeof log.raw.nickname === "string" ? log.raw.nickname : ""; const clientIp = typeof log.raw.clientIp === "string" ? log.raw.clientIp : ""; @@ -501,9 +504,13 @@ export function readConnectionHistory(logFile: string | undefined, limit: number if (target) current.target = target; if (relayName) current.relayName = relayName; if (relayTarget) current.relayTarget = relayTarget; + if (typeof log.raw.failureDetail === "string" && log.raw.failureDetail) current.failureDetail = log.raw.failureDetail; if (log.message === "WebClient connecting") { current.startedAt ??= log.timestamp; current.status = "connecting"; + } else if (log.message === "TS connect failed") { + current.reason = typeof log.raw.code === "string" ? log.raw.code : current.reason; + current.status = "failed"; } else if (log.message === "Web client connected to TeamSpeak") { current.startedAt ??= log.timestamp; current.connectedAt = log.timestamp; @@ -523,7 +530,7 @@ export function readConnectionHistory(logFile: string | undefined, limit: number // rendered by the admin UI as the generic request-failed message. current.reason = typeof log.raw.failureCode === "string" && log.raw.failureCode ? log.raw.failureCode - : null; + : current.reason; } records.set(entryId, current); } @@ -552,6 +559,7 @@ export function readConnectionHistory(logFile: string | undefined, limit: number // an untraceable failed connection explicitly visible as the generic // request-failed message instead of implying a guessed cause. reason: record.reason ?? (record.status === "failed" ? "CONNECTION_FAILED" : null), + failureDetail: record.failureDetail, }; }) .sort((left, right) => Date.parse(right.disconnectedAt ?? right.startedAt) - Date.parse(left.disconnectedAt ?? left.startedAt)) diff --git a/src/errors.ts b/src/errors.ts index 6f6e988..74c1841 100644 --- a/src/errors.ts +++ b/src/errors.ts @@ -1,6 +1,9 @@ export type WebSpeakErrorCode = | "invalid_target" + | "host_not_found" | "unreachable" + | "connection_refused" + | "connection_reset" | "timeout" | "authentication_failed" | "protocol_negotiation_failed" @@ -9,7 +12,10 @@ export type WebSpeakErrorCode = export type ClientConnectionFailureCode = | "INVALID_TARGET" + | "HOST_NOT_FOUND" | "UNREACHABLE" + | "CONNECTION_REFUSED" + | "CONNECTION_RESET" | "TIMEOUT" | "SERVER_PASSWORD_REQUIRED" | "INVALID_SERVER_PASSWORD" @@ -17,43 +23,62 @@ export type ClientConnectionFailureCode = | "SERVER_REJECTED" | "CONNECTION_FAILED"; +export interface TeamSpeakErrorDiagnostics { + name?: string; + code?: string; + id?: string; + serverMessage?: string; + message?: string; + syscall?: string; + address?: string; + port?: number | string; + cause?: string; +} + export class WebSpeakError extends Error { readonly code: WebSpeakErrorCode; readonly retryable: boolean; readonly cause?: unknown; + readonly diagnostics: TeamSpeakErrorDiagnostics; - constructor(code: WebSpeakErrorCode, message: string, retryable: boolean, cause?: unknown) { + constructor(code: WebSpeakErrorCode, message: string, retryable: boolean, cause?: unknown, diagnostics: TeamSpeakErrorDiagnostics = {}) { super(message); this.name = "WebSpeakError"; this.code = code; this.retryable = retryable; this.cause = cause; + this.diagnostics = diagnostics; } } export function normalizeTeamSpeakError(error: unknown): WebSpeakError { if (error instanceof WebSpeakError) return error; - const candidate = error as { code?: unknown; id?: unknown; serverMessage?: unknown; message?: unknown } | null; - const code = typeof candidate?.code === "string" ? candidate.code : ""; - const id = typeof candidate?.id === "string" || typeof candidate?.id === "number" ? String(candidate.id) : ""; - const serverMessage = typeof candidate?.serverMessage === "string" ? candidate.serverMessage : ""; - const message = typeof candidate?.message === "string" ? candidate.message : String(error); - const text = `${code} ${id} ${serverMessage} ${message}`.toLocaleLowerCase(); + const diagnostics = collectDiagnostics(error); + const text = diagnosticText(error).toLocaleLowerCase(); if (/password|authenticate|authentication|not authorized|invalid.*(credential|password)/.test(text)) { - return new WebSpeakError("authentication_failed", "TeamSpeak authentication failed", false, error); + return new WebSpeakError("authentication_failed", "TeamSpeak authentication failed", false, error, diagnostics); } - if (/timeout|timed out|ack timeout|idle timeout/.test(text)) { - return new WebSpeakError("timeout", "TeamSpeak connection timed out", true, error); + if (/enotfound|eai_again|host not found|name or service not known|dns/.test(text)) { + return new WebSpeakError("host_not_found", "TeamSpeak server hostname could not be resolved", true, error, diagnostics); } - if (/econnrefused|enotfound|ehostunreach|enetunreach|network|socket|dns/.test(text)) { - return new WebSpeakError("unreachable", "TeamSpeak server is unreachable", true, error); + if (/econnrefused|connection refused/.test(text)) { + return new WebSpeakError("connection_refused", "TeamSpeak server refused the connection", true, error, diagnostics); + } + if (/econnreset|econnaborted|connection reset|connection aborted/.test(text)) { + return new WebSpeakError("connection_reset", "TeamSpeak connection was reset", true, error, diagnostics); + } + if (/timeout|timed out|ack timeout|idle timeout|etimedout/.test(text)) { + return new WebSpeakError("timeout", "TeamSpeak connection timed out", true, error, diagnostics); + } + if (/ehostunreach|enetunreach|network is unreachable|no route to host|network|socket/.test(text)) { + return new WebSpeakError("unreachable", "TeamSpeak server is unreachable", true, error, diagnostics); } if (/protocol|handshake|crypto|init1/.test(text)) { - return new WebSpeakError("protocol_negotiation_failed", "TeamSpeak protocol negotiation failed", true, error); + return new WebSpeakError("protocol_negotiation_failed", "TeamSpeak protocol negotiation failed", true, error, diagnostics); } - return new WebSpeakError("unknown", "TeamSpeak connection failed", false, error); + return new WebSpeakError("unknown", "TeamSpeak connection failed", false, error, diagnostics); } export function clientConnectionFailureCode(error: WebSpeakError, serverPassword = ""): ClientConnectionFailureCode { @@ -62,7 +87,10 @@ export function clientConnectionFailureCode(error: WebSpeakError, serverPassword } const mapping: Record = { invalid_target: "INVALID_TARGET", + host_not_found: "HOST_NOT_FOUND", unreachable: "UNREACHABLE", + connection_refused: "CONNECTION_REFUSED", + connection_reset: "CONNECTION_RESET", timeout: "TIMEOUT", authentication_failed: "SERVER_PASSWORD_REQUIRED", protocol_negotiation_failed: "PROTOCOL_NEGOTIATION_FAILED", @@ -71,3 +99,74 @@ export function clientConnectionFailureCode(error: WebSpeakError, serverPassword }; return mapping[error.code]; } + +/** Format useful SDK/Node details for a safe operational log field. */ +export function describeTeamSpeakError(error: WebSpeakError): string { + const details = error.diagnostics; + const parts = [ + details.name, + details.code, + details.id ? `id=${details.id}` : "", + details.serverMessage, + details.syscall, + details.address ? `address=${details.address}` : "", + details.port !== undefined ? `port=${details.port}` : "", + details.cause, + details.message, + ].filter(Boolean); + return parts.length ? parts.join("; ") : error.message; +} + +function diagnosticText(error: unknown): string { + const values: string[] = []; + let current: unknown = error; + const seen = new Set(); + for (let depth = 0; depth < 4 && current && !seen.has(current); depth += 1) { + seen.add(current); + if (current instanceof Error) values.push(current.name, current.message); + else values.push(String(current)); + if (typeof current === "object") { + const candidate = current as { code?: unknown; id?: unknown; serverMessage?: unknown; cause?: unknown }; + for (const value of [candidate.code, candidate.id, candidate.serverMessage]) if (value !== undefined) values.push(String(value)); + current = candidate.cause; + } else break; + } + return values.join(" "); +} + +function collectDiagnostics(error: unknown): TeamSpeakErrorDiagnostics { + const result: TeamSpeakErrorDiagnostics = {}; + let current: unknown = error; + const seen = new Set(); + for (let depth = 0; depth < 4 && current && !seen.has(current); depth += 1) { + seen.add(current); + if (current instanceof Error) { + result.name ??= current.name; + result.message ??= current.message; + const errorRecord = current as Error & Record; + if (typeof errorRecord.code === "string" || typeof errorRecord.code === "number") result.code ??= String(errorRecord.code); + if (typeof errorRecord.id === "string" || typeof errorRecord.id === "number") result.id ??= String(errorRecord.id); + if (typeof errorRecord.serverMessage === "string") result.serverMessage ??= errorRecord.serverMessage; + if (typeof errorRecord.syscall === "string") result.syscall ??= errorRecord.syscall; + if (typeof errorRecord.address === "string") result.address ??= errorRecord.address; + if (typeof errorRecord.port === "string" || typeof errorRecord.port === "number") result.port ??= errorRecord.port; + const cause = current.cause; + if (cause && cause !== current) { current = cause; continue; } + break; + } + if (typeof current !== "object") { result.cause ??= String(current); break; } + const candidate = current as Record; + if (typeof candidate.name === "string") result.name ??= candidate.name; + if (typeof candidate.code === "string" || typeof candidate.code === "number") result.code ??= String(candidate.code); + if (typeof candidate.id === "string" || typeof candidate.id === "number") result.id ??= String(candidate.id); + if (typeof candidate.serverMessage === "string") result.serverMessage ??= candidate.serverMessage; + if (typeof candidate.message === "string") result.message ??= candidate.message; + if (typeof candidate.syscall === "string") result.syscall ??= candidate.syscall; + if (typeof candidate.address === "string") result.address ??= candidate.address; + if (typeof candidate.port === "string" || typeof candidate.port === "number") result.port ??= candidate.port; + const cause = candidate.cause; + if (cause && cause !== current) { current = cause; continue; } + break; + } + return result; +} diff --git a/src/server/teamspeak-probe.ts b/src/server/teamspeak-probe.ts index b70f6b4..d2bc823 100644 --- a/src/server/teamspeak-probe.ts +++ b/src/server/teamspeak-probe.ts @@ -7,6 +7,8 @@ import type { TeamSpeakProtocol } from "./teamspeak-adapter.js"; export type ProbeErrorCode = | "HOST_NOT_FOUND" | "UNREACHABLE" + | "CONNECTION_REFUSED" + | "CONNECTION_RESET" | "TIMEOUT" | "PASSWORD_REQUIRED" | "INVALID_PASSWORD" @@ -103,6 +105,9 @@ export function toProbeError(error: unknown, password = ""): TeamSpeakProbeError const mapping: Record = { invalid_target: "INTERNAL_ERROR", unreachable: "UNREACHABLE", + host_not_found: "HOST_NOT_FOUND", + connection_refused: "CONNECTION_REFUSED", + connection_reset: "CONNECTION_RESET", timeout: "TIMEOUT", authentication_failed: password.trim() ? "INVALID_PASSWORD" : "PASSWORD_REQUIRED", protocol_negotiation_failed: "PROTOCOL_NEGOTIATION_FAILED", diff --git a/src/server/ts-client.ts b/src/server/ts-client.ts index 024a233..106c629 100644 --- a/src/server/ts-client.ts +++ b/src/server/ts-client.ts @@ -14,6 +14,7 @@ import { type TextMessage, } from "@echosixhiya/teamspeak-client"; import type { Logger } from "../logger.js"; +import { describeTeamSpeakError, normalizeTeamSpeakError } from "../errors.js"; import { TeamSpeakAdapter, type TeamSpeakProtocol } from "./teamspeak-adapter.js"; import type { TeamSpeakTarget } from "../domain/teamspeak-target.js"; import { createAccelerationRelayClient, type AccelerationRelayClient, type AccelerationRelayOptions } from "./acceleration-relay.js"; @@ -138,8 +139,9 @@ export class TSClient extends EventEmitter { this.emit("directorySnapshot", { channels, clients }); } catch (error: unknown) { this.logger.warn({ - err: error instanceof Error ? error.message : String(error), - }, "Could not reconcile the TeamSpeak directory snapshot"); + failureCode: "DIRECTORY_SNAPSHOT_UNAVAILABLE", + failureDetail: error instanceof Error ? error.message : String(error), + }, "TeamSpeak directory snapshot unavailable"); } const connectedChannelId = client.channelID(); @@ -193,7 +195,15 @@ export class TSClient extends EventEmitter { }); client.on("disconnected", (err) => { - this.logger.warn({ err: err?.message }, "Disconnected from TS"); + if (err) { + const normalized = normalizeTeamSpeakError(err); + this.logger.warn({ + failureCode: normalized.code.toUpperCase(), + failureDetail: describeTeamSpeakError(normalized), + }, "TeamSpeak transport disconnected unexpectedly"); + } else { + this.logger.info("TeamSpeak transport disconnected"); + } this.connected = false; this.clientId = 0; this.emit("disconnected", err); diff --git a/src/server/voice-bridge.ts b/src/server/voice-bridge.ts index 5726cf8..885835b 100644 --- a/src/server/voice-bridge.ts +++ b/src/server/voice-bridge.ts @@ -6,7 +6,7 @@ import { identityFromString } from "@echosixhiya/teamspeak-client"; import { DirectorySynchronizer } from "./directory-sync.js"; import { TSClient, type TSDirectorySnapshot, type TSVoiceData } from "./ts-client.js"; import type { Logger as LoggerType } from "../logger.js"; -import { clientConnectionFailureCode, normalizeTeamSpeakError } from "../errors.js"; +import { clientConnectionFailureCode, describeTeamSpeakError, normalizeTeamSpeakError } from "../errors.js"; import { formatTeamSpeakTarget, teamSpeakTargetKey, type TeamSpeakTarget } from "../domain/teamspeak-target.js"; import { JoinTicketStore, type JoinTicketPayload } from "./join-ticket.js"; import { IdentityLeaseStore } from "./identity-lease.js"; @@ -436,7 +436,15 @@ export class VoiceBridge { const normalized = normalizeTeamSpeakError(error); const failureCode = clientConnectionFailureCode(normalized, serverPassword); entry!.connectionFailureCode = failureCode; - this.logger.error({ code: failureCode, normalizedCode: normalized.code, entryId, reconnect: isReconnect, attempt: reconnectAttempt }, "TS connect failed"); + this.logger.warn({ + code: failureCode, + normalizedCode: normalized.code, + failureDetail: describeTeamSpeakError(normalized), + ...(Object.keys(normalized.diagnostics).length ? { failureDiagnostics: normalized.diagnostics } : {}), + entryId, + reconnect: isReconnect, + attempt: reconnectAttempt, + }, "TS connect failed"); if (!isReconnect) { try { if (session.state !== "disconnecting" && session.state !== "idle") session.transition("failed"); diff --git a/web/src/composables/useVoiceWebSocket.ts b/web/src/composables/useVoiceWebSocket.ts index b44662c..78f8e07 100644 --- a/web/src/composables/useVoiceWebSocket.ts +++ b/web/src/composables/useVoiceWebSocket.ts @@ -1178,7 +1178,7 @@ export function useVoiceWebSocket() { } function closeErrorCode(code: number, reason = ""): string { - const known = new Set(["INVALID_TARGET", "UNREACHABLE", "TIMEOUT", "SERVER_PASSWORD_REQUIRED", "INVALID_SERVER_PASSWORD", "PROTOCOL_NEGOTIATION_FAILED", "SERVER_REJECTED", "CONNECTION_FAILED"]); + const known = new Set(["INVALID_TARGET", "HOST_NOT_FOUND", "UNREACHABLE", "CONNECTION_REFUSED", "CONNECTION_RESET", "TIMEOUT", "SERVER_PASSWORD_REQUIRED", "INVALID_SERVER_PASSWORD", "PROTOCOL_NEGOTIATION_FAILED", "SERVER_REJECTED", "CONNECTION_FAILED"]); if (known.has(reason)) return reason; if (code === 4002) return "INVALID_TARGET"; if (code === 4004) return "SERVER_REJECTED"; @@ -1189,7 +1189,10 @@ export function useVoiceWebSocket() { function connectionFailureMessage(code: string): string { const messages: Record = { INVALID_TARGET: "TeamSpeak 服务器地址无效", + HOST_NOT_FOUND: "找不到 TeamSpeak 服务器主机名,请检查地址", UNREACHABLE: "无法到达 TeamSpeak 服务器,请检查网络或地址", + CONNECTION_REFUSED: "TeamSpeak 服务器拒绝了连接,请检查端口和服务状态", + CONNECTION_RESET: "TeamSpeak 连接被服务器或网络重置,请稍后重试", TIMEOUT: "连接 TeamSpeak 超时,请检查网络或服务器状态", SERVER_PASSWORD_REQUIRED: "该服务器需要密码,请输入密码后重试", INVALID_SERVER_PASSWORD: "服务器密码错误,请重新输入", diff --git a/web/src/views/AdminView.vue b/web/src/views/AdminView.vue index aa715a2..2698ff2 100644 --- a/web/src/views/AdminView.vue +++ b/web/src/views/AdminView.vue @@ -51,7 +51,7 @@

{{ tr('diagnostics') }}

{{ tr('diagnosticsLead') }}

{{ tr('downloadReport') }}
{{ tr('version') }}
{{ operations.diagnostics.version || '—' }}
{{ tr('runtime') }}
{{ operations.diagnostics.node || '—' }}
{{ tr('platform') }}
{{ operations.diagnostics.platform || '—' }} / {{ operations.diagnostics.arch || '—' }}
{{ tr('databaseSchema') }}
v{{ operations.diagnostics.schemaVersion || '—' }}
{{ tr('createdSessions') }}
{{ operations.diagnostics.createdSessions }}
-

{{ tr('logViewer') }}

{{ tr('logViewerLead') }}

{{ tr('logsUnavailable') }}
{{ tr('connectionHistory') }}{{ tr('connectionHistoryLead') }}
{{ record.nickname }}{{ record.target }}{{ connectionRoute(record) }}
{{ connectionStatusLabel(record.status) }}{{ record.connectedAt ? tr('connectedAt') : tr('connectionAttemptedAt') }}:{{ formatDate(record.connectedAt || record.startedAt) }}{{ tr('duration') }}:{{ formatAge(record.durationSeconds) }}{{ tr('disconnectedAt') }}:{{ formatDate(record.disconnectedAt) }}{{ tr('failureReason') }}:{{ connectionFailureText(record.reason) }}
{{ entry.level }}
{{ entry.message || '—' }}{{ formatDate(entry.timestamp) }}
{{ tr('noLogs') }}
+

{{ tr('logViewer') }}

{{ tr('logViewerLead') }}

{{ tr('logsUnavailable') }}
{{ tr('connectionHistory') }}{{ tr('connectionHistoryLead') }}
{{ record.nickname }}{{ record.target }}{{ connectionRoute(record) }}
{{ connectionStatusLabel(record.status) }}{{ record.connectedAt ? tr('connectedAt') : tr('connectionAttemptedAt') }}:{{ formatDate(record.connectedAt || record.startedAt) }}{{ tr('duration') }}:{{ formatAge(record.durationSeconds) }}{{ tr('disconnectedAt') }}:{{ formatDate(record.disconnectedAt) }}{{ tr('failureReason') }}:{{ connectionFailureText(record.reason) }}{{ tr('failureDetail') }}:{{ record.failureDetail }}
{{ entry.level }}
{{ entry.message || '—' }}{{ formatDate(entry.timestamp) }}
{{ tr('noLogs') }}

{{ tr('audit') }}

{{ tr('auditLead') }}

  • {{ eventName(event.event) }}{{ formatDate(event.createdAt) }}
  • {{ tr('auditEmpty') }}
@@ -107,7 +107,7 @@ const overview = reactive({ gateway: { version: "", uptimeSeconds: 0 }, teamSpea interface AdminSession { id: string; nickname: string; target: string; state: string; createdAt: string; ageSeconds: number; tsClientId: number | null; channelId: string | null; memberCount: number } interface ManagedInvite { id: string; target: string; channel: string; expiresAt: string; maxUses: number; useCount: number; createdAt: string; revokedAt: string | null; status: "active" | "expired" | "exhausted" | "revoked" } interface AdminLog { timestamp: string | null; level: string; message: string; context: Record } -interface AdminConnectionRecord { id: string; nickname: string; clientIp: string; target: string; relayName: string | null; relayTarget: string | null; startedAt: string; connectedAt: string | null; disconnectedAt: string | null; durationSeconds: number | null; status: "active" | "connecting" | "disconnected" | "failed"; reason: string | null } +interface AdminConnectionRecord { id: string; nickname: string; clientIp: string; target: string; relayName: string | null; relayTarget: string | null; startedAt: string; connectedAt: string | null; disconnectedAt: string | null; durationSeconds: number | null; status: "active" | "connecting" | "disconnected" | "failed"; reason: string | null; failureDetail: string | null } const operationsLoading = ref(false); const terminatingSession = ref(""); const inviteForm = reactive({ channel: "", expiresInHours: 24, maxUses: 0 }); @@ -170,8 +170,11 @@ const copy = { networkReachable: "网络可达(未验证密码)", networkReachableHint: "Ping 成功;管理员测试不会创建额外 TeamSpeak 成员,因此未验证服务器密码。", failureReason: "原因", + failureDetail: "诊断", hostNotFoundError: "找不到服务器", networkUnreachableError: "网络不可达", + connectionRefusedError: "服务器拒绝连接", + connectionResetError: "连接被服务器或网络重置", networkTimeoutError: "网络请求超时", serverPasswordRequiredError: "服务器需要密码", invalidServerPasswordError: "服务器密码错误", @@ -369,8 +372,11 @@ const copy = { networkReachable: "Network reachable (password not verified)", networkReachableHint: "Ping succeeded. The admin test does not create an extra TeamSpeak client, so the server password was not verified.", failureReason: "Reason", + failureDetail: "Diagnostics", hostNotFoundError: "Server not found", networkUnreachableError: "Network unreachable", + connectionRefusedError: "Connection refused", + connectionResetError: "Connection reset", networkTimeoutError: "Network request timed out", serverPasswordRequiredError: "Server password required", invalidServerPasswordError: "Invalid server password", @@ -565,8 +571,11 @@ const germanCopy = { networkReachable: "Netzwerk erreichbar (Passwort nicht geprüft)", networkReachableHint: "Ping erfolgreich. Der Admin-Test erstellt keinen zusätzlichen TeamSpeak-Client und prüft daher das Serverpasswort nicht.", failureReason: "Grund", + failureDetail: "Diagnose", hostNotFoundError: "Server nicht gefunden", networkUnreachableError: "Netzwerk nicht erreichbar", + connectionRefusedError: "Verbindung abgelehnt", + connectionResetError: "Verbindung zurückgesetzt", networkTimeoutError: "Netzwerk-Zeitüberschreitung", serverPasswordRequiredError: "Serverpasswort erforderlich", invalidServerPasswordError: "Falsches Serverpasswort", @@ -683,6 +692,8 @@ const testResultTitle = computed(() => { INVALID_TARGET: "serverAddress", HOST_NOT_FOUND: "hostNotFoundError", UNREACHABLE: "networkUnreachableError", + CONNECTION_REFUSED: "connectionRefusedError", + CONNECTION_RESET: "connectionResetError", TIMEOUT: "networkTimeoutError", PASSWORD_REQUIRED: "serverPasswordRequiredError", INVALID_PASSWORD: "invalidServerPasswordError", @@ -754,14 +765,18 @@ function connectionFailureText(code?: string) { const names: Record = { PASSWORD_REQUIRED: "serverPasswordRequiredError", SERVER_PASSWORD_REQUIRED: "serverPasswordRequiredError", - INVALID_PASSWORD: "invalidServerPasswordError", - INVALID_SERVER_PASSWORD: "invalidServerPasswordError", - HOST_NOT_FOUND: "hostNotFoundError", - UNREACHABLE: "networkUnreachableError", - TIMEOUT: "networkTimeoutError", + INVALID_PASSWORD: "invalidServerPasswordError", + INVALID_SERVER_PASSWORD: "invalidServerPasswordError", + INVALID_TARGET: "serverAddress", + HOST_NOT_FOUND: "hostNotFoundError", + UNREACHABLE: "networkUnreachableError", + CONNECTION_REFUSED: "connectionRefusedError", + CONNECTION_RESET: "connectionResetError", + TIMEOUT: "networkTimeoutError", PROTOCOL_NEGOTIATION_FAILED: "protocolFailureError", SERVER_REJECTED: "serverRejectedError", - PING_UNAVAILABLE: "pingUnavailableError", + PING_UNAVAILABLE: "pingUnavailableError", + CONNECTION_FAILED: "connectionFailed", }; return names[code || ""] ? tr(names[code || ""]) : errorText(code); }