sing-tun creates its utun control socket without SOCK_CLOEXEC (tun_darwin.go), so any child the unified helper spawns while the engine runs - the DnsGuard scutil process, route commands - inherits that socket and pins the utun interface past engine stop. The announcement-driven rebuild then fails with "desktop TUN address already in use" and tears down the whole VPN session. Mark every utun socket in the process close-on-exec as soon as the engine starts. Stop now only warns when Darwin still holds the retiring address (classified via cleanupFailure), and Start waits bounded for an address this engine itself retained while failing fast on any other owner. Adds a root-only drain diagnostic with a real-profile pass, a child-guard regression test that reproduced the production failure before the fix, and a --self-test-unified-rebuild helper self-test that forces stop/start cycles in combined mode end to end. Co-Authored-By: Claude Code <noreply@anthropic.com>
MeshPort sing-box 接入
固定依赖 sing-box 1.14.3。当前提供本机 SOCKS 入口、受管理的 IPv4 组网分流、MeshPort SOCKS 出口及启停控制;完整 APP/TUN、互联网代理配置与订阅尚未接入。
从项目根目录执行:
sh scripts/go-local.sh test -race ./...
sh scripts/build-singbox.sh
sh scripts/test-singbox-bridge.sh
Go API:bridge.Engine.Start(context, bridge.Config)、Stop()、Snapshot()。调用方生成有效配置投影并拥有生命周期,停止或上下文取消后需调用 Stop。
完整接入方式、验证及限制见 项目文档,上游许可证见 LICENSE 副本。