feat(connection): 支持自定义 SQL 探活

- 新增连接级自定义探活 SQL 配置与多语言表单校验
- 限制单条 SELECT/WITH 并使用可取消的超时查询
- 隔离陈旧探活策略,避免配置错误驱逐健康连接

Fixes #611
This commit is contained in:
Syngnat
2026-07-19 12:29:21 +08:00
parent 82c62fd55c
commit 94ad5ae2f6
25 changed files with 1099 additions and 38 deletions

View File

@@ -3527,6 +3527,10 @@
"connection_modal.network.http_tunnel_disabled_hint": "HTTP Tunnel aktivieren, um Tunnel-Host, Port und Zugangsdaten zu konfigurieren.",
"connection_modal.network.http_tunnel_mutex_hint": "HTTP Tunnel kann nicht zusammen mit SSH Tunnel oder Proxy verwendet werden.",
"connection_modal.network.http_tunnel_panel_description": "Ein HTTP Tunnel-Gateway für diese Verbindung konfigurieren.",
"connection_modal.network.keepAliveSQL.help": "Leer lassen, um den Treiber-Ping zu verwenden. Es ist nur eine SELECT-/WITH-Anweisung zulässig; verwenden Sie eine einfache Abfrage, die nur wenige Daten zurückgibt, und ein Datenbankkonto mit Leseberechtigung. Dieser Wert wird im Klartext mit der Verbindung gespeichert; keine Zugangsdaten eingeben.",
"connection_modal.network.keepAliveSQL.label": "Benutzerdefiniertes Keepalive-SQL",
"connection_modal.network.keepAliveSQL.maxLength": "Benutzerdefiniertes Keepalive-SQL darf höchstens 4096 Zeichen lang sein.",
"connection_modal.network.keepAliveSQL.readOnly": "Benutzerdefiniertes Keepalive-SQL muss aus genau einer SELECT- oder WITH-Anweisung bestehen.",
"connection_modal.network.proxy": "Proxy",
"connection_modal.network.proxy_disabled_hint": "Proxy aktivieren, um diese Verbindung über SOCKS5 oder HTTP CONNECT zu leiten.",
"connection_modal.network.proxy_panel_description": "Proxy-Einstellungen für diese Verbindung konfigurieren.",

View File

@@ -3527,6 +3527,10 @@
"connection_modal.network.http_tunnel_disabled_hint": "Enable HTTP Tunnel to configure tunnel host, port, and credentials.",
"connection_modal.network.http_tunnel_mutex_hint": "HTTP Tunnel cannot be used together with SSH Tunnel or proxy.",
"connection_modal.network.http_tunnel_panel_description": "Configure an HTTP Tunnel gateway for this connection.",
"connection_modal.network.keepAliveSQL.help": "Leave blank to use the driver Ping. Only one SELECT/WITH statement is allowed; use a lightweight query that returns little data and a database account with read-only permissions. This value is stored in plain text with the connection; do not include credentials.",
"connection_modal.network.keepAliveSQL.label": "Custom keep-alive SQL",
"connection_modal.network.keepAliveSQL.maxLength": "Custom keep-alive SQL cannot exceed 4096 characters.",
"connection_modal.network.keepAliveSQL.readOnly": "Custom keep-alive SQL must be one SELECT or WITH statement.",
"connection_modal.network.proxy": "Proxy",
"connection_modal.network.proxy_disabled_hint": "Enable proxy to route this connection through SOCKS5 or HTTP CONNECT.",
"connection_modal.network.proxy_panel_description": "Configure per-connection proxy settings.",

View File

