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