Skip to content

feat(tls): multi-peer mesh support for TLS transport (#136) - #139

Merged
vxfemboy merged 7 commits into
mainfrom
feat/multi-peer-tls
Oct 14, 2026
Merged

vxfemboy merged 7 commits into
mainfrom
feat/multi-peer-tls

Conversation

@vxfemboy

Copy link
Copy Markdown
Member

Fixes #136: Implements full multi-peer support for transport = tls in yipd.

Changes Summary

  1. Dynamic Multi-FD Epoll Primitive (crates/yip-io/src/epoll.rs):
    • Added safe dynamic multi-token epoll (create, add, remove, wait_tokens), preserving #![forbid(unsafe_code)] in yipd.
    • Maintained backward compatibility for quic.rs (new, wait).
  2. Multi-Peer Connection Lifecycle & Role Resolution (bin/yipd/src/tls.rs):
    • Implemented PeerConn state machine (Disconnected, Connecting, Connected) with exponential reconnect backoff (100ms -> 5000ms).
    • Pairwise static-key role tiebreak (local_public < peer_public dials, local_public > peer_public listens) to prevent connection glare.
    • Enforced fail-closed INNER_HANDSHAKE_TIMEOUT = 10s deadline per peer.
  3. Multi-Peer Event Loop & Egress Demux (bin/yipd/src/tls.rs):
    • Non-blocking pump loop handling TOKEN_TUN, TOKEN_LISTENER, and TOKEN_PEER_BASE + idx.
    • Ingress deframing into PeerManager::on_udp with inner confirmation gating, immediate egress reply forwarding, and TUN delivery.
    • Egress demuxing by d.dst across active streams.
    • Cadence tick routing keepalive and cover datagrams.
  4. Config & Test Updates (bin/yipd/src/config.rs):
    • Removed single-peer TLS warning and updated config tests.
    • Added drive_multi_peer_concurrent_pump unit test verifying 2 concurrent loopback TLS peers with zero cross-talk or packet leaks.

Verification

  • cargo test --all: All 351 yipd tests and 42 integration/netns tests passed cleanly.
  • cargo clippy --all-targets -- -D warnings: 0 warnings.
  • cargo fmt --check: formatting clean.
  • Zero wire format or protocol changes.

@vxfemboy
vxfemboy merged commit b339861 into main Oct 14, 2026
9 checks passed
@vxfemboy
vxfemboy deleted the feat/multi-peer-tls branch October 14, 2026 17:41
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.

transport tls support for multi peer

1 participant