Expand description
Configuration: defaults, XDG TOML, CLI override (no product env knobs).
Split for SRP: constants, validate, load (paths + TOML + Config).
Re-exports§
pub use crate::domain::is_stdlib_name as is_stdlib_crate;
Structs§
- Config
- Runtime configuration resolved from defaults, XDG TOML, and CLI flags.
- Config
Init Result - Result of
config init. - Config
Path Data - Path inventory for
config path(agent-readable).
Enums§
- Path
Source - Which layer won when resolving a storage path (XDG hierarchy diagnostics).
Constants§
- APP_
NAME - Product binary / crate name.
- APP_
VERSION - Package version from Cargo.
- CANCEL_
POLL_ INTERVAL_ MS - Cancel-aware sleep / flock poll step (milliseconds).
- CONFIG_
FILE_ NAME - File name of the optional XDG configuration file.
- DEFAULT_
CACHE_ TTL_ SECS - Default HTTP disk cache TTL (seconds).
- DEFAULT_
CONNECT_ TIMEOUT_ SECS - Default TCP connect timeout (seconds).
- DEFAULT_
CONTACT_ URL - Default contact / repository URL (from
Cargo.toml[package].repository). - DEFAULT_
LOG_ DIRECTIVE - Default
tracingfilter when neither-q/-vnorlog_directiveapply. - DEFAULT_
MAX_ BODY_ BYTES - Default maximum downloaded response body size (bytes).
- DEFAULT_
MAX_ CACHE_ BYTES - Default HTTP disk cache budget in bytes (256 MiB).
0= unlimited. - DEFAULT_
MAX_ OUTPUT_ BYTES - Default maximum emitted stdout payload size (bytes).
- DEFAULT_
MAX_ REDIRECTS - Default maximum HTTP redirects followed.
- DEFAULT_
MAX_ RETRIES - Default maximum retries for transient HTTP errors.
- DEFAULT_
PER_ PAGE - Default
per_pagefor crates.io search. - DEFAULT_
RATE_ LIMIT_ DELAY_ MS - Default minimum delay between requests to the same host (milliseconds).
- DEFAULT_
RETRY_ BASE_ MS - Base backoff delay (milliseconds) for retries.
- DEFAULT_
RETRY_ MAX_ DELAY_ MS - Default ceiling for a single retry sleep (milliseconds).
- DEFAULT_
RETRY_ MAX_ ELAPSED_ MS - Default total retry wall budget (
0= derive fromtimeout_secs). - DEFAULT_
SEARCH_ LIMIT - Default hit limit for search-in-crate.
- DEFAULT_
TIMEOUT_ SECS - Default wall-clock timeout (seconds) for one operation.
- HARD_
MAX_ BODY_ BYTES - Hard ceiling for HTTP body size (CLI / TOML cannot raise above this).
- HARD_
MAX_ CONNECT_ TIMEOUT_ SECS - Hard ceiling for TCP connect timeout (seconds).
- HARD_
MAX_ OUTPUT_ BYTES - Hard ceiling for emitted stdout payload size (CLI / TOML cannot raise above).
- HARD_
MAX_ RATE_ LIMIT_ DELAY_ MS - Hard ceiling for per-host politeness delay (milliseconds).
- HARD_
MAX_ REDIRECTS - Hard ceiling for HTTP redirects (CLI / TOML cannot raise above this).
- HARD_
MAX_ TIMEOUT_ SECS - Hard ceiling for wall-clock timeout (seconds).
- HOST_
CRATES_ IO - crates.io host allowlist entry.
- HOST_
DOCS_ RS - docs.rs host allowlist entry.
- HOST_
DOC_ RUST_ LANG_ ORG - Official stdlib rustdoc host (
std/core/alloc). - HOST_
LOCALHOST - Loopback hostname (offline mocks when
allow_loopbackis true). - HOST_
LOOPBACK_ IPV4 - Loopback IPv4 host (offline mocks when
allow_loopbackis true). - HOST_
STATIC_ DOCS_ RS - static.docs.rs host allowlist entry (redirects).
- HTTPS_
PORT - TLS port used by the
doctor --onlineDNS/TCP reachability probe. - MAX_
CONFIG_ TOML_ BYTES - Hard ceiling for on-disk
config.tomlsize (poisoned-config guard). - MAX_
CRATE_ DESCRIPTION_ CHARS - Maximum crate description length when mapping crates.io JSON → agent payload.
- MAX_
CRATE_ NAME_ CHARS - Maximum crate name length.
- MAX_
ITEM_ PATH_ CHARS - Maximum rustdoc item path length.
- MAX_
PER_ PAGE - Maximum
per_pageaccepted for crates.io search. - MAX_
QUERY_ CHARS - Maximum query string length.
- MAX_
SEARCH_ IN_ CRATE_ LIMIT - Maximum hit limit for search-in-crate.
- MAX_
URL_ FIELD_ CHARS - Maximum length for optional URL / page-token fields from crates.io JSON
(
documentation,repository,homepage,next_page,prev_page). - MAX_
USER_ AGENT_ CHARS - Maximum User-Agent length.
- MAX_
VERSION_ CHARS - Maximum version string length.
- MSRV
- Minimum supported Rust version.
- PLACEHOLDER_
CONTACT_ HOST - Historical placeholder contact host that
doctormust reject. - PROGRESS_
HINT_ DELAY_ SECS - Delay before printing a progress hint on slow network ops (seconds).
- SCHEMA_
VERSION - JSON envelope
schema_versionconstant. - SCHEME_
HTTPS - HTTPS scheme token (product endpoints are TLS-only in production).
Functions§
- config_
path_ data - Build path inventory from a loaded
Config. - config_
toml_ under - Ensure
pathis under a directory (used by tests / path display). - default_
config_ toml - Default
config.tomlbody written byconfig init(commented template). - default_
user_ agent - Builds the default User-Agent, optionally including a contact token.
- docs_
origin_ for_ crate - Resolve docs origin for a crate: stdlib → doc.rust-lang.org, else configured docs.rs origin.
- init_
config_ toml - Create default
config.tomlunder the resolved config directory. - is_
allowed_ origin_ scheme_ host - True when scheme+host is a legal origin for product config (defense in depth).
- is_
allowlisted_ host - True when
hostis a product HTTP allowlist entry (SSRF gate). - normalize_
origin - Strip trailing slash from an origin base URL.
- resolve_
config_ dir - Resolve config directory: CLI override, then XDG.
- resolve_
config_ dir_ with_ source - Resolve config directory and report which layer won.
- validate_
contact - Validate optional
contacttoken embedded into the default User-Agent. - validate_
origin - Parse an allowlisted origin (compat wrapper over
AllowedOrigin::parse). - validate_
origin_ with - Parse an origin with an explicit loopback policy (CLI/XDG
allow_loopback). - validate_
user_ agent - Validate User-Agent: non-empty, length-capped, visible ASCII only (HTTP header).