@@ -3527,6 +3527,10 @@
"connection_modal.network.http_tunnel_disabled_hint": "HTTP Tunnel を有効にすると Tunnel ホスト、ポート、認証情報を設定できます。",
"connection_modal.network.http_tunnel_mutex_hint": "HTTP Tunnel は SSH Tunnel またはプロキシと同時に使用できません。",
"connection_modal.network.http_tunnel_panel_description": "この接続の HTTP Tunnel ゲートウェイを設定します。",
"connection_modal.network.keepAliveSQL.help": "空欄の場合はドライバーの Ping を使用します。SELECT/WITH 文を 1 つだけ指定し、返すデータ量が少ない軽量なクエリと読み取り専用のデータベースアカウントを使用してください。この値は接続情報とともに平文で保存されるため、認証情報を入力しないでください。",
"connection_modal.network.keepAliveSQL.label": "カスタムキープアライブ SQL",
"connection_modal.network.keepAliveSQL.maxLength": "カスタムキープアライブ SQL は 4096 文字以内で指定してください。",
"connection_modal.network.keepAliveSQL.readOnly": "カスタムキープアライブ SQL は SELECT または WITH 文 1 つである必要があります。",
"connection_modal.network.proxy": "プロキシ",
"connection_modal.network.proxy_disabled_hint": "プロキシを有効にすると、この接続は SOCKS5 または HTTP CONNECT 経由で転送されます。",
"connection_modal.network.proxy_panel_description": "この接続専用のプロキシ設定を行います。",

View File

