#![deny(warnings, rust_2018_idioms)]
use anyhow::Result;
use async_trait::async_trait;
use bytes::BytesMut;
use crate::fbs::dns_message_generated::Message;
#[async_trait]
pub trait DnsClient {
/// Converts the provided request to an encoded representation that can be passed to `query()`.
/// This separate call allows reusing the same backing flatbuffer buffer for both the request Message and the response Message.
fn encode(&self, request: &Message<'_>, request_buffer: &mut BytesMut) -> Result<()>;
/// Runs a query for the provided encoded request, then returns the response.
/// The provided `response_fbb` is used as backing storage for the response.
async fn query<'response>(
&mut self,
request_buffer: &mut BytesMut,
response_fbb: &'response mut flatbuffers::FlatBufferBuilder<'_>,
) -> Result<Option<Message<'response>>>;
}
/// Implements hyper HTTP library support for querying a configured external DNS server.
/// Avoids using the OS resolver because that might loop back to us.
pub mod hyper;
/// Client: DNS over HTTPS
pub mod https;
/// Client: TCP (fallback for UDP)
pub mod tcp;
/// Client: UDP
pub mod udp;