aboutsummaryrefslogtreecommitdiffstats
path: root/src/transport/wire.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/transport/wire.rs')
-rw-r--r--src/transport/wire.rs18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/transport/wire.rs b/src/transport/wire.rs
index 817437a..dc94ab3 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 = 9;
+pub(crate) const VERSION: u8 = 10;
/// What the second byte of a payload says.
fn tag(kind: MessageKind) -> u8 {
@@ -353,6 +353,7 @@ pub(crate) fn samples() -> Vec<ParsedMessage> {
epoch_seq: 1,
ready: true,
syncs_with_you: true,
+ leaving: false,
};
let proof = IdentityProof {
key: [8; 32],
@@ -515,6 +516,7 @@ mod tests {
epoch_seq: 0,
ready: true,
syncs_with_you: false,
+ leaving: false,
};
let decoded =
decode(&encode(&ParsedMessage::StatusReply(status.clone())).unwrap()).unwrap();
@@ -537,6 +539,7 @@ mod tests {
epoch_seq: 0,
ready: true,
syncs_with_you: true,
+ leaving: false,
};
assert!(decode(&encode(&ParsedMessage::Status(status)).unwrap()).is_err());
}
@@ -596,7 +599,7 @@ mod tests {
});
assert_eq!(
hex(&encode(&hello).unwrap()),
- format!("090097a5737761726d{epoch_hex}01c403010203c3{}07", run("04"))
+ format!("0a0097a5737761726d{epoch_hex}01c403010203c3{}07", run("04"))
);
let reply = ParsedMessage::HelloReply(HelloReply {
@@ -616,7 +619,7 @@ mod tests {
assert_eq!(
hex(&encode(&reply).unwrap()),
format!(
- "090199a5737761726d9192a17091a161{epoch_hex}01c400c2{}05{}",
+ "0a0199a5737761726d9192a17091a161{epoch_hex}01c400c2{}05{}",
run("04"),
run("06")
)
@@ -628,10 +631,11 @@ mod tests {
epoch_seq: 1,
ready: true,
syncs_with_you: false,
+ leaving: false,
});
assert_eq!(
hex(&encode(&status).unwrap()),
- format!("0903959290c400{epoch_hex}01c3c2")
+ format!("0a03969290c400{epoch_hex}01c3c2c2")
);
let who = ParsedMessage::Who(IdentityProof {
@@ -640,7 +644,7 @@ mod tests {
});
assert_eq!(
hex(&encode(&who).unwrap()),
- format!("090692c420{}c440{}", "08".repeat(32), "09".repeat(64))
+ format!("0a0692c420{}c440{}", "08".repeat(32), "09".repeat(64))
);
let ParsedMessage::Me(proof) = decode(
&encode(&ParsedMessage::Me(IdentityProof {
@@ -654,10 +658,10 @@ mod tests {
};
assert_eq!((proof.key, proof.signature), ([8; 32], [9; 64]));
- assert_eq!(hex(&encode(&ParsedMessage::Ping(7)).unwrap()), "090807");
+ assert_eq!(hex(&encode(&ParsedMessage::Ping(7)).unwrap()), "0a0807");
assert_eq!(
hex(&encode(&ParsedMessage::Pong(u64::MAX)).unwrap()),
- "0909cfffffffffffffffff"
+ "0a09cfffffffffffffffff"
);
let ParsedMessage::Pong(nonce) = decode(&[VERSION, 9, 0x2a]).unwrap() else {
panic!("not a PONG");