pub struct Client { /* private fields */ }Expand description
Client is the main handle for interacting with iroh-services. It communicates with
iroh-services entirely through an iroh endpoint, and is configured through a builder.
Client requires either an Ssh Key or ApiSecret
use iroh_services::Client;
async fn build_client() -> anyhow::Result<()> {
let endpoint = iroh::Endpoint::bind().await?;
// needs IROH_SERVICES_API_SECRET set to an environment variable
// client will now push endpoint metrics to iroh-services.
let client = Client::builder(&endpoint)
.api_secret_from_str("MY_API_SECRET")?
.build()
.await;
Ok(())
}Implementations§
Source§impl Client
impl Client
pub fn builder(endpoint: &Endpoint) -> ClientBuilder
Sourcepub async fn push_metrics(&self) -> Result<(), Error>
pub async fn push_metrics(&self) -> Result<(), Error>
immediately send a single dump of metrics to iroh-services. It’s not necessary to call this function if you’re using a non-zero metrics interval, which will automatically propagate metrics on the set interval for you
Sourcepub async fn grant_capability(
&self,
remote_id: EndpointId,
caps: impl IntoIterator<Item = impl Into<Cap>>,
) -> Result<(), Error>
pub async fn grant_capability( &self, remote_id: EndpointId, caps: impl IntoIterator<Item = impl Into<Cap>>, ) -> Result<(), Error>
Grant capabilities to a remote endpoint. Creates a signed RCAN token and sends it to iroh-services for storage. The remote can then use this token when dialing back to authorize its requests.
Sourcepub async fn net_diagnostics(
&self,
send: bool,
) -> Result<DiagnosticsReport, Error>
pub async fn net_diagnostics( &self, send: bool, ) -> Result<DiagnosticsReport, Error>
run local network status diagnostics, optionally uploading the results
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Client
impl !RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl !UnwindSafe for Client
Blanket Implementations§
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