aboutsummaryrefslogtreecommitdiffstats
path: root/src/transport/mod.rs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-11-06 14:29:42 +0100
committertv <tv@krebsco.de>2026-11-06 14:29:42 +0100
commitd6f6c7aad904e650e6c7371dbd4776f6f0be2388 (patch)
treec4cf94b5099e3ea31faddc7356459337127eb3f3 /src/transport/mod.rs
parent43305f5a0e2a87c68405989600b33e33c1ab70df (diff)
indirect probes
Diffstat (limited to 'src/transport/mod.rs')
-rw-r--r--src/transport/mod.rs40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/transport/mod.rs b/src/transport/mod.rs
index 00e07e5..743e713 100644
--- a/src/transport/mod.rs
+++ b/src/transport/mod.rs
@@ -243,6 +243,10 @@ pub(crate) enum ParsedMessage {
Links(LinksRequest),
/// Answers a LINKS.
LinksReply(LinksReply),
+ /// Asks whether the recipient reaches a member (`swarm::working_links`).
+ Probe(ProbeRequest),
+ /// Answers a PROBE.
+ ProbeReply(ProbeReply),
}
/// A node's proof that it holds the key of its node ID (`identity`), sending from its
@@ -385,6 +389,8 @@ pub(crate) enum MessageKind {
Pong,
Links,
LinksReply,
+ Probe,
+ ProbeReply,
}
impl ParsedMessage {
@@ -402,6 +408,8 @@ impl ParsedMessage {
ParsedMessage::Pong { .. } => MessageKind::Pong,
ParsedMessage::Links(_) => MessageKind::Links,
ParsedMessage::LinksReply(_) => MessageKind::LinksReply,
+ ParsedMessage::Probe(_) => MessageKind::Probe,
+ ParsedMessage::ProbeReply(_) => MessageKind::ProbeReply,
}
}
@@ -420,6 +428,8 @@ impl ParsedMessage {
ParsedMessage::Blob(blob) => Some((blob.epoch, blob.epoch_seq)),
ParsedMessage::Links(request) => Some((request.epoch, request.epoch_seq)),
ParsedMessage::LinksReply(reply) => Some((reply.epoch, reply.epoch_seq)),
+ ParsedMessage::Probe(request) => Some((request.epoch, request.epoch_seq)),
+ ParsedMessage::ProbeReply(reply) => Some((reply.epoch, reply.epoch_seq)),
ParsedMessage::Who(_)
| ParsedMessage::Me(_)
| ParsedMessage::Ping(_)
@@ -428,6 +438,36 @@ impl ParsedMessage {
}
}
+/// PROBE: whether the recipient reaches `member` (`swarm::working_links`), as SWIM
+/// asks others before it suspects a member. Answered from what the recipient knows,
+/// without contacting the member.
+#[derive(Debug, Clone, Serialize, Deserialize)]
+pub(crate) struct ProbeRequest {
+ #[serde(with = "crate::transport::wire::codec::epoch")]
+ pub(crate) epoch: Epoch,
+ /// See `SyncEnvelope::epoch_seq`.
+ pub(crate) epoch_seq: u32,
+ /// Repeated in the reply.
+ pub(crate) nonce: u64,
+ /// The member asked about (its node ID).
+ pub(crate) member: String,
+}
+
+/// PROBE_REPLY: whether the sender reaches the member asked about.
+#[derive(Debug, Clone, Serialize, Deserialize)]
+pub(crate) struct ProbeReply {
+ #[serde(with = "crate::transport::wire::codec::epoch")]
+ pub(crate) epoch: Epoch,
+ /// See `SyncEnvelope::epoch_seq`.
+ pub(crate) epoch_seq: u32,
+ /// The request's.
+ pub(crate) nonce: u64,
+ pub(crate) member: String,
+ /// It does (an active session that answers); it doesn't (it holds the member
+ /// dormant, or its HELLOs went unanswered); None: it can't tell (no contact with it).
+ pub(crate) reached: Option<bool>,
+}
+
/// LINKS: what a member is asked for a map of the swarm (`swarm::links`).
#[derive(Debug, Clone, Serialize, Deserialize)]
pub(crate) struct LinksRequest {