pub trait Outbound<N: Network>: Writing<Message = Message<N>> {
    // Required method
    fn router(&self) -> &Router<N>;

    // Provided methods
    fn send_ping(
        &self,
        peer_ip: SocketAddr,
        block_locators: Option<BlockLocators<N>>
    ) { ... }
    fn send(
        &self,
        peer_ip: SocketAddr,
        message: Message<N>
    ) -> Option<Receiver<Result<()>>> { ... }
    fn propagate(&self, message: Message<N>, excluded_peers: &[SocketAddr]) { ... }
    fn propagate_to_beacons(
        &self,
        message: Message<N>,
        excluded_peers: &[SocketAddr]
    ) { ... }
    fn propagate_to_validators(
        &self,
        message: Message<N>,
        excluded_peers: &[SocketAddr]
    ) { ... }
    fn can_send(&self, peer_ip: SocketAddr, message: &Message<N>) -> bool { ... }
}

Required Methods§

source

fn router(&self) -> &Router<N>

Returns a reference to the router.

Provided Methods§

source

fn send_ping( &self, peer_ip: SocketAddr, block_locators: Option<BlockLocators<N>> )

Sends a “Ping” message to the given peer.

source

fn send( &self, peer_ip: SocketAddr, message: Message<N> ) -> Option<Receiver<Result<()>>>

Sends the given message to specified peer.

This function returns as soon as the message is queued to be sent, without waiting for the actual delivery; instead, the caller is provided with a oneshot::Receiver which can be used to determine when and whether the message has been delivered.

source

fn propagate(&self, message: Message<N>, excluded_peers: &[SocketAddr])

Sends the given message to every connected peer, excluding the sender and any specified peer IPs.

source

fn propagate_to_beacons( &self, message: Message<N>, excluded_peers: &[SocketAddr] )

Sends the given message to every connected beacon, excluding the sender and any specified IPs.

source

fn propagate_to_validators( &self, message: Message<N>, excluded_peers: &[SocketAddr] )

Sends the given message to every connected validator, excluding the sender and any specified IPs.

source

fn can_send(&self, peer_ip: SocketAddr, message: &Message<N>) -> bool

Returns true if the message can be sent.

Implementors§