Preserve ordered SSH and proxy connection layers (#802)

* Preserve ordered SSH and proxy connection layers

Replace separate SSH/proxy connection fields with ordered transport_layers while keeping legacy migration and secret fallback paths intact. The UI now edits SSH tunnel/proxy layers in configured order without a global SSH enable gate.

Constraint: Existing saved SSH tunnels, proxy settings, and secret-store keys must continue to load through migration.
Rejected: Folding proxy fields into SshTunnelConfig | mixes proxy semantics into an SSH-specific structure.
Confidence: high
Scope-risk: moderate
Directive: Keep SSH/proxy structs provider-specific; put cross-layer chaining in transport_layer_tunnel orchestration.
Tested: git diff --check; cargo fmt --check; cargo check --workspace; cargo test -p dbx-core --lib; vue-tsc --noEmit --project apps/desktop/tsconfig.json; tsc -p packages/node-core/tsconfig.json --noEmit; oxlint --vue-plugin apps/desktop/src; tsx --tsconfig apps/desktop/tsconfig.json --test packages/app-tests/*.test.ts; tsx --test packages/node-core/tests/*.test.ts
Not-tested: Live external SSH/proxy/database endpoint integration.

* Keep ordered transport changes CI-format clean

Constraint: CI pnpm check failed only on oxfmt formatting for two desktop TypeScript files
Confidence: high
Scope-risk: narrow
Directive: Keep generated/editor config changes out of this PR fix commit
Tested: PATH="/Volumes/data/code/rust/dbx/node_modules/.bin:/Users/hekx/.codex/tmp/arg0/codex-arg0nuL34n:/Users/hekx/.cargo/bin:/Users/hekx/.local/bin:/opt/homebrew/opt/llvm/bin:/opt/homebrew/opt/libpq/bin:/Volumes/data/Users/hekx/.opencode/bin:/Users/hekx/.bun/bin:/Volumes/data/sdks/flutter/bin:/Volumes/data/Users/hekx/.cargo/bin:/Users/hekx/.local/bin:/opt/homebrew/opt/llvm/bin:/opt/homebrew/opt/libpq/bin:/Volumes/data/Users/hekx/.opencode/bin:/Users/hekx/.bun/bin:/Volumes/data/Users/hekx/Library/pnpm:/Volumes/data/sdks/flutter/bin:/Volumes/data/Users/hekx/.cargo/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/pkg/env/global/bin:/opt/X11/bin:/Library/Apple/usr/bin:/Applications/Wireshark.app/Contents/MacOS:/usr/local/go/bin:/opt/homebrew/bin:/opt/podman/bin:/Applications/Ghostty.app/Contents/MacOS" rtk node scripts/run-check.mjs
Not-tested: GitHub Actions rerun not observed locally

* Keep Rust checks warning-clean

Constraint: cargo clippy --workspace --all-targets --all-features -- -D warnings failed across core, web, and tauri crates
Rejected: Broad workspace-level clippy suppression | kept allows local to long-argument command/API boundaries
Confidence: high
Scope-risk: moderate
Directive: Preserve src-tauri/tauri.conf.json as an unrelated local change outside this commit
Tested: rtk cargo clippy --workspace --all-targets --all-features -- -D warnings
Not-tested: Full GitHub Actions rerun not observed locally

* Reuse existing proxy tunnels on retry

Proxy tunnel startup now mirrors SSH tunnel behavior by returning the existing local port for an active connection id instead of replacing the managed handle. A second map check aborts a just-spawned duplicate handle if a concurrent retry won the race before insertion, preventing orphaned listeners while keeping the change narrow.

Constraint: Reviewer requested proxy tunnel behavior align with SSH local-port reuse

Rejected: Always overwrite and abort the previous handle | less consistent with SSH behavior and churns listeners during retries

Confidence: high

Scope-risk: narrow

Tested: cargo fmt --check --all

Tested: cargo test -p dbx-core db::proxy_tunnel::tests::start_tunnel_reuses_existing_local_port

Tested: cargo clippy -p dbx-core --all-targets -- -D warnings

---------

Co-authored-by: hekx <hekx@momandeMac-mini.local>
Co-authored-by: caisin <caisin@caisins-Mac-mini.local>
This commit is contained in:
authored and GitHub committed 2026-06-06 23:22:29 +08:00
1 parent 0c3572d779
commit e9ee982843
54 files changed
+1869 -1188

No files matched your search

+6 -6
View File
@@ -229,9 +229,9 @@ export default {
duplicated: "Connection duplicated",
groupDeleted: "Group deleted",
loadFailed: "Failed to load saved connections: {message}",
sshTunnel: "SSH Tunnel",
sshTunnel: "SSH Tunnel / Proxy",
advancedTab: "Advanced",
sshEnable: "Connect via SSH tunnel",
sshEnable: "Use SSH tunnel / proxy",
sshHost: "SSH Host",
sshUser: "SSH User",
sshPassword: "SSH Password",
@@ -242,15 +242,15 @@ export default {
sshKeyPathBrowse: "Browse",
sshExposeLan: "Expose tunnel to LAN",
sshConnectTimeout: "SSH Timeout (seconds)",
sshHops: "SSH Hops",
sshHopAdd: "Add hop",
sshHops: "SSH Tunnel / Proxy Layers",
sshHopAdd: "Add SSH layer",
sshHopDuplicate: "Duplicate",
sshHopDelete: "Delete",
sshHopMoveUp: "Move up",
sshHopMoveDown: "Move down",
sshHopName: "Hop Name",
sshHopName: "Layer Name",
sshHopNamePlaceholder: "Bastion, jump host, production gateway",
sshHopDefaultName: "Hop {index}",
sshHopDefaultName: "Layer {index}",
sshHopInvalidHost: "{hop}: SSH host is required",
sshHopInvalidUser: "{hop}: SSH user is required",
sshHopInvalidPort: "{hop}: SSH port must be between 1 and 65535",
+6 -6
View File
@@ -221,9 +221,9 @@ export default {
duplicated: "Conexión duplicada",
groupDeleted: "Grupo eliminado",
loadFailed: "Error al cargar las conexiones guardadas: {message}",
sshTunnel: "Túnel SSH",
sshTunnel: "Túnel SSH / Proxy",
advancedTab: "Avanzado",
sshEnable: "Conectar mediante túnel SSH",
sshEnable: "Usar túnel SSH / proxy",
sshHost: "Host SSH",
sshUser: "Usuario SSH",
sshPassword: "Contraseña SSH",
@@ -234,15 +234,15 @@ export default {
sshKeyPathBrowse: "Examinar",
sshExposeLan: "Exponer túnel a la red local",
sshConnectTimeout: "Tiempo de espera SSH (segundos)",
sshHops: "Saltos SSH",
sshHopAdd: "Agregar salto",
sshHops: "Capas de túnel SSH / proxy",
sshHopAdd: "Agregar capa SSH",
sshHopDuplicate: "Duplicar",
sshHopDelete: "Eliminar",
sshHopMoveUp: "Subir",
sshHopMoveDown: "Bajar",
sshHopName: "Nombre del salto",
sshHopName: "Nombre de la capa",
sshHopNamePlaceholder: "Bastión, jump host, puerta de producción",
sshHopDefaultName: "Salto {index}",
sshHopDefaultName: "Capa {index}",
sshHopInvalidHost: "{hop}: el host SSH es obligatorio",
sshHopInvalidUser: "{hop}: el usuario SSH es obligatorio",
sshHopInvalidPort: "{hop}: el puerto SSH debe estar entre 1 y 65535",
+6 -6
View File
@@ -232,9 +232,9 @@ export default {
duplicated: "Connessione duplicata",
groupDeleted: "Gruppo eliminato",
loadFailed: "Impossibile caricare le connessioni salvate: {message}",
sshTunnel: "Tunnel SSH",
sshTunnel: "Tunnel SSH / Proxy",
advancedTab: "Avanzate",
sshEnable: "Connetti tramite tunnel SSH",
sshEnable: "Usa tunnel SSH / proxy",
sshHost: "Host SSH",
sshUser: "Utente SSH",
sshPassword: "Password SSH",
@@ -245,15 +245,15 @@ export default {
sshKeyPathBrowse: "Sfoglia",
sshExposeLan: "Esponi tunnel alla LAN",
sshConnectTimeout: "Timeout SSH (secondi)",
sshHops: "Hop SSH",
sshHopAdd: "Aggiungi hop",
sshHops: "Livelli tunnel SSH / proxy",
sshHopAdd: "Aggiungi livello SSH",
sshHopDuplicate: "Duplica",
sshHopDelete: "Elimina",
sshHopMoveUp: "Sposta su",
sshHopMoveDown: "Sposta giù",
sshHopName: "Nome Hop",
sshHopName: "Nome livello",
sshHopNamePlaceholder: "Bastion, jump host, gateway di produzione",
sshHopDefaultName: "Hop {index}",
sshHopDefaultName: "Livello {index}",
sshHopInvalidHost: "{hop}: Host SSH richiesto",
sshHopInvalidUser: "{hop}: Utente SSH richiesto",
sshHopInvalidPort: "{hop}: La porta SSH deve essere compresa tra 1 e 65535",
+6 -6
View File
@@ -231,9 +231,9 @@ export default {
duplicated: "Conexão duplicada",
groupDeleted: "Grupo excluído",
loadFailed: "Falha ao carregar as conexões salvas: {message}",
sshTunnel: "Túnel SSH",
sshTunnel: "Túnel SSH / Proxy",
advancedTab: "Avançado",
sshEnable: "Conectar via túnel SSH",
sshEnable: "Usar túnel SSH / proxy",
sshHost: "Host SSH",
sshUser: "Usuário SSH",
sshPassword: "Senha SSH",
@@ -244,15 +244,15 @@ export default {
sshKeyPathBrowse: "Procurar",
sshExposeLan: "Expor túnel à LAN",
sshConnectTimeout: "Timeout SSH (segundos)",
sshHops: "Saltos SSH",
sshHopAdd: "Adicionar salto",
sshHops: "Camadas de túnel SSH / proxy",
sshHopAdd: "Adicionar camada SSH",
sshHopDuplicate: "Duplicar",
sshHopDelete: "Excluir",
sshHopMoveUp: "Mover para cima",
sshHopMoveDown: "Mover para baixo",
sshHopName: "Nome do Salto",
sshHopName: "Nome da Camada",
sshHopNamePlaceholder: "Bastion, host de salto, gateway de produção",
sshHopDefaultName: "Salto {index}",
sshHopDefaultName: "Camada {index}",
sshHopInvalidHost: "{hop}: o host SSH é obrigatório",
sshHopInvalidUser: "{hop}: o usuário SSH é obrigatório",
sshHopInvalidPort: "{hop}: a porta SSH deve estar entre 1 e 65535",
+6 -6
View File
@@ -225,9 +225,9 @@ export default {
duplicated: "连接已复制",
groupDeleted: "分组已删除",
loadFailed: "加载已保存连接失败:{message}",
sshTunnel: "SSH 隧道",
sshTunnel: "SSH 隧道/代理",
advancedTab: "高级",
sshEnable: "通过 SSH 隧道连接",
sshEnable: "使用 SSH 隧道/代理连接",
sshHost: "SSH 主机",
sshUser: "SSH 用户",
sshPassword: "SSH 密码",
@@ -238,15 +238,15 @@ export default {
sshKeyPathBrowse: "浏览",
sshExposeLan: "允许局域网访问隧道",
sshConnectTimeout: "SSH 超时时间(秒)",
sshHops: "SSH 层级",
sshHopAdd: "添加层级",
sshHops: "SSH 隧道/代理层级",
sshHopAdd: "添加 SSH 层",
sshHopDuplicate: "复制",
sshHopDelete: "删除",
sshHopMoveUp: "上移",
sshHopMoveDown: "下移",
sshHopName: "层级名称",
sshHopName: "连接层名称",
sshHopNamePlaceholder: "堡垒机、跳板机、生产网关",
sshHopDefaultName: "第 {index} 跳",
sshHopDefaultName: "第 {index} 层",
sshHopInvalidHost: "{hop}:SSH 主机不能为空",
sshHopInvalidUser: "{hop}:SSH 用户不能为空",
sshHopInvalidPort: "{hop}:SSH 端口必须在 1 到 65535 之间",
+5 -5
View File
@@ -225,9 +225,9 @@ export default {
duplicated: "連線已複製",
groupDeleted: "群組已刪除",
loadFailed: "載入已儲存連線失敗:{message}",
sshTunnel: "SSH 隧道",
sshTunnel: "SSH 隧道/代理",
advancedTab: "進階",
sshEnable: "藉由 SSH 隧道連線",
sshEnable: "使用 SSH 隧道/代理連線",
sshHost: "SSH 主機",
sshUser: "SSH 使用者",
sshPassword: "SSH 密碼",
@@ -238,13 +238,13 @@ export default {
sshKeyPathBrowse: "瀏覽",
sshExposeLan: "允許區域網路存取隧道",
sshConnectTimeout: "SSH 逾時時間(秒)",
sshHops: "SSH 層級",
sshHopAdd: "新增層級",
sshHops: "SSH 隧道/代理層級",
sshHopAdd: "新增 SSH 層",
sshHopDuplicate: "複製",
sshHopDelete: "刪除",
sshHopMoveUp: "上移",
sshHopMoveDown: "下移",
sshHopName: "層級名稱",
sshHopName: "連線層名稱",
sshHopNamePlaceholder: "堡壘機、跳板機、生產閘道器",
sshHopDefaultName: "第 {index} 層",
sshHopInvalidHost: "{hop}:SSH 主機不能為空",