Move mesh networking logic into the SDK and fix lifecycle bugs

SDK:
- Add build_config/migrate_config, mesh_cidrs, route_generation, health
  and start_bridged; expose abi_info (capability revision 2).
- Add wait_routes long-poll; stop wakes waiters, and context_free now
  stops the network immediately instead of waiting for waiters to time out.

Hosts:
- Dart: waitRoutes(), MeshProxySession route watcher, ABI capability check.
- Android: fix a deadlock where every VPN request waited on its own
  single-thread worker; requests are now async, status is served from a
  snapshot, and combined mode reports Partial when the mesh stops.
- macOS helper: mesh-only unified mode stops when the mesh is lost;
  installed_subnet_routes excludes the overlay.
- Lab: restore Partial sessions, write migrated profiles back, remove the
  unreachable TOML import dialog; native test now connects via the form.

Docs updated accordingly.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
shenlei
2026-10-15 18:17:42 +09:00
co-authored by Claude Opus 5.5
parent 29d236f3fe
commit dc1bfc99d2
34 changed files with 1724 additions and 715 deletions
+2
View File
@@ -19,3 +19,5 @@ UI 仅显示实测状态与结果。连接耗时与 echo 往返耗时分开标
选路优化在 vendor/easytier/easytier-core 的连接及下一跳选择层执行,适配层负责严格配置和实际路由快照。质量测量通过公开 Rust/C ABI/Dart API 发起真实 UDP echo,不改系统网络,详见 [优化说明](optimization.md)。
系统模式:Flutter → Dart Unix 控制通道 → macOS 特权 helper → 同一 C ABI → EasyTier TUN;其他应用通过普通系统 socket 使用虚拟网段。详见 [系统组网](system-vpn.md)。
组网规则归 SDK:配置生成与模式约束(`build_config`)、旧配置迁移(`migrate_config`)、虚拟网段与本机接口冲突检查、应用模式网络加桥接的原子启动(`start_bridged`)、路由目标投影(`mesh_cidrs` 与 `route_generation`)、组网可用性(`health`)以及节点直连/中继与延迟来源判定(`nodes`)都在 Rust 中实现。Dart 客户端核心、Android VpnService 与 macOS helper 只安装和展示这些结果,负责平台授权、socket protect、物理网络选择、OS 路由/DNS 守护与 sing-box 配置。质量测量循环仍由 Dart 驱动:ABI v1 每 context 串行,在原生侧运行约 30 秒的采样循环会阻塞同一 context 的状态轮询。