[−][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, node_addr: SocketAddr)
[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<SocketAddr>
[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<SocketAddr>>
[src]
Retrieves current node bootstrap cache.
pub fn is_hard_coded_contact(&self, node_addr: &SocketAddr) -> bool
[src]
Checks whether the given contact is hard-coded.
pub fn config(&self) -> Config
[src]
Returns a copy of the Config
used to create this QuicP2p
.
Auto Trait Implementations
impl !RefUnwindSafe for QuicP2p
impl Send for QuicP2p
impl Sync for QuicP2p
impl Unpin for QuicP2p
impl !UnwindSafe for QuicP2p
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
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<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,