Skip to main content

RemoteResolveConfig

Struct RemoteResolveConfig 

Source
pub struct RemoteResolveConfig {
    pub enabled: bool,
    pub allowed_base_urls: Vec<AllowedBaseUrl>,
    pub timeout: Duration,
    pub max_fetches: usize,
    pub max_depth: usize,
    pub max_response_bytes: usize,
    pub concurrency: usize,
    pub bearer_tokens: HashMap<String, String>,
    pub allow_private_addresses: bool,
    pub cache_max_entries: usize,
}
Expand description

Configuration for remote (trusted-server) resolve().

Defaults are off: an empty/default config never permits a fetch. Build one from the process environment with RemoteResolveConfig::from_env.

Fields§

§enabled: bool

Master switch (SOF_RESOLVE_REMOTE). When false, nothing is ever fetched.

§allowed_base_urls: Vec<AllowedBaseUrl>

Trusted base URLs that references must match to be fetchable.

§timeout: Duration

Per-request timeout (SOF_RESOLVE_TIMEOUT_MS).

§max_fetches: usize

Hard cap on total fetches per run (SOF_RESOLVE_MAX_FETCHES).

§max_depth: usize

Bounded prefetch rounds for chained references (SOF_RESOLVE_MAX_DEPTH).

§max_response_bytes: usize

Maximum accepted response size in bytes (SOF_RESOLVE_MAX_RESPONSE_BYTES).

§concurrency: usize

Maximum concurrent fetches (SOF_RESOLVE_CONCURRENCY).

§bearer_tokens: HashMap<String, String>

Optional per-host bearer tokens (SOF_RESOLVE_AUTH), keyed by lowercased host. Sent only on requests to that exact (already-allowlisted) host.

§allow_private_addresses: bool

Allow allowlisted hostnames to resolve to private/internal addresses — RFC1918 (10/8, 172.16/12, 192.168/16) and IPv6 ULA (fc00::/7) (SOF_RESOLVE_ALLOW_PRIVATE_ADDRESSES, default false).

Needed for internal deployments where references point at an internal load balancer / reverse proxy (e.g. Traefik) by hostname. Even when true, the always-blocked ranges (loopback, link-local incl. cloud metadata, multicast, broadcast, unspecified, CGNAT, reserved) remain refused — see is_blocked_address.

§cache_max_entries: usize

Maximum entries in the cross-chunk fetched-resource cache used by the streaming path (SOF_RESOLVE_CACHE_MAX_ENTRIES). The cache (LRU, with negative caching of misses) lets a reference recurring across chunks be fetched once; bounding it keeps streaming memory bounded — evicted-then- reused references are re-fetched. Ignored by the single-Bundle path, which holds all references in one pass.

Implementations§

Source§

impl RemoteResolveConfig

Source

pub fn from_env() -> Self

Builds the configuration from the process environment.

Malformed numeric values fall back to their defaults (with a tracing warning); malformed allowlist entries are skipped individually.

Source

pub fn from_env_with(get: impl Fn(&str) -> Option<String>) -> Self

Builds the configuration from an arbitrary environment lookup.

Exposed so the parsing logic can be unit-tested without touching the process-global environment.

Source

pub fn bearer_for_host(&self, host: &str) -> Option<&str>

Returns the bearer token configured for host, if any (case-insensitive).

Source

pub fn is_active(&self) -> bool

Whether remote resolution can fetch anything at all (enabled and the allowlist is non-empty). When false, Self::fetch_decision always denies.

Source

pub fn fetch_decision(&self, reference: &str) -> FetchDecision

Decides whether reference may be fetched from a trusted server.

This is the single gate enforcing the default-deny policy. It performs no I/O and no DNS resolution.

Trait Implementations§

Source§

impl Clone for RemoteResolveConfig

Source§

fn clone(&self) -> RemoteResolveConfig

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RemoteResolveConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for RemoteResolveConfig

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<'src, T> IntoMaybe<'src, T> for T
where T: 'src,

Source§

type Proj<U: 'src> = U

Source§

fn map_maybe<R>( self, _f: impl FnOnce(&'src T) -> &'src R, g: impl FnOnce(T) -> R, ) -> <T as IntoMaybe<'src, T>>::Proj<R>
where R: 'src,

Source§

impl<T> OrderedSeq<'_, T> for T
where T: Clone,

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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<'p, T> Seq<'p, T> for T
where T: Clone,

Source§

type Item<'a> = &'a T where T: 'a

The item yielded by the iterator.
Source§

type Iter<'a> = Once<&'a T> where T: 'a

An iterator over the items within this container, by reference.
Source§

fn seq_iter(&self) -> <T as Seq<'p, T>>::Iter<'_>

Iterate over the elements of the container.
Source§

fn contains(&self, val: &T) -> bool
where T: PartialEq,

Check whether an item is contained within this sequence.
Source§

fn to_maybe_ref<'b>(item: <T as Seq<'p, T>>::Item<'b>) -> Maybe<T, &'p T>
where 'p: 'b,

Convert an item of the sequence into a MaybeRef.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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