pub struct PexMessage {
pub added: Vec<PexPeer>,
pub added6: Vec<PexPeer>,
pub dropped: Vec<SocketAddr>,
pub dropped6: Vec<SocketAddr>,
}Expand description
A PEX message containing peer updates.
Messages track both IPv4 and IPv6 peers separately.
Fields§
§added: Vec<PexPeer>IPv4 peers to add.
added6: Vec<PexPeer>IPv6 peers to add.
dropped: Vec<SocketAddr>IPv4 peers that disconnected.
dropped6: Vec<SocketAddr>IPv6 peers that disconnected.
Implementations§
Source§impl PexMessage
impl PexMessage
pub fn new() -> Self
pub fn add_peer(&mut self, peer: PexPeer)
pub fn drop_peer(&mut self, addr: SocketAddr)
pub fn is_empty(&self) -> bool
pub fn encode_added(&self) -> Bytes
pub fn encode_added_flags(&self) -> Bytes
pub fn encode_added6(&self) -> Bytes
pub fn encode_added6_flags(&self) -> Bytes
pub fn encode_dropped(&self) -> Bytes
pub fn encode_dropped6(&self) -> Bytes
pub fn decode_added(data: &[u8], flags: &[u8]) -> Vec<PexPeer>
pub fn decode_added6(data: &[u8], flags: &[u8]) -> Vec<PexPeer>
pub fn decode_dropped(data: &[u8]) -> Vec<SocketAddr>
pub fn decode_dropped6(data: &[u8]) -> Vec<SocketAddr>
Trait Implementations§
Source§impl Clone for PexMessage
impl Clone for PexMessage
Source§fn clone(&self) -> PexMessage
fn clone(&self) -> PexMessage
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 PexMessage
impl Debug for PexMessage
Source§impl Default for PexMessage
impl Default for PexMessage
Source§fn default() -> PexMessage
fn default() -> PexMessage
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for PexMessage
impl RefUnwindSafe for PexMessage
impl Send for PexMessage
impl Sync for PexMessage
impl Unpin for PexMessage
impl UnwindSafe for PexMessage
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