aeronet_iroh: add PathReport session telemetry and prompt path-migration updates - #102
Open
baadc0de wants to merge 1 commit into
Open
aeronet_iroh: add PathReport session telemetry and prompt path-migration updates#102baadc0de wants to merge 1 commit into
baadc0de wants to merge 1 commit into
Conversation
…ion updates Add a PathReport component to iroh sessions exposing relay-vs-direct path kind, RTT, and time-to-direct-path, and wake the backend meta loop on Connection::path_events() so relay-to-direct migration is reported within a frame instead of up to 100ms late (native targets; WASM keeps the plain interval since PathEventStream is not fused). Also add a test-utils feature with run_test_relay(), an in-process loopback Iroh relay helper, and an end-to-end test exercising datagram exchange and PathReport over that relay.
Owner
|
re test_utils, would rather have that as a separate file in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds per-session path telemetry to
aeronet_irohsessions, and makesrelay→direct path migration visible to the ECS world within a frame instead
of up to 100 ms late.
PathReportcomponentNew
session::PathReportcomponent, inserted when a session connects andupdated by the IO layer alongside the existing
SelectedPath/PacketRtt:SelectedPathalready exposes the rawTransportAddr;PathReportadds thetwo things games actually want to graph and gate on:
TransportAddrvariants), andNAT-traversal health metric for peered sessions (iroh's own baseline is
~90% direct); without it you can only observe the current path, never
the migration latency.
Prompt migration updates
The backend meta loop previously polled path state on a fixed 100 ms
interval, so a relay→direct migration could surface up to a full interval
late. It now also wakes on
Connection::path_events()(
PathEvent::Selected/Closed), soPathReport,SelectedPath, andPacketRttupdate on the next frame after a migration.This needs no new dependencies and works on WASM too:
PathEventStreamisnot a fused stream, but
StreamExt::fuse()wraps any stream into aFusedStream, so plainfutures::select!can poll it.test-utilsfeatureNew optional feature exposing
test_utils::run_test_relay(): an in-processloopback Iroh relay (HTTPS + QUIC, self-signed certs via
iroh-relay/test-utils) returning(RelayMap, RelayUrl, Server). Letsdownstream crates write offline integration tests that exercise the real
relay path — including hole punching — with no external network.
Used by the new
tests/relay_path_report.rs: two endpoints over theloopback relay connect, exchange datagrams both ways, and assert
PathReportpopulates with a sane path kind, non-zero RTT, and (when adirect path is selected) a
time_to_direct.Why
We're building a P2P multiplayer stack on aeronet + iroh
(Orrery) where relay-vs-direct path
and time-to-direct are first-class session telemetry: the coordinator uses
them to size islands and to detect degraded peers. Every P2P game on this
transport will want the same signals; they belong in the IO layer.
Compatibility
existing public API or behavior (besides the faster telemetry updates
noted above).
futures,which the crate already depends on, and works on WASM.
test-utilspulls iniroh-relaywithserver+test-utilsfeatures,only when enabled.
Validation
cargo clippy -p aeronet_iroh --all-targets --all-features -- -D warnings— cleancargo test -p aeronet_iroh --all-features— all pass (existingsession.rstests, newrelay_path_report.rs, doctests)cargo doc -p aeronet_iroh --no-deps --all-features— cleancargo build -p aeronet_iroh --examples— clean