trust_dns_server/store/
config.rs

1// Copyright 2015-2018 Benjamin Fry <benjaminfry@me.com>
2//
3// Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
4// http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
5// http://opensource.org/licenses/MIT>, at your option. This file may not be
6// copied, modified, or distributed except according to those terms.
7
8//! Configuration for the stores
9
10use serde::Deserialize;
11
12use crate::store::file::FileConfig;
13#[cfg(feature = "trust-dns-resolver")]
14use crate::store::forwarder::ForwardConfig;
15#[cfg(feature = "trust-dns-recursor")]
16use crate::store::recursor::RecursiveConfig;
17#[cfg(feature = "sqlite")]
18use crate::store::sqlite::SqliteConfig;
19
20/// Enumeration over all Store configurations
21#[derive(Deserialize, PartialEq, Eq, Debug)]
22#[serde(tag = "type")]
23#[serde(rename_all = "lowercase")]
24#[non_exhaustive]
25pub enum StoreConfig {
26    /// File based configuration
27    File(FileConfig),
28    /// Sqlite based configuration file
29    #[cfg(feature = "sqlite")]
30    #[cfg_attr(docsrs, doc(cfg(feature = "sqlite")))]
31    Sqlite(SqliteConfig),
32    /// Forwarding Resolver
33    #[cfg(feature = "trust-dns-resolver")]
34    #[cfg_attr(docsrs, doc(cfg(feature = "resolver")))]
35    Forward(ForwardConfig),
36    /// Recursive Resolver
37    #[cfg(feature = "trust-dns-recursor")]
38    #[cfg_attr(docsrs, doc(cfg(feature = "recursor")))]
39    Recursor(RecursiveConfig),
40}