1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
//! Walking through CSAF advisories
//!
//! ## Example
//!
//! A simple example for iterating over a source of CSAF documents:
//!
//! ```rust
//! use anyhow::Result;
//! use url::Url;
//! use csaf_walker::source::HttpSource;
//! use csaf_walker::walker::Walker;
//! use csaf_walker::fetcher::Fetcher;
//! use csaf_walker::retrieve::RetrievingVisitor;
//! use csaf_walker::validation::{ValidatedAdvisory, ValidationError, ValidationVisitor};
//!
//! async fn walk() -> Result<()> {
//! let fetcher = Fetcher::new(Default::default()).await?;
//! let source = HttpSource {
//! url: Url::parse("https://www.redhat.com/.well-known/csaf/provider-metadata.json")?,
//! options: Default::default(),
//! fetcher,
//! };
//!
//! Walker::new(source.clone())
//! .walk(RetrievingVisitor::new(
//! source.clone(),
//! ValidationVisitor::new(
//! move |advisory: Result<ValidatedAdvisory, ValidationError>| async move {
//! log::info!("Found advisory: {advisory:?}");
//! Ok::<_, anyhow::Error>(())
//! },
//! )
//! ))
//! .await?;
//!
//! Ok(())
//! }
//! ```
pub mod discover;
pub mod fetcher;
pub mod model;
pub mod progress;
pub mod retrieve;
pub mod source;
pub mod validation;
pub mod visitors;
pub mod walker;
mod utils;