pub struct HttpClient { /* private fields */ }
Expand description
An HTTP Relay client.
Cheaply clonable.
Implementations§
Source§impl Client
impl Client
Sourcepub fn public_key(&self) -> PublicKey
👎Deprecated: This crate has been renamed from ‘iroh-net’ to ‘iroh’, please use the new crate
pub fn public_key(&self) -> PublicKey
The public key for this client
Sourcepub async fn connect(&self) -> Result<Conn, ClientError>
👎Deprecated: This crate has been renamed from ‘iroh-net’ to ‘iroh’, please use the new crate
pub async fn connect(&self) -> Result<Conn, ClientError>
Connects to a relay Server and returns the underlying relay connection.
Returns ClientError::Closed
if the Client
is closed.
If there is already an active relay connection, returns the already
connected crate::relay::RelayConn
.
Sourcepub async fn note_preferred(&self, is_preferred: bool)
👎Deprecated: This crate has been renamed from ‘iroh-net’ to ‘iroh’, please use the new crate
pub async fn note_preferred(&self, is_preferred: bool)
Let the server know that this client is the preferred client
Sourcepub async fn local_addr(&self) -> Option<SocketAddr>
👎Deprecated: This crate has been renamed from ‘iroh-net’ to ‘iroh’, please use the new crate
pub async fn local_addr(&self) -> Option<SocketAddr>
Get the local addr of the connection. If there is no current underlying relay connection
or the Client
is closed, returns None
.
Sourcepub async fn ping(&self) -> Result<Duration, ClientError>
👎Deprecated: This crate has been renamed from ‘iroh-net’ to ‘iroh’, please use the new crate
pub async fn ping(&self) -> Result<Duration, ClientError>
Send a ping to the server. Return once we get an expected pong.
There must be a task polling recv_detail
to process the pong
response.
Sourcepub async fn send_pong(&self, data: [u8; 8]) -> Result<(), ClientError>
👎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<(), ClientError>
Send a pong back to the server.
If there is no underlying active relay connection, it creates one before attempting to send the pong message.
If there is an error sending pong, it closes the underlying relay connection before returning.
Sourcepub async fn send(
&self,
dst_key: PublicKey,
b: Bytes,
) -> Result<(), ClientError>
👎Deprecated: This crate has been renamed from ‘iroh-net’ to ‘iroh’, please use the new crate
pub async fn send( &self, dst_key: PublicKey, b: Bytes, ) -> Result<(), ClientError>
Send a packet to the server.
If there is no underlying active relay connection, it creates one before attempting to send the message.
If there is an error sending the packet, it closes the underlying relay connection before returning.
Sourcepub async fn close(self) -> Result<(), ClientError>
👎Deprecated: This crate has been renamed from ‘iroh-net’ to ‘iroh’, please use the new crate
pub async fn close(self) -> Result<(), ClientError>
Close the http relay connection.
Sourcepub async fn close_for_reconnect(&self) -> Result<(), ClientError>
👎Deprecated: This crate has been renamed from ‘iroh-net’ to ‘iroh’, please use the new crate
pub async fn close_for_reconnect(&self) -> Result<(), ClientError>
Disconnect the http relay connection.
Sourcepub async fn is_connected(&self) -> Result<bool, ClientError>
👎Deprecated: This crate has been renamed from ‘iroh-net’ to ‘iroh’, please use the new crate
pub async fn is_connected(&self) -> Result<bool, ClientError>
Returns true
if the underlying relay connection is established.