hickory_server/lib.rs
1/*
2 * Copyright (C) 2015 Benjamin Fry <benjaminfry@me.com>
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * https://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17// LIBRARY WARNINGS
18#![warn(
19 clippy::default_trait_access,
20 clippy::dbg_macro,
21 clippy::print_stdout,
22 clippy::unimplemented,
23 clippy::use_self,
24 missing_copy_implementations,
25 missing_docs,
26 non_snake_case,
27 non_upper_case_globals,
28 rust_2018_idioms,
29 unreachable_pub
30)]
31#![allow(
32 clippy::single_component_path_imports,
33 clippy::upper_case_acronyms, // can be removed on a major release boundary
34)]
35#![recursion_limit = "2048"]
36#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
37
38//! Hickory DNS is intended to be a fully compliant domain name server and client library.
39//!
40//! # Goals
41//!
42//! * Only safe Rust
43//! * All errors handled
44//! * Simple to manage servers
45//! * High level abstraction for clients
46//! * Secure dynamic update
47//! * New features for securing public information
48
49#[cfg(feature = "blocklist")]
50pub use crate::store::blocklist;
51pub use hickory_proto as proto;
52#[cfg(feature = "recursor")]
53pub use hickory_recursor as recursor;
54#[cfg(any(feature = "resolver", feature = "recursor"))]
55pub use hickory_resolver as resolver;
56
57mod access;
58pub mod authority;
59mod error;
60pub use error::{ConfigError, ConfigErrorKind, PersistenceError, PersistenceErrorKind};
61pub mod server;
62pub mod store;
63
64pub use self::server::ServerFuture;
65
66/// Low-level types for DNSSEC operations
67#[cfg(feature = "__dnssec")]
68pub mod dnssec {
69 use crate::proto::dnssec::Nsec3HashAlgorithm;
70 use serde::Deserialize;
71 use std::sync::Arc;
72
73 /// The kind of non-existence proof provided by the nameserver
74 #[derive(Debug, Deserialize, Clone, PartialEq, Eq)]
75 #[serde(rename_all = "lowercase")]
76 pub enum NxProofKind {
77 /// Use NSEC
78 Nsec,
79 /// Use NSEC3
80 Nsec3 {
81 /// The algorithm used to hash the names.
82 #[serde(default)]
83 algorithm: Nsec3HashAlgorithm,
84 /// The salt used for hashing.
85 #[serde(default = "default_salt")]
86 salt: Arc<[u8]>,
87 /// The number of hashing iterations.
88 #[serde(default)]
89 iterations: u16,
90 /// The Opt-Out flag.
91 #[serde(default)]
92 opt_out: bool,
93 },
94 }
95
96 // MSRV: works in 1.80, fails in 1.78
97 fn default_salt() -> Arc<[u8]> {
98 Arc::new([])
99 }
100}
101
102/// Returns the current version of Hickory DNS
103pub fn version() -> &'static str {
104 env!("CARGO_PKG_VERSION")
105}