pub struct RelayConn { /* private fields */ }
Expand description
A connection to a relay server.
Cheaply clonable.
Call close
to shut down the write loop and read functionality.
Implementations§
Source§impl Conn
impl Conn
Sourcepub async fn send(&self, dstkey: PublicKey, packet: Bytes) -> Result<()>
👎Deprecated: This crate has been renamed from ‘iroh-net’ to ‘iroh’, please use the new crate
pub async fn send(&self, dstkey: PublicKey, packet: Bytes) -> Result<()>
Sends a packet to the node identified by dstkey
Errors if the packet is larger than MAX_PACKET_SIZE
Sourcepub async fn send_ping(&self, data: [u8; 8]) -> Result<()>
👎Deprecated: This crate has been renamed from ‘iroh-net’ to ‘iroh’, please use the new crate
pub async fn send_ping(&self, data: [u8; 8]) -> Result<()>
Send a ping with 8 bytes of random data.
Sourcepub async fn send_pong(&self, data: [u8; 8]) -> Result<()>
👎Deprecated: This crate has been renamed from ‘iroh-net’ to ‘iroh’, please use the new crate
pub async fn send_pong(&self, data: [u8; 8]) -> Result<()>
Respond to a ping request. The data
field should be filled
by the 8 bytes of random data send by the ping.
Sourcepub async fn note_preferred(&self, preferred: bool) -> Result<()>
👎Deprecated: This crate has been renamed from ‘iroh-net’ to ‘iroh’, please use the new crate
pub async fn note_preferred(&self, preferred: bool) -> Result<()>
Sends a packet that tells the server whether this connection is to the user’s preferred server. This is only used in the server for stats.
Sourcepub fn local_addr(&self) -> Option<SocketAddr>
👎Deprecated: This crate has been renamed from ‘iroh-net’ to ‘iroh’, please use the new crate
pub fn local_addr(&self) -> Option<SocketAddr>
The local address that the Conn
is listening on.
None
, when run in a testing environment or when using websockets.
Sourcepub fn is_closed(&self) -> bool
👎Deprecated: This crate has been renamed from ‘iroh-net’ to ‘iroh’, please use the new crate
pub fn is_closed(&self) -> bool
Sourcepub async fn close(&self)
👎Deprecated: This crate has been renamed from ‘iroh-net’ to ‘iroh’, please use the new crate
pub async fn close(&self)
Close the connection
Shuts down the write loop directly and marks the connection as closed. The Conn
will
check if the it is closed before attempting to read from it.
Trait Implementations§
impl Eq for Conn
Auto Trait Implementations§
impl Freeze for Conn
impl RefUnwindSafe for Conn
impl Send for Conn
impl Sync for Conn
impl Unpin for Conn
impl UnwindSafe for Conn
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.