Skip to main content

reserve_core/
lib.rs

1//! The engine behind `reserve`. Everything the tool knows how to do lives here.
2
3pub mod error;
4pub mod limit;
5pub mod lookup;
6pub mod tld;
7
8pub use error::{Error, ErrorId, ExitClass, Result};
9pub use limit::{BreakerState, HostLimit, Pacer, PacingLimits, PausedHost, Refusal};
10pub use lookup::{
11    Delegation, Engine, Finding, Freshness, Reason, Registration, Server, Servers, ServiceMap,
12    Settings, Source, SourcePolicy, Status, Tally,
13};
14pub use tld::{
15    CATALOG_VERSION, Catalog, Depth, Extension, ExtensionKind, Family, Filter, Group, LengthRule,
16    Page, Selector, Sort, SortDirection, SortKey, Suffix, SweepPlan, parse_name,
17};
18
19pub const VERSION: &str = env!("CARGO_PKG_VERSION");
20
21/// @docgen Registries ask bulk clients to be identifiable; operators block anonymous sweeps first.
22#[must_use]
23pub fn user_agent() -> String {
24    format!("reserve/{VERSION} (+https://reserve.devops.bd)")
25}
26
27#[cfg(test)]
28mod tests {
29    use super::*;
30
31    #[test]
32    fn the_user_agent_names_the_tool_and_its_version() {
33        let agent = user_agent();
34        assert!(agent.starts_with("reserve/"));
35        assert!(agent.contains(VERSION));
36    }
37}