[][src]Struct quic_p2p::QuicP2p

pub struct QuicP2p { /* fields omitted */ }

Main QuicP2p instance to communicate with QuicP2p


impl QuicP2p[src]

pub fn bootstrap(&mut self)[src]

Bootstrap to the network.

Bootstrap concept is different from "connect" in several ways: bootstrap() will try to connect to all peers which are specified in the config (hard_coded_contacts) or were previously cached. If one bootstrap connection succeeds, all other connections will be dropped.

In case of success Event::BootstrapedTo will be fired. On error quic-p2p will fire Event::BootstrapFailure.

pub fn connect_to(&mut self, peer_info: NodeInfo)[src]

Connect to the given peer. This will error out if the peer is already in the process of being connected to OR for any other connection failure reasons.

pub fn disconnect_from(&mut self, peer_addr: SocketAddr)[src]

Disconnect from the given peer

pub fn send(&mut self, peer: Peer, msg: Bytes, token: Token)[src]

Send message to peer.

If the peer is not connected, it will attempt to connect to it first and then send the message. This can be called multiple times while the peer is still being connected to - all the sends will be buffered until the peer is connected to.

token is supplied by the user code and will be returned with the message to help identify the context, for successful or unsuccessful sends.

pub fn our_connection_info(&mut self) -> R<NodeInfo>[src]

Get our connection info to give to others for them to connect to us

Will use hard coded contacts to ask for our endpoint. If no contact is given then we'll simply build our connection info by querying the underlying bound socket for our address. Note that if such an obtained address is of unspecified category we will ignore that as such an address cannot be reached and hence not useful.

pub fn bootstrap_cache(&mut self) -> R<Vec<NodeInfo>>[src]

Retrieves current node bootstrap cache.

pub fn is_hard_coded_contact(&self, node_info: &NodeInfo) -> bool[src]

Checks whether the given contact is hard-coded.

Auto Trait Implementations

impl Unpin for QuicP2p

impl Sync for QuicP2p

impl Send for QuicP2p

impl !RefUnwindSafe for QuicP2p

impl !UnwindSafe for QuicP2p

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized

impl<T> BorrowMut<T> for T where
    T: ?Sized

impl<T> Any for T where
    T: 'static + ?Sized

impl<T> Erased for T