Skip to main content

Resolver

Struct Resolver 

Source
pub struct Resolver<T: HttpTransport + ?Sized> { /* private fields */ }
Expand description

A URN resolver over an injected HttpTransport. The ladder plan and verified results are cached per instance.

Implementations§

Source§

impl<T: HttpTransport> Resolver<T>

Source

pub fn new(transport: T) -> Self

Build a resolver with default options.

Source

pub fn with_options(transport: T, options: ResolveOptions) -> Self

Build a resolver with explicit options.

Source§

impl<T: HttpTransport + ?Sized> Resolver<T>

Source

pub fn connect_url(&self) -> &str

The connect-CTA URL for the unreachable page.

Source

pub async fn resolve(&self, urn: &str) -> Result<ResolveOutcome>

Resolve a DIG URN to a typed ResolveOutcome.

A cache layer sits IN FRONT of the network resolve but never weakens fail-closed: a memory hit is process-trusted (only holds what this process already verified); a disk hit is RE-VERIFIED against the URN’s root (a tampered file → IntegrityFailure). Only verified Success bytes are cached.

On a miss it walks the ladder plan, falling through to the next tier on genuine ABSENCE or unreachability but NEVER on an integrity failure:

  • a tier’s NOT-FOUND (content absent here) falls through; every tier not-found → one branded ResolveError::NotFound (the stranger’s common case: the local node lacks it, the public gateway serves it).
  • a tier’s TRANSPORT failure falls through; the LAST tier transport-unreachable → ResolveOutcome::Unreachable.
  • a verify/decrypt failure at ANY tier → ResolveOutcome::IntegrityFailure IMMEDIATELY, aborting the whole ladder (never cascaded/masked/retried — a tampered tier must not become a silent retry on another, §5.4 fail-closed).
  • a malformed URN / reachable rpc protocol error → a hard Err.
Source

pub async fn resolve_rendered(&self, urn: &str) -> Result<ResolvedData>

Convenience for the webview/image path: resolve, then RENDER — verified content for a success, or the appropriate branded text/html page for a non-success outcome. An integrity failure renders the security page, NEVER the unverified bytes.

Auto Trait Implementations§

§

impl<T> !Freeze for Resolver<T>

§

impl<T> !RefUnwindSafe for Resolver<T>

§

impl<T> !Sync for Resolver<T>

§

impl<T> Send for Resolver<T>
where T: Send + ?Sized,

§

impl<T> Unpin for Resolver<T>
where T: Unpin + ?Sized,

§

impl<T> UnsafeUnpin for Resolver<T>
where T: UnsafeUnpin + ?Sized,

§

impl<T> UnwindSafe for Resolver<T>
where T: UnwindSafe + ?Sized,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more