@@ -649,9 +649,16 @@ export const messages: Record<SupportedLanguage, Record<MessageKey, string>> = {
"仅在跳板机 token 或长连接会话需要定期续期时开启。",
"connection.modal.network.keepAliveInterval.label": "探活间隔 (分钟)",
"connection.modal.network.keepAliveInterval.help":
"后台会按这个间隔对已建立的缓存连接执行 Ping默认 240 分钟。",
"后台会按这个间隔对已建立的缓存连接执行 Ping 或自定义探活 SQL,默认 240 分钟。",
"connection.modal.network.keepAliveInterval.range":
"探活间隔范围: 1-1440 分钟",
"connection.modal.network.keepAliveSQL.label": "自定义探活 SQL",
"connection.modal.network.keepAliveSQL.help":
"留空时使用驱动 Ping仅允许一条 SELECT/WITH请使用只返回少量数据的轻量查询和数据库只读账号。配置会随连接明文保存请勿填写凭证。",
"connection.modal.network.keepAliveSQL.maxLength":
"自定义探活 SQL 不能超过 4096 个字符",
"connection.modal.network.keepAliveSQL.readOnly":
"自定义探活 SQL 仅允许一条 SELECT 或 WITH 语句",
"connection.modal.appearance.title": "外观",
"connection.modal.appearance.description": "自定义图标与颜色",
"connection.modal.appearance.icon": "图标",
@@ -1549,9 +1556,16 @@ export const messages: Record<SupportedLanguage, Record<MessageKey, string>> = {
"connection.modal.network.keepAliveInterval.label":
"Keep-alive interval (minutes)",
"connection.modal.network.keepAliveInterval.help":
"GoNavi pings established cached connections at this interval. Default is 240 minutes.",
"GoNavi runs Ping or the custom keep-alive SQL on established cached connections at this interval. Default is 240 minutes.",
"connection.modal.network.keepAliveInterval.range":
"Keep-alive interval must be between 1 and 1440 minutes.",
"connection.modal.network.keepAliveSQL.label": "Custom keep-alive SQL",
"connection.modal.network.keepAliveSQL.help":
"Leave blank to use the driver Ping. Only one SELECT/WITH statement is allowed; use a lightweight query that returns little data and a database account with read-only permissions. This value is stored in plain text with the connection; do not include credentials.",
"connection.modal.network.keepAliveSQL.maxLength":
"Custom keep-alive SQL cannot exceed 4096 characters.",
"connection.modal.network.keepAliveSQL.readOnly":
"Custom keep-alive SQL must be one SELECT or WITH statement.",
"connection.modal.appearance.title": "Appearance",
"connection.modal.appearance.description": "Custom icon and color",
"connection.modal.appearance.icon": "Icon",

View File

@@ -3527,6 +3527,10 @@
"connection_modal.network.http_tunnel_disabled_hint": "Включите HTTP Tunnel, чтобы настроить хост, порт и учетные данные Tunnel.",
"connection_modal.network.http_tunnel_mutex_hint": "HTTP Tunnel нельзя использовать вместе с SSH Tunnel или прокси.",
"connection_modal.network.http_tunnel_panel_description": "Настройте шлюз HTTP Tunnel для этого подключения.",
"connection_modal.network.keepAliveSQL.help": "Оставьте поле пустым, чтобы использовать Ping драйвера. Допускается только один запрос SELECT/WITH; используйте лёгкий запрос с небольшим результатом и учётную запись базы данных только для чтения. Значение сохраняется в открытом виде вместе с подключением; не указывайте учётные данные.",
"connection_modal.network.keepAliveSQL.label": "Пользовательский SQL для проверки соединения",
"connection_modal.network.keepAliveSQL.maxLength": "Пользовательский SQL для проверки соединения не должен превышать 4096 символов.",
"connection_modal.network.keepAliveSQL.readOnly": "Пользовательский SQL должен содержать только один запрос SELECT или WITH.",
"connection_modal.network.proxy": "Прокси",
"connection_modal.network.proxy_disabled_hint": "Включите прокси, чтобы направить это подключение через SOCKS5 или HTTP CONNECT.",
"connection_modal.network.proxy_panel_description": "Настройте параметры прокси для этого подключения.",

View File

@@ -3527,6 +3527,10 @@
"connection_modal.network.http_tunnel_disabled_hint": "启用 HTTP Tunnel 后可配置 Tunnel 主机、端口和凭据。",
"connection_modal.network.http_tunnel_mutex_hint": "HTTP Tunnel 不能与 SSH Tunnel 或代理同时使用。",
"connection_modal.network.http_tunnel_panel_description": "为此连接配置 HTTP Tunnel 网关。",
"connection_modal.network.keepAliveSQL.help": "留空时使用驱动 Ping仅允许一条 SELECT/WITH请使用只返回少量数据的轻量查询和数据库只读账号。配置会随连接明文保存请勿填写凭证。",
"connection_modal.network.keepAliveSQL.label": "自定义探活 SQL",
"connection_modal.network.keepAliveSQL.maxLength": "自定义探活 SQL 不能超过 4096 个字符",
"connection_modal.network.keepAliveSQL.readOnly": "自定义探活 SQL 仅允许一条 SELECT 或 WITH 语句",
"connection_modal.network.proxy": "代理",
"connection_modal.network.proxy_disabled_hint": "启用代理后,此连接会通过 SOCKS5 或 HTTP CONNECT 转发。",
"connection_modal.network.proxy_panel_description": "配置此连接的专用代理设置。",

View File

@@ -3527,6 +3527,10 @@
"connection_modal.network.http_tunnel_disabled_hint": "啟用 HTTP Tunnel 後可設定 Tunnel 主機、連接埠和憑據。",
"connection_modal.network.http_tunnel_mutex_hint": "HTTP Tunnel 不能與 SSH Tunnel 或代理同時使用。",
"connection_modal.network.http_tunnel_panel_description": "為此連線設定 HTTP Tunnel 閘道。",
"connection_modal.network.keepAliveSQL.help": "留空時使用驅動程式 Ping僅允許一條 SELECT/WITH請使用只回傳少量資料的輕量查詢和資料庫唯讀帳號。此設定會隨連線以純文字儲存請勿填入憑證。",
"connection_modal.network.keepAliveSQL.label": "自訂探活 SQL",
"connection_modal.network.keepAliveSQL.maxLength": "自訂探活 SQL 不得超過 4096 個字元。",
"connection_modal.network.keepAliveSQL.readOnly": "自訂探活 SQL 僅允許單一 SELECT 或 WITH 陳述式。",
"connection_modal.network.proxy": "代理",
"connection_modal.network.proxy_disabled_hint": "啟用代理後,此連線會透過 SOCKS5 或 HTTP CONNECT 轉發。",
"connection_modal.network.proxy_panel_description": "設定此連線的專用代理設定。",