domain/
lib.rs

1//! A DNS library for Rust.
2//!
3//! This crates provides a number of building blocks for developing
4//! functionality related to the DNS. It provides fundamental types, traits,
5//! and code as well as a wide range of optional features. The intent is to
6//! eventually cover all aspects of modern DNS.
7//!
8//! The crate uses feature flags to allow you to select only those modules
9//! you need for you particular project. In most cases, the feature names
10//! are equal to the module they enable.
11//!
12//! # Modules
13//!
14//! A set of modules providing fundamental types and functionality is always
15//! enabled:
16//!
17//! * [base] contains a wide variety of types, traits, and functionality
18//!   to deal with DNS data, and
19//! * [rdata] contains types and implementations for a growing number of
20//!   record types.
21//!
22//! In addition to those two basic modules, there are a number of modules for
23//! more specific features that are not required in all applications. In order
24//! to keep the amount of code to be compiled and the number of dependencies
25//! small, these are hidden behind feature flags through which they can be
26//! enabled if required. The flags have the same names as the modules.
27//!
28//! Currently, there are the following modules:
29//!
30#![cfg_attr(feature = "resolv", doc = "* [resolv]:")]
31#![cfg_attr(not(feature = "resolv"), doc = "* resolv:")]
32//!   An asynchronous DNS resolver based on the
33//!   [Tokio](https://tokio.rs/) async runtime.
34#![cfg_attr(feature = "sign", doc = "* [sign]:")]
35#![cfg_attr(not(feature = "sign"), doc = "* sign:")]
36//!   Experimental support for DNSSEC signing.
37#![cfg_attr(feature = "tsig", doc = "* [tsig]:")]
38#![cfg_attr(not(feature = "tsig"), doc = "* tsig:")]
39//!   Support for securing DNS transactions with TSIG records.
40#![cfg_attr(feature = "validate", doc = "* [validate]:")]
41#![cfg_attr(not(feature = "validate"), doc = "* validate:")]
42//!   Experimental support for DNSSEC validation.
43#![cfg_attr(feature = "zonefile", doc = "* [zonefile]:")]
44#![cfg_attr(not(feature = "zonefile"), doc = "* zonefile:")]
45//!   Experimental reading and writing of zone files, i.e., the textual
46//!   representation of DNS data.
47//!
48//! Finally, the [dep] module contains re-exports of some important
49//! dependencies to help avoid issues with multiple versions of a crate.
50//!
51//! # Reference of Feature Flags
52//!
53//! The following is the complete list of the feature flags available.
54//!
55//! * `bytes`: Enables using the types `Bytes` and `BytesMut` from the
56//!    [bytes](https://github.com/tokio-rs/bytes) crate as octet sequences.
57//! * `chrono`: Adds the [chrono](https://github.com/chronotope/chrono)
58//!   crate as a dependency. This adds support for generating serial numbers
59//!   from time stamps.
60//! * `heapless`: enables the use of the `Vec` type from the
61//!   [heapless](https://github.com/japaric/heapless) crate as octet
62//!   sequences.
63//! * `interop`: Activate interoperability tests that rely on other software
64//!   to be installed in the system (currently NSD and dig) and will fail if
65//!   it isn’t. This feature is not meaningful for users of the crate.
66//! * `rand`: Enables a number of methods that rely on a random number
67//!   generator being available in the system.
68//! * `resolv`: Enables the asynchronous stub resolver via the
69#![cfg_attr(feature = "resolv", doc = "  [resolv]")]
70#![cfg_attr(not(feature = "resolv"), doc = "  resolv")]
71//!   module.
72//! * `resolv-sync`: Enables the synchronous version of the stub resolver.
73//! * `ring`: Enables crypto functionality via the
74//!   [ring](https://github.com/briansmith/ring) crate.
75//! * `serde`: Enables serde serialization for a number of basic types.
76//! * `sign`: basic DNSSEC signing support. This will enable the
77#![cfg_attr(feature = "sign", doc = "  [sign]")]
78#![cfg_attr(not(feature = "sign"), doc = "  sign")]
79//!   module and requires the `std` feature. Note that this will not directly
80//!   enable actual signing. For that you will also need to pick a crypto
81//!   module via an additional feature. Currently we only support the `ring`
82//!   module, but support for OpenSSL is coming soon.
83//! * `siphasher`: enables the dependency on the
84//!   [siphasher](https://github.com/jedisct1/rust-siphash) crate which allows
85//!   generating and checking hashes in [standard server
86//!   cookies][crate::base::opt::cookie::StandardServerCookie].
87//! * `smallvec`: enables the use of the `Smallvec` type from the
88//!   [smallvec](https://github.com/servo/rust-smallvec) crate as octet
89//!   sequences.
90//! * `std`: support for the Rust std library. This feature is enabled by
91//!   default.
92//! * `tsig`: support for signing and validating message exchanges via TSIG
93//!   signatures. This enables the
94#![cfg_attr(feature = "tsig", doc = "  [tsig]")]
95#![cfg_attr(not(feature = "tsig"), doc = "  tsig")]
96//!   module and currently pulls in the
97//!   `bytes`, `ring`, and `smallvec` features.
98//! * `validate`: basic DNSSEC validation support. This feature enables the
99#![cfg_attr(feature = "validate", doc = "  [validate]")]
100#![cfg_attr(not(feature = "validate"), doc = "  validate")]
101//!   module and currently also enables the `std` and `ring`
102//!   features.
103//! * `zonefile`: reading and writing of zonefiles. This feature enables the
104#![cfg_attr(feature = "zonefile", doc = "  [zonefile]")]
105#![cfg_attr(not(feature = "zonefile"), doc = "  zonefile")]
106//!   module and currently also enables the `bytes` and `std` features.
107
108#![no_std]
109#![allow(renamed_and_removed_lints)]
110#![allow(clippy::unknown_clippy_lints)]
111#![allow(clippy::uninlined_format_args)]
112#![cfg_attr(docsrs, feature(doc_cfg))]
113
114#[cfg(feature = "std")]
115#[allow(unused_imports)] // Import macros even if unused.
116#[macro_use]
117extern crate std;
118
119#[macro_use]
120extern crate core;
121
122pub mod base;
123pub mod dep;
124pub mod rdata;
125pub mod resolv;
126pub mod sign;
127pub mod test;
128pub mod tsig;
129pub mod utils;
130pub mod validate;
131pub mod zonefile;