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    BOOTSTRAP_URL, Delegation, Engine, Finding, Freshness, Reason, Registration, Server, Servers,
12    ServiceMap, Settings, Source, SourcePolicy, Status, Tally,
13};
14pub use tld::{
15    CATALOG_VERSION, Catalog, Depth, Extension, ExtensionKind, Family, Filter, Group, LengthRule,
16    NormalizedName, Page, Selector, Sort, SortDirection, SortKey, Suffix, SweepPlan,
17    normalize_name, parse_name,
18};
19
20pub const VERSION: &str = env!("CARGO_PKG_VERSION");
21
22/// @docgen Registries ask bulk clients to be identifiable; operators block anonymous sweeps first.
23#[must_use]
24pub fn user_agent() -> String {
25    format!("reserve/{VERSION} (+https://reserve.devops.bd)")
26}
27
28#[cfg(test)]
29mod tests {
30    use super::*;
31
32    #[test]
33    fn the_user_agent_names_the_tool_and_its_version() {
34        let agent = user_agent();
35        assert!(agent.starts_with("reserve/"));
36        assert!(agent.contains(VERSION));
37    }
38}