pub struct ClientBuilder { /* private fields */ }Expand description
ClientBuilder provides configures and builds a iroh-services client, typically
created with Client::builder
Implementations§
Source§impl ClientBuilder
impl ClientBuilder
pub fn new(endpoint: &Endpoint) -> Self
Sourcepub fn register_metrics_group(
self,
metrics_group: Arc<dyn MetricsGroup>,
) -> Self
pub fn register_metrics_group( self, metrics_group: Arc<dyn MetricsGroup>, ) -> Self
Register a metrics group to forward to iroh-services
The default registered metrics uses only the endpoint
Sourcepub fn metrics_interval(self, interval: Duration) -> Self
pub fn metrics_interval(self, interval: Duration) -> Self
Set the metrics collection interval
Defaults to enabled, every 60 seconds.
Sourcepub fn disable_metrics_interval(self) -> Self
pub fn disable_metrics_interval(self) -> Self
Disable metrics collection.
Sourcepub fn name(self, name: impl Into<String>) -> Result<Self>
pub fn name(self, name: impl Into<String>) -> Result<Self>
Set an optional human-readable name for the endpoint the client is constructed with, making metrics from this endpoint easier to identify. This is often used for associating with other services in your app, like a database user id, machine name, permanent username, etc.
When this builder method is called, the provided name is sent after the
client initially authenticates the endpoint server-side.
Errors will not interrupt client construction, instead producing a
warn-level log. For explicit error handling, use Client::set_name.
names can be any UTF-8 string, with a min length of 2 bytes, and maximum length of 128 bytes. name uniqueness is not enforced server-side, which means using the same name for different endpoints will not produce an error
Sourcepub fn api_secret_from_env(self) -> Result<Self>
pub fn api_secret_from_env(self) -> Result<Self>
Check IROH_SERVICES_API_SECRET environment variable for a valid API secret
Sourcepub fn api_secret_from_str(self, secret_key: &str) -> Result<Self>
pub fn api_secret_from_str(self, secret_key: &str) -> Result<Self>
set client API secret from an encoded string
Sourcepub fn api_secret(self, ticket: ApiSecret) -> Result<Self>
pub fn api_secret(self, ticket: ApiSecret) -> Result<Self>
Use a shared secret & remote iroh-services endpoint ID contained within a ticket to construct a iroh-services client. The resulting client will have “Client” capabilities.
API secrets include remote details within them, and will set both the remote and rcan values on the builder
Sourcepub async fn ssh_key_from_file<P: AsRef<Path>>(self, path: P) -> Result<Self>
pub async fn ssh_key_from_file<P: AsRef<Path>>(self, path: P) -> Result<Self>
Loads the private ssh key from the given path, and creates the needed capability.
Sourcepub fn ssh_key(self, key: &PrivateKey) -> Result<Self>
pub fn ssh_key(self, key: &PrivateKey) -> Result<Self>
Creates the capability from the provided private ssh key.
Auto Trait Implementations§
impl Freeze for ClientBuilder
impl !RefUnwindSafe for ClientBuilder
impl Send for ClientBuilder
impl Sync for ClientBuilder
impl Unpin for ClientBuilder
impl !UnwindSafe for ClientBuilder
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more