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: boolMaster 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: DurationPer-request timeout (SOF_RESOLVE_TIMEOUT_MS).
max_fetches: usizeHard cap on total fetches per run (SOF_RESOLVE_MAX_FETCHES).
max_depth: usizeBounded prefetch rounds for chained references (SOF_RESOLVE_MAX_DEPTH).
max_response_bytes: usizeMaximum accepted response size in bytes (SOF_RESOLVE_MAX_RESPONSE_BYTES).
concurrency: usizeMaximum 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: boolAllow 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: usizeMaximum 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
impl RemoteResolveConfig
Sourcepub fn from_env() -> Self
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.
Sourcepub fn from_env_with(get: impl Fn(&str) -> Option<String>) -> Self
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.
Sourcepub fn bearer_for_host(&self, host: &str) -> Option<&str>
pub fn bearer_for_host(&self, host: &str) -> Option<&str>
Returns the bearer token configured for host, if any (case-insensitive).
Sourcepub fn is_active(&self) -> bool
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.
Sourcepub fn fetch_decision(&self, reference: &str) -> FetchDecision
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
impl Clone for RemoteResolveConfig
Source§fn clone(&self) -> RemoteResolveConfig
fn clone(&self) -> RemoteResolveConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RemoteResolveConfig
impl Debug for RemoteResolveConfig
Auto Trait Implementations§
impl Freeze for RemoteResolveConfig
impl RefUnwindSafe for RemoteResolveConfig
impl Send for RemoteResolveConfig
impl Sync for RemoteResolveConfig
impl Unpin for RemoteResolveConfig
impl UnsafeUnpin for RemoteResolveConfig
impl UnwindSafe for RemoteResolveConfig
Blanket Implementations§
impl<T> Allocation for T
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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