From 4a5f94daa02f6878dc796513e5cde9f87e1365ec Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Wed, 16 Aug 2023 10:24:50 -0400 Subject: [PATCH] cell: Add accessors to Introduce2. --- crates/tor-cell/semver.md | 1 + crates/tor-cell/src/relaycell/hs.rs | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/crates/tor-cell/semver.md b/crates/tor-cell/semver.md index d187e5957..e730ea735 100644 --- a/crates/tor-cell/semver.md +++ b/crates/tor-cell/semver.md @@ -1,2 +1,3 @@ ADDED: establish_intro functions now take any impl>. ADDED: Iterator over IntroEstablishedExt. +ADDED: accessors for Introduce2 diff --git a/crates/tor-cell/src/relaycell/hs.rs b/crates/tor-cell/src/relaycell/hs.rs index 45510c8e9..6e1dae407 100644 --- a/crates/tor-cell/src/relaycell/hs.rs +++ b/crates/tor-cell/src/relaycell/hs.rs @@ -111,6 +111,23 @@ impl Introduce2 { msg, } } + + /// Return the bytes used to transmit `header`. + /// + /// (This data is used as part of the handshake.) + pub fn encoded_header(&self) -> &[u8] { + &self.encoded_header[..] + } + /// Return the parsed header of this message. + pub fn header(&self) -> &IntroduceHeader { + &self.msg.header + } + /// Return the encrypted body of this message. + /// + /// (This body is decrypted as part of the handshake.) + pub fn encrypted_body(&self) -> &[u8] { + &self.msg.encrypted[..] + } } caret_int! {