• Add shared TCP and UDP virtual services

    ab released this 2026-10-21 14:40:45 +00:00 | 3 commits to master since this release

    Provide named VIPs with independent protocol/port listeners and node/port
    backends so applications can use one DNS endpoint without a separate load
    balancer. Every authenticated member may create, edit or delete any service.
    Client agents select the eligible backend with the lowest measured encrypted
    data-plane RTT, including relayed paths, and pin existing flows. UDP recovers
    on another backend after failure; established TCP is never replayed or moved.
    An unanswered empty TCP SYN may retry another backend before establishment.

    Keep signed multi-writer field registers in state/vip.rs. Independent backend
    edits merge, same-field conflicts use Lamport/author/canonical ordering, and
    listener generations prevent old backend entries returning on port recreation.
    Permanent service tombstones protect replay while allowing obsolete fields to
    be compacted. Active-service and deletion-history limits are separate. Commit
    complete snapshots and the author's durable counter atomically before local
    routing changes or publication. Restore counters from newer genuine author
    updates learned from replicas after an old backup is restored.

    Implement bounded client-side address/port NAT at overlay ingress and reverse
    translation only after authenticated source/destination admission. Reserve OS
    source ports to avoid direct-flow collisions and quarantine retired ports for
    late replies. Handle a backend on the client itself, scoped fragment assembly,
    checksums, re-fragmentation and quoted ICMP/PMTU headers. Plugins and encrypted
    transit retain their existing contracts. Data-path probes measure RTT; bounded
    fair TCP connect checks are enabled by default and configurable per listener.
    Arbitrary UDP application readiness remains unknown; path checks and explicit
    port errors drive eligibility without protocol-specific probe payloads.

    Expose the shared draft API through local IPC, simple vip/listener/backend CLI
    commands, JSON, editor-based atomic updates and watch output. Add a VIP button
    on each network tile and a separate tray editor. Edits and removals stay local
    until Save; stale revisions retain the draft, and closing a dirty window offers
    explicit discard. Report local routing choices, health reasons, RTT age, active
    and draining bindings, IP counters, rates, drops and UDP failovers. Extend DNS
    with service names; keep numeric addresses secondary and preserve existing
    bindings while VIP addresses or listeners change.

    This changes control wire ALPN/version to tsunagi/ctrl/8 and local IPC to 22;
    all members and local clients must upgrade together. Data ALPN remains 5.
    SQLite schema 10 migrates existing mandatory state without changing identity,
    secrets, network ids, derivation labels, handshake encoding or node records.
    Crate versions and release tags are unchanged. No installed agent or tray was
    replaced. Commands, limits and operational semantics are in docs/vip.md.

    Checks on Linux in nix develop:

    • cargo fmt --all -- --check
    • cargo clippy --locked --workspace --all-targets -- -D warnings
    • cargo test --locked --workspace --all-targets: 559 passed, 3 ignored
    • git diff --cached --check

    The full suite includes real encrypted TCP/UDP VIP traffic, backend-stop UDP
    failover, real loopback TCP check recovery, source admission, signed merges,
    stale/deleted state, SQLite migration and rollback, restart/author recovery,
    network isolation, actual CLI/DNS processes, and headless text-entry/Save-button
    interaction. Discovery and memory TUNs are the existing test substitutions;
    authentication, transport, encryption and SQLite remain real.

    Initial checks outside Nix failed for missing GTK pkg-config metadata, and an
    initial CLI test inherited TSUNAGI_CONTROL_SOCKET. Final checks use the Nix
    environment with that variable unset so tests address their temporary sockets.
    Root/internet-dependent tests remain ignored. No live host TUN, native desktop
    session, macOS or Windows validation was performed.

    Downloads