pub struct IpfsGatewayResolver { /* private fields */ }Expand description
Resolves DID documents via an IPFS/IPNS HTTP gateway.
The gateway must serve DID documents at /ipns/<key-id>.
Cached document bytes and negative outcomes expire on independent TTLs.
Implementations§
Source§impl IpfsGatewayResolver
impl IpfsGatewayResolver
Sourcepub fn public_default() -> Self
pub fn public_default() -> Self
Build a public-gateway resolver with no localhost probing.
Sourcepub fn new(gateway_url: impl Into<String>) -> Self
pub fn new(gateway_url: impl Into<String>) -> Self
Build a resolver using the caller-provided primary gateway followed by
the standard public fallbacks. Localhost is used only if gateway_url
itself points at localhost.
Sourcepub fn local_first(gateway_url: impl Into<String>) -> Self
pub fn local_first(gateway_url: impl Into<String>) -> Self
Build a local-first resolver: localhost, then the caller-provided primary gateway, then the standard public fallbacks.
Sourcepub fn pool(&self) -> &GatewayPool
pub fn pool(&self) -> &GatewayPool
The underlying gateway pool, for generic content fetches.
pub fn with_cache_ttls( self, positive_ttl: Duration, negative_ttl: Duration, ) -> Self
Sourcepub fn with_base_cooldown(self, cooldown: Duration) -> Self
pub fn with_base_cooldown(self, cooldown: Duration) -> Self
Override the base per-gateway failure cooldown. The cooldown
escalates Fibonacci-style per consecutive failure and resets on
success. Duration::ZERO disables cooldowns entirely.
Sourcepub fn with_request_timeout(self, timeout: Duration) -> Self
pub fn with_request_timeout(self, timeout: Duration) -> Self
Override the per-request timeout (default 6 seconds). Covers the whole request, connection through body transfer.
Sourcepub fn set_request_timeout(&self, timeout: Option<Duration>)
pub fn set_request_timeout(&self, timeout: Option<Duration>)
Update the per-request timeout at runtime.
Pass None to revert to the 6-second built-in default.
Sourcepub async fn resolve_ipns_path(&self, path: &str) -> Result<String>
pub async fn resolve_ipns_path(&self, path: &str) -> Result<String>
Resolve an /ipns/<name> reference to its current /ipfs/<cid> path.
Trait Implementations§
Source§impl Default for IpfsGatewayResolver
impl Default for IpfsGatewayResolver
Source§impl DidDocumentResolver for IpfsGatewayResolver
impl DidDocumentResolver for IpfsGatewayResolver
fn resolve<'life0, 'life1, 'async_trait>(
&'life0 self,
did: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Document>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§impl From<GatewayPool> for IpfsGatewayResolver
impl From<GatewayPool> for IpfsGatewayResolver
Source§fn from(pool: GatewayPool) -> Self
fn from(pool: GatewayPool) -> Self
Auto Trait Implementations§
impl !Freeze for IpfsGatewayResolver
impl !RefUnwindSafe for IpfsGatewayResolver
impl !UnwindSafe for IpfsGatewayResolver
impl Send for IpfsGatewayResolver
impl Sync for IpfsGatewayResolver
impl Unpin for IpfsGatewayResolver
impl UnsafeUnpin for IpfsGatewayResolver
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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