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<()>
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<()>
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<()>
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<()>
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>
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.
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)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
Compare self to
key
and return true
if they are equal.