pub struct Client { /* private fields */ }
Expand description
Iroh net Client.
Cheaply clonable and threadsafe. Use the iroh net::Client
to access the
iroh net methods from a different thread, process, or remote machine.
The node::Client
api allows you to get information about the iroh node,
its status, and connection status to other nodes. It also allows you to
provide address information about other nodes to your node.
Implementations§
Source§impl Client
impl Client
Sourcepub fn new(rpc: RpcClient<RpcService>) -> Self
pub fn new(rpc: RpcClient<RpcService>) -> Self
Creates a new net client
Sourcepub async fn remote_info_iter(
&self,
) -> Result<impl Stream<Item = Result<RemoteInfo>>>
pub async fn remote_info_iter( &self, ) -> Result<impl Stream<Item = Result<RemoteInfo>>>
Fetches information about currently known remote nodes.
This streams a current snapshot. It does not keep the stream open after finishing transferring the snapshot.
See also Endpoint::remote_info_iter
.
Sourcepub async fn remote_info(&self, node_id: NodeId) -> Result<Option<RemoteInfo>>
pub async fn remote_info(&self, node_id: NodeId) -> Result<Option<RemoteInfo>>
Fetches node information about a remote iroh node identified by its NodeId
.
See also Endpoint::remote_info
.
Sourcepub async fn node_id(&self) -> Result<NodeId>
pub async fn node_id(&self) -> Result<NodeId>
Fetches the node id of this node.
See also Endpoint::node_id
.
Sourcepub async fn node_addr(&self) -> Result<NodeAddr>
pub async fn node_addr(&self) -> Result<NodeAddr>
Fetches the NodeAddr
for this node.
See also Endpoint::node_addr
.
Sourcepub async fn add_node_addr(&self, addr: NodeAddr) -> Result<()>
pub async fn add_node_addr(&self, addr: NodeAddr) -> Result<()>
Adds a known node address to this node.
See also Endpoint::add_node_addr
.
Sourcepub async fn home_relay(&self) -> Result<Option<RelayUrl>>
pub async fn home_relay(&self) -> Result<Option<RelayUrl>>
Returns the relay server we are connected to.
See also Endpoint::home_relay
.