Trait bip_handshake::Handshaker
[−]
[src]
pub trait Handshaker: Send { type MetadataEnvelope: Send; fn id(&self) -> PeerId; fn port(&self) -> u16; fn connect(&mut self, expected: Option<PeerId>, hash: InfoHash, addr: SocketAddr); fn metadata(&mut self, data: Self::MetadataEnvelope); }
Trait for peer discovery services to forward peer contact information and metadata.
Associated Types
type MetadataEnvelope: Send
Type that metadata will be passed back to the client as.
Required Methods
fn id(&self) -> PeerId
PeerId exposed to peer discovery services.
fn port(&self) -> u16
Port exposed to peer discovery services.
It is important that this is the external port that the peer will be sending data to. This is relevant if the client employs nat traversal via upnp or other means.
fn connect(&mut self, expected: Option<PeerId>, hash: InfoHash, addr: SocketAddr)
Connect to the given address with the InfoHash and expecting the PeerId.
fn metadata(&mut self, data: Self::MetadataEnvelope)
Send the given Metadata back to the client.
Implementors
impl<T> Handshaker for BTHandshaker<T> where T: Send