From 0c096a524531c180798f0712bb7100f0b7557f76 Mon Sep 17 00:00:00 2001 From: tv Date: Mon, 2 Nov 2026 23:07:14 +0100 Subject: swarm: relay links messages --- src/transport/mod.rs | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'src/transport/mod.rs') diff --git a/src/transport/mod.rs b/src/transport/mod.rs index 96f7651..b8b57af 100644 --- a/src/transport/mod.rs +++ b/src/transport/mod.rs @@ -409,8 +409,16 @@ pub(crate) struct LinksRequest { pub(crate) nonce: u64, /// For this long (seconds), a LINKS_REPLY again whenever the links change (a /// subscription; the next LINKS renews it). 0: this reply only, and a subscription - /// ends. + /// ends (a relayed one runs out instead). pub(crate) subscribe_secs: u32, + /// Members the receiver is to ask on the sender's behalf, which the sender can't + /// reach, passing their links on (relayed, `swarm::links`); none: the receiver's own. + pub(crate) of: Vec, + /// How long relayed links may be held to send several in one LINKS_REPLY, by the + /// receiver and the hops after it together (milliseconds; `swarm::links`). + pub(crate) batch_ms: u32, + /// How many more nodes a relayed request may go through, after the receiver. + pub(crate) hops: u8, } /// LINKS_REPLY: how the sender is linked to its neighbours, as it measures them. @@ -422,7 +430,18 @@ pub(crate) struct LinksReply { pub(crate) epoch_seq: u32, /// The request's. pub(crate) nonce: u64, - /// At most `swarm::links::MAX_LINKS`. + /// The sender's own, if asked for; at most `swarm::links::MAX_LINKS`. + pub(crate) links: Vec, + /// Other members' links, passed on (`LinksRequest::of`). + pub(crate) relayed: Vec, +} + +/// A member's links as a LINKS_REPLY passes them on. +#[derive(Debug, Clone, Serialize, Deserialize)] +pub(crate) struct RelayedLinks { + pub(crate) member: String, + /// How long ago the member reported them (milliseconds). + pub(crate) age_ms: u32, pub(crate) links: Vec, } -- cgit v1.3.1