reserve-core 0.5.1

Core lookup, catalog, and rate-limiting engine behind the reserve domain finder
Documentation
//! The engine behind `reserve`. Everything the tool knows how to do lives here.

pub mod error;
pub mod limit;
pub mod lookup;
pub mod tld;

pub use error::{Error, ErrorId, ExitClass, Result};
pub use limit::{
    BreakerState, CAUTIOUS_LIMIT, HostLimit, Pacer, PacingLimits, PausedHost, Refusal,
};
pub use lookup::{
    Attempt, AttemptOutcome, BOOTSTRAP_URL, Delegation, Engine, Finding, Freshness, Reason,
    Registration, Server, Servers, ServiceMap, Settings, Source, SourcePolicy, Status, Tally,
    reorders_text, shapes_letters,
};
pub use tld::{
    CATALOG_VERSION, Catalog, Depth, Extension, ExtensionKind, Family, Filter, Group, LengthRule,
    MAX_INPUT_BYTES, NormalizedName, Page, Selector, Sort, SortDirection, SortKey, Suffix,
    SweepPlan, normalize_name, parse_name,
};

pub const VERSION: &str = env!("CARGO_PKG_VERSION");

/// @docgen Registries ask bulk clients to be identifiable; operators block anonymous sweeps first.
#[must_use]
pub fn user_agent() -> String {
    format!("reserve/{VERSION} (+https://reserve.devops.bd)")
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn the_user_agent_names_the_tool_and_its_version() {
        let agent = user_agent();
        assert!(agent.starts_with("reserve/"));
        assert!(agent.contains(VERSION));
    }
}