pub struct ProtocolHandler { /* private fields */ }Expand description
P2P protocol handler
Implementations§
Source§impl ProtocolHandler
impl ProtocolHandler
Sourcepub fn create_version_message(
&self,
peer_addr: IpAddr,
peer_port: u16,
) -> VersionMessage
pub fn create_version_message( &self, peer_addr: IpAddr, peer_port: u16, ) -> VersionMessage
Create a version message
Sourcepub fn write_message<W: Write>(
&self,
writer: &mut W,
message: &Message,
) -> Result<()>
pub fn write_message<W: Write>( &self, writer: &mut W, message: &Message, ) -> Result<()>
Write a message to a writer
Sourcepub fn read_header<R: Read>(&self, reader: &mut R) -> Result<MessageHeader>
pub fn read_header<R: Read>(&self, reader: &mut R) -> Result<MessageHeader>
Read a message header from a reader
Sourcepub fn read_payload<R: Read>(
&self,
reader: &mut R,
header: &MessageHeader,
) -> Result<Vec<u8>>
pub fn read_payload<R: Read>( &self, reader: &mut R, header: &MessageHeader, ) -> Result<Vec<u8>>
Read a message payload
Auto Trait Implementations§
impl Freeze for ProtocolHandler
impl RefUnwindSafe for ProtocolHandler
impl Send for ProtocolHandler
impl Sync for ProtocolHandler
impl Unpin for ProtocolHandler
impl UnwindSafe for ProtocolHandler
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