[−][src]Struct quic_p2p::QuicP2p
Main QuicP2p instance to communicate with QuicP2p
Methods
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)
[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.
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.
Auto Trait Implementations
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,