tsnet_flutter 0.6.0
tsnet_flutter: ^0.6.0 copied to clipboard
Embed Tailscale's tsnet in Flutter apps. Provides a userspace WireGuard tunnel with a localhost TCP proxy — no VPN entitlement needed on iOS.
0.6.0 #
- New
recoverPaths(): the cheap recovery tier for embedded-node deaf episodes (a zombie home-DERP connection is otherwise noticed only by the client's 120 s read deadline, tailscale#15776). Calls, on the running node viatsnet.Server.Sys(),MagicSock.Get().SetNetworkUp(true)+Rebind()+ReSTUN("app-recover")— rebinds the UDP sockets, probes every active DERP connection with a 3 s bound and reconnects dead ones, resets per-peer path state, and re-advertises fresh endpoints. Sub-second on a healthy node, ~3 s bound when DERP connections are dead, versus the 90-344 s the node otherwise spends deaf waiting on its 120 s DERP read deadline. New C exportTailscaleRecoverPaths; the node lock is held for the whole run so it can never racestop() - The iOS Swift layer now runs an
NWPathMonitorwhile the node is up (started onstart()success, stopped instop()), pushing every network-path transition into Go via two new C exports —TailscaleUpdateDefaultRouteInterface(netmon's last-known default-route interface, Apple platforms only) andTailscaleInjectNetmonEvent(schedules the engine's link-change repair machinery). This mirrors upstream PR tailscale#10680: without the push, no link event ever fires inside an app-embedded node and the Rebind/ReSTUN repair machinery is dead code - New optional
start(debugNetLogging: true): setsTS_DEBUG_DERP=1andTS_DEBUG_DISCO=1(log-only knobs) before tsnet starts, for frame-level DERP/disco visibility in development builds. Default off. Note: upstream compiles these knobs out of GOOS=ios binaries (debugknobs_stubs.go), so the flag is effective on macOS, Android, and Linux builds only. New C exportTailscaleSetDebugNetLogging - Corrected the
TailscalePingPeer/pingPeerdocumentation: a disco ping does NOT force DERP re-registration while the relay connection is a dead zombie (writes into dead TCP succeed silently). It is the detector;recoverPaths()is the cure - Go test suite extended (still
go test -race): recovery call sequence, recovery on a never-started node errors cleanly, recovery/inject concurrent with stop, netmon exports safe on a stopped node, debug-logging toggle; Dart tests cover therecoverPathsandstart(debugNetLogging:)wire contracts - All FFI symbols new in this release are looked up lazily, so older self-built libraries keep working until the new APIs are actually used. macOS/Android/Linux native libraries are unchanged in this release;
recoverPaths()and the path monitor ship in the rebuilt iOS xcframework
0.5.0 #
- Upgrade the embedded tailscale.com library from v1.82.0 to v1.98.9 (the embedded node could silently lose its DERP relay registration for minutes, leaving remote peers one-way deaf — "derp-N does not know about peer, removing route"). The v1.98 line carries the upstream fix class for exactly this: periodic disco-key adverts over TSMP so a peer stuck in "an infinite DERP state" recovers (tailscale#19212), no longer overwriting a fresh disco key with the stale one control knows (tailscale#18606), best-address invalidation on trust timeout for direct UDP paths (tailscale#19415), home-DERP caching plus ReSTUN-on-cold-start (tailscale#19491, tailscale#19586), a wireguard-go roaming-endpoints fix (tailscale#20118), and darwin netmon fixes (RTM_MISS skip, cheaper darkwake handling)
- New
pingPeer(ip): sends one disco ping through the node's LocalClient (5 s bound), requesting path discovery toward that peer (note, corrected in 0.6.0: a disco ping is a liveness detector and cannot revive a dead relay connection). Returnstruewhen the peer answered,falseon any failure (unreachable, timeout, node not started — a clean error, never a crash). New C exportTailscalePingPeer; existing exports unchanged, and the FFI symbol is looked up lazily so older self-built libraries keep working until the app pings - Go test suite extended: ping while stopped, ping dispatch/deadline, bad IP, failure propagation, timeout (all still under
go test -race); Dart tests cover thepingPeerwire contract - The Go bridge now requires Go 1.26.5+ to build (tailscale v1.98.9's minimum)
build_go.shno longer passests_omit_serve/ts_omit_acme: since v1.98 tsnet calls the serve-config and certificate LocalClient methods unconditionally, so those omits no longer compile
0.4.1 #
- Fix a native use-after-free class crash when a proxy handle is stopped while native work is in flight on it:
stopProxyHandle()now fences — it returns only once the proxy is fully quiescent (accept loop exited, any in-flight upstream dial aborted through the proxy context, every connection's copy loops finished) - Double stop of one handle, concurrent or sequential, is a safe no-op; every concurrent stopper waits for the drain
stop()now drains every proxy before closing the tsnet node, and holds the node lock across proxy start, sweep, and close, so the node can never be closed under an in-flight proxy dial or copy loop, and a proxy can never be registered against a node that is closing- Go test suite extended: concurrent double stop, stop during a hung upstream dial, stop with a live connection mid-copy, stop-all draining in-flight dials, and a concurrent stop+dial storm (all under
go test -race) - Exported C symbols unchanged
0.4.0 #
- Concurrent proxy handles:
startProxyHandle()/stopProxyHandle()run any number of independent localhost proxies (one per remote device), each started and stopped on its own - Go bridge: proxy registry keyed by monotonically increasing 64-bit handles (never reused); local ports stay kernel-assigned, so they cannot collide, even for two proxies to the same remote
- Legacy
startProxy()/stopProxy()keep their one-at-a-time semantics but now only manage their own slot — they no longer disturb handle-based proxies stop()tears down every proxy (legacy and handle-based) before leaving the Tailnet- New C exports
TailscaleStartProxyHandle/TailscaleStopProxyHandle; existing exports unchanged, and the new FFI symbols are looked up lazily so older self-built libraries keep working for the legacy API - Go test suite for the proxy layer (
ios/Go/bridge_test.go, run withgo test -race) covering concurrent handles, independent stop, restart, same-remote ports, legacy interplay, and stress
0.3.0 #
- Add Android support (Dart FFI, arm64-v8a + x86_64)
- Add Linux support (Dart FFI, amd64 via Docker cross-compilation)
- Platform-aware Dart API: MethodChannel on iOS/macOS, FFI on Android/Linux
- Android: RegisterInterfaceGetter to bypass netlink restrictions
- Build script supports all platforms:
./build_go.sh [ios|macos|android|linux|apple|all] - Full README with API reference, platform setup, and binary sizes
- Note: Android Tailscale tunnel requires libtailscale integration (local gRPC works)
0.2.0 #
- Add macOS support (arm64 + x86_64 universal binary)
- Make
start()idempotent — calling it when already started returns success - Document macOS entitlement requirements (network.client + network.server)
- Build script now supports
./build_go.sh [ios|macos|all]
0.1.1 #
- Fix: xcframework linking when installed from pub.dev (use DERIVED_FILE_DIR instead of symlinks)
0.1.0 #
- Initial release
- iOS support (arm64 device + simulator)
start()/stop()— join/leave a Tailnet with an auth keystartProxy()/stopProxy()— localhost TCP proxy through WireGuard tunnelstatus()/tailscaleIP()— query Tailscale connection state- Built with
go build -buildmode=c-archive(production Go approach) - No VPN entitlement required — uses userspace netstack