pub async fn download_consensus(
microdescriptor: bool,
endpoints: Option<&[DirPort]>,
request_timeout: Option<Duration>,
) -> Result<DownloadResult, Error>Expand description
Downloads the current network consensus.
The consensus is the agreed-upon view of the Tor network, containing information about all known relays. It is signed by a majority of directory authorities.
§Arguments
microdescriptor- Iftrue, downloads the microdescriptor consensus (smaller, used by clients). Iffalse, downloads the full consensus.endpoints- Optional list of endpoints to try. IfNone, uses default directory authorities.request_timeout- Optional timeout for each download attempt.
§Returns
A DownloadResult containing the consensus document.
§Errors
Returns Error::Download if all endpoints fail.
Returns Error::DownloadTimeout if all attempts timeout.
§Example
use stem_rs::descriptor::remote::download_consensus;
use std::time::Duration;
// Download microdescriptor consensus (smaller, for clients)
let result = download_consensus(true, None, Some(Duration::from_secs(60))).await?;
println!("Consensus size: {} bytes", result.content.len());