Skip to main content

fetch_mirrors_from

Function fetch_mirrors_from 

Source
pub async fn fetch_mirrors_from(
    client: &Client,
    status_url: &str,
    limits: MirrorDiscoveryLimits,
) -> Result<Vec<MirrorInfo>>
Expand description

What: Discover portable mirror metadata from a caller-selected JSON endpoint.

Inputs:

  • client: Caller-provided reqwest client controlling transport policy.
  • status_url: Absolute HTTP(S) endpoint returning an Arch-compatible { "urls": [...] } mirror-status document.
  • limits: Explicit response and accepted-row bounds for this request.

Output:

  • Deterministically URL-sorted valid MirrorInfo rows, capped at limits.max_mirrors.

Details:

  • The parser accepts only active/inactive boolean metadata, a base HTTP(S) URL, and a bounded string protocol list. It does not rank mirrors or make any claim about current latency/health.
  • The endpoint is caller-selected, enabling derivative distributions, test servers, and trusted application mirrors without shelling out to curl.

ยงErrors

Returns an error for invalid URLs/limits, request or response failures, oversized bodies, invalid UTF-8/JSON, or a missing urls array.