Skip to content

🐛 fix: avoid Tailscale socket on unsupported platforms - #23

Merged
LittleSheep2Code merged 1 commit into
Solsynth:masterfrom
Manchibo:master
Aug 9, 2026
Merged

🐛 fix: avoid Tailscale socket on unsupported platforms#23
LittleSheep2Code merged 1 commit into
Solsynth:masterfrom
Manchibo:master

Conversation

@Manchibo

@Manchibo Manchibo commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

修复:不支持内置 Tailscale 的平台回退直连 tailnet 地址

问题

Android(以及 Windows/Web)不支持 package:tailscale 的内置节点功能(tailscaleSupported 仅 macOS/Linux 为 true)。

当连接目标地址位于 Tailscale CGNAT 网段(100.64.0.0/10)时,SshConnectionManager._createClient 会无条件尝试使用 TailscaleSshSocket.connect,导致不支持平台触发:

Tailscale is not connected. Open Settings → Tailscale to sign in.

实际原因是当前平台不支持内置 Tailscale,而非用户未连接 Tailscale。

修改

修改 lib/servers/ssh_connection_manager.dart

  • 增加 tailscaleSupported 判断。
  • 仅在平台支持内置 Tailscale 时,tailnet 地址才使用 TailscaleSshSocket.connect
  • 不支持的平台回退到 _LowLatencySshSocket.connect,保持普通 SSH 直连行为。
  • 新增 import 'tailscale_service.dart' 用于访问 tailscaleSupported
- final socket = isTailnetAddress(server.host)
+ final socket = isTailnetAddress(server.host) && tailscaleSupported
      ? await TailscaleSshSocket.connect(server.host, server.port)
      : await _LowLatencySshSocket.connect(server.host, server.port, proxy: proxy);

isTailnetAddress 判断逻辑保持不变,未影响其他连接流程。

影响范围

✅ macOS/Linux

  • 行为保持不变。
  • tailnet 地址继续使用内置 Tailscale SSH socket。

✅ Android/Windows/Web

  • 不再尝试初始化不支持的内置 Tailscale。
  • tailnet 地址改为普通 SSH 直连。
  • 消除误导性的 “Tailscale is not connected” 错误。

测试

  • 验证支持 Tailscale 平台上的 tailnet SSH 连接行为保持一致。
  • 验证不支持平台连接 100.64.0.0/10 地址时能够正常回退直连。

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

@LittleSheep2Code
LittleSheep2Code merged commit 31b265a into Solsynth:master Aug 9, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants