pub struct NetinfoCell {
pub timestamp: DateTime<Utc>,
pub receiver_address: Address,
pub sender_addresses: Vec<Address>,
pub unused: Vec<u8>,
}Expand description
Network information exchange cell.
NETINFO cells are exchanged after version negotiation to share time and address information. This helps relays detect clock skew and verify connectivity.
§Wire Format
Fixed-size cell:
[ CircID (0) ][ 8 (NETINFO) ][ Timestamp (4) ][ Receiver Addr ][ Sender Count ][ Sender Addrs ]§Example
use stem_rs::client::cell::NetinfoCell;
use stem_rs::client::datatype::{Address, LinkProtocol};
let receiver = Address::new("127.0.0.1").unwrap();
let cell = NetinfoCell::new(receiver, vec![], None);Fields§
§timestamp: DateTime<Utc>Current timestamp from the sender.
receiver_address: AddressThe receiver’s address as seen by the sender.
sender_addresses: Vec<Address>The sender’s own addresses.
unused: Vec<u8>Unused padding bytes.
Implementations§
Source§impl NetinfoCell
impl NetinfoCell
Sourcepub fn new(
receiver_address: Address,
sender_addresses: Vec<Address>,
timestamp: Option<DateTime<Utc>>,
) -> Self
pub fn new( receiver_address: Address, sender_addresses: Vec<Address>, timestamp: Option<DateTime<Utc>>, ) -> Self
Creates a new NETINFO cell.
§Arguments
receiver_address- The receiver’s address as seen by sendersender_addresses- The sender’s own addressestimestamp- Optional timestamp (defaults to current time)
Trait Implementations§
Source§impl Clone for NetinfoCell
impl Clone for NetinfoCell
Source§fn clone(&self) -> NetinfoCell
fn clone(&self) -> NetinfoCell
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 moreSource§impl Debug for NetinfoCell
impl Debug for NetinfoCell
Source§impl PartialEq for NetinfoCell
impl PartialEq for NetinfoCell
impl StructuralPartialEq for NetinfoCell
Auto Trait Implementations§
impl Freeze for NetinfoCell
impl RefUnwindSafe for NetinfoCell
impl Send for NetinfoCell
impl Sync for NetinfoCell
impl Unpin for NetinfoCell
impl UnwindSafe for NetinfoCell
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