Skip to main content

Crate tendns

Crate tendns 

Source
Expand description

Encrypted TXT discovery and hexadecimal IPv4 resolution.

Disable default features to embed the resolver without the CLI, HTTP servers, Cloudflare client, or built-in network transport. Supply an Exchange implementation backed by the application’s existing DNS resolver.

use std::sync::Arc;
use tendns::{Discovery, Exchange, Policy, Resolver};
use tendns::{names::canonical_name, protocol::Secret};

fn make_resolver(upstream: Arc<dyn Exchange>, encoded_key: &str)
    -> anyhow::Result<Resolver>
{
    let policy = Policy::new(
        vec![Discovery {
            domain: canonical_name("example.com")?,
            key: Arc::new(Secret::decode(encoded_key)?),
        }],
        vec![canonical_name("hex.internal")?],
        60,
        1024,
    )?;
    Ok(Resolver::new(Arc::new(policy), upstream))
}

Re-exports§

pub use policy::Discovery;
pub use policy::Policy;
pub use resolver::IpStrategy;
pub use resolver::LookupError;
pub use resolver::Resolver;
pub use upstream::Exchange;
pub use hickory_proto;

Modules§

cloudflare
config
names
policy
Validated resolution policy, independent of configuration file formats.
protocol
resolver
server
upstream
Application-provided DNS transport.

Structs§

TimeoutError
A tendns-enforced deadline elapsed, before or during an operation.