pub struct RelayEnvelope {
pub message_id: MessageId,
pub hop_count: u8,
pub max_hops: u8,
pub origin_node: NodeId,
pub flags: RelayFlags,
pub payload: Vec<u8>,
}Expand description
A relay envelope wrapping a document for multi-hop transmission
Fields§
§message_id: MessageIdUnique message identifier for deduplication
hop_count: u8Current hop count (increments with each relay)
max_hops: u8Maximum allowed hops (TTL)
origin_node: NodeIdOriginal sender node ID
flags: RelayFlagsEnvelope flags
payload: Vec<u8>The wrapped payload (typically an encrypted document)
Implementations§
Source§impl RelayEnvelope
impl RelayEnvelope
Sourcepub fn new(origin_node: NodeId, payload: Vec<u8>) -> Self
pub fn new(origin_node: NodeId, payload: Vec<u8>) -> Self
Create a new relay envelope for a payload
Sourcepub fn with_max_hops(self, max_hops: u8) -> Self
pub fn with_max_hops(self, max_hops: u8) -> Self
Create with custom max hops
Sourcepub fn remaining_hops(&self) -> u8
pub fn remaining_hops(&self) -> u8
Get remaining hops
Sourcepub fn relay(&self) -> Option<Self>
pub fn relay(&self) -> Option<Self>
Create a relay copy with incremented hop count
Returns None if TTL expired.
Sourcepub fn is_relay_envelope(data: &[u8]) -> bool
pub fn is_relay_envelope(data: &[u8]) -> bool
Check if data starts with relay envelope marker
Trait Implementations§
Source§impl Clone for RelayEnvelope
impl Clone for RelayEnvelope
Source§fn clone(&self) -> RelayEnvelope
fn clone(&self) -> RelayEnvelope
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for RelayEnvelope
impl RefUnwindSafe for RelayEnvelope
impl Send for RelayEnvelope
impl Sync for RelayEnvelope
impl Unpin for RelayEnvelope
impl UnwindSafe for RelayEnvelope
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more