aboutsummaryrefslogtreecommitdiffstats
path: root/src/transport
diff options
context:
space:
mode:
Diffstat (limited to 'src/transport')
-rw-r--r--src/transport/mod.rs2
-rw-r--r--src/transport/wire.rs15
2 files changed, 10 insertions, 7 deletions
diff --git a/src/transport/mod.rs b/src/transport/mod.rs
index 9d28212..d774402 100644
--- a/src/transport/mod.rs
+++ b/src/transport/mod.rs
@@ -440,6 +440,8 @@ pub(crate) struct OtherPath {
pub(crate) transport: String,
/// The round trip of its fastest path, in microseconds, if any is measured.
pub(crate) rtt_us: Option<u32>,
+ /// Only through a relay (libp2p): no direct connection at any of its paths.
+ pub(crate) relayed: bool,
}
#[derive(Clone, Serialize, Deserialize)]
diff --git a/src/transport/wire.rs b/src/transport/wire.rs
index 87063d2..817437a 100644
--- a/src/transport/wire.rs
+++ b/src/transport/wire.rs
@@ -14,7 +14,7 @@ use super::{MessageKind, ParsedMessage};
/// The wire format's version, the first byte of every payload. Bump it with every change
/// to a message type or a codec (`golden_bytes` fails then).
-pub(crate) const VERSION: u8 = 8;
+pub(crate) const VERSION: u8 = 9;
/// What the second byte of a payload says.
fn tag(kind: MessageKind) -> u8 {
@@ -422,6 +422,7 @@ pub(crate) fn samples() -> Vec<ParsedMessage> {
others: vec![crate::transport::OtherPath {
transport: "mycelium".into(),
rtt_us: None,
+ relayed: false,
}],
}],
}),
@@ -595,7 +596,7 @@ mod tests {
});
assert_eq!(
hex(&encode(&hello).unwrap()),
- format!("080097a5737761726d{epoch_hex}01c403010203c3{}07", run("04"))
+ format!("090097a5737761726d{epoch_hex}01c403010203c3{}07", run("04"))
);
let reply = ParsedMessage::HelloReply(HelloReply {
@@ -615,7 +616,7 @@ mod tests {
assert_eq!(
hex(&encode(&reply).unwrap()),
format!(
- "080199a5737761726d9192a17091a161{epoch_hex}01c400c2{}05{}",
+ "090199a5737761726d9192a17091a161{epoch_hex}01c400c2{}05{}",
run("04"),
run("06")
)
@@ -630,7 +631,7 @@ mod tests {
});
assert_eq!(
hex(&encode(&status).unwrap()),
- format!("0803959290c400{epoch_hex}01c3c2")
+ format!("0903959290c400{epoch_hex}01c3c2")
);
let who = ParsedMessage::Who(IdentityProof {
@@ -639,7 +640,7 @@ mod tests {
});
assert_eq!(
hex(&encode(&who).unwrap()),
- format!("080692c420{}c440{}", "08".repeat(32), "09".repeat(64))
+ format!("090692c420{}c440{}", "08".repeat(32), "09".repeat(64))
);
let ParsedMessage::Me(proof) = decode(
&encode(&ParsedMessage::Me(IdentityProof {
@@ -653,10 +654,10 @@ mod tests {
};
assert_eq!((proof.key, proof.signature), ([8; 32], [9; 64]));
- assert_eq!(hex(&encode(&ParsedMessage::Ping(7)).unwrap()), "080807");
+ assert_eq!(hex(&encode(&ParsedMessage::Ping(7)).unwrap()), "090807");
assert_eq!(
hex(&encode(&ParsedMessage::Pong(u64::MAX)).unwrap()),
- "0809cfffffffffffffffff"
+ "0909cfffffffffffffffff"
);
let ParsedMessage::Pong(nonce) = decode(&[VERSION, 9, 0x2a]).unwrap() else {
panic!("not a PONG");