Trait bip_handshake::HandshakeFilter [] [src]

pub trait HandshakeFilter {
    fn as_any(&self) -> &Any;

    fn on_addr(&self, opt_addr: Option<&SocketAddr>) -> FilterDecision { ... }
fn on_prot(&self, opt_prot: Option<&Protocol>) -> FilterDecision { ... }
fn on_ext(&self, opt_ext: Option<&Extensions>) -> FilterDecision { ... }
fn on_hash(&self, opt_hash: Option<&InfoHash>) -> FilterDecision { ... }
fn on_pid(&self, opt_pid: Option<&PeerId>) -> FilterDecision { ... } }

Trait for filtering connections during handshaking.

By default, all methods will return FilterDecision::Pass so that implementers filtering on only a few fields only have to implement the methods for those fields. Option is passed because some filters may be able to block peers before a connection is made, if data is required, return FilterDecision::NeedData when None is passed.

In order for a handshake to pass the filter, each field has to be either not blocked, or effectively "whitelisted" (see FilterDecision::Allow).

Required Methods

Used to implement generic equality.

Should typically just return self.

Provided Methods

Make a filter decision based on the peer SocketAddr.

Make a filter decision based on the handshake Protocol.

Make a filter decision based on the Extensions.

Make a filter decision based on the InfoHash.

Make a filter decision based on the PeerId.

Implementors