Skip to main content

QueryManager

Struct QueryManager 

Source
pub struct QueryManager { /* private fields */ }
Expand description

Manager for in-flight DNS queries

Implementations§

Source§

impl QueryManager

Source

pub fn new( max_inflight_queries: usize, server_timeout: u64, dns_packet_len_max: usize, stats: Arc<SharedStats>, load_balancing_strategy: LoadBalancingStrategy, authoritative_dns: bool, serve_stale_grace_time: u64, serve_stale_ttl: u32, negative_cache_ttl: u32, min_cache_ttl: u32, enable_ecs: bool, ecs_prefix_v4: u8, ecs_prefix_v6: u8, spoof_protection: bool, ) -> Self

Create a new QueryManager with statistics tracking

Source

pub fn set_stats(&mut self, stats: Arc<SharedStats>)

Set the statistics tracker

Source

pub fn set_cache(&mut self, cache: SyncDnsCache)

Set the DNS cache

Source

pub fn set_allowed_zones(&mut self, allowed_zones: AllowedZones)

Set the allowed zones

Source

pub fn set_nx_zones(&mut self, nx_zones: NxZones)

Set the nonexistent zones

Source

pub fn set_hooks(&mut self, hooks: Arc<SharedHooks>)

Set the hooks

Source

pub fn set_query_logger(&mut self, query_logger: Arc<QueryLogger>)

Set the query logger

Source

pub fn get_stats(&self) -> Option<Arc<SharedStats>>

Get the statistics tracker

Source

pub fn get_hooks(&self) -> Option<Arc<SharedHooks>>

Get the hooks

Source

pub async fn submit_query_with_client( &self, key: DNSKey, query_data: Vec<u8>, resolver: impl Fn(Vec<u8>) -> BoxFuture<'static, DnsResult<Vec<u8>>> + Send + Sync + 'static, client_addr: &str, ) -> EtchDnsResult<Receiver<DnsResponse>>

Submit a query with client address and get a receiver for the response

If the query is already in flight, this will add a new receiver to the existing query. If the query is not in flight, this will create a new task to handle the query. If the maximum number of in-flight queries has been reached, this will return an error.

Source

pub async fn submit_query( &self, key: DNSKey, query_data: Vec<u8>, resolver: impl Fn(Vec<u8>) -> BoxFuture<'static, DnsResult<Vec<u8>>> + Send + Sync + 'static, ) -> EtchDnsResult<Receiver<DnsResponse>>

Submit a query and get a receiver for the response

If the query is already in flight, this will add a new receiver to the existing query. If the query is not in flight, this will create a new task to handle the query. If the maximum number of in-flight queries has been reached, this will return an error.

Source

pub async fn in_flight_count(&self) -> usize

Get the number of in-flight queries

Source

pub fn get_server_timeout(&self) -> u64

Get the server timeout in seconds

Source

pub fn get_dns_packet_len_max(&self) -> usize

Get the maximum DNS packet size

Source

pub fn get_load_balancing_strategy(&self) -> LoadBalancingStrategy

Get the load balancing strategy

Source

pub fn get_enable_ecs(&self) -> bool

Get whether EDNS-client-subnet is enabled

Source

pub fn get_ecs_prefix_v4(&self) -> u8

Get the IPv4 prefix length for EDNS-client-subnet

Source

pub fn get_ecs_prefix_v6(&self) -> u8

Get the IPv6 prefix length for EDNS-client-subnet

Source

pub fn get_spoof_protection(&self) -> bool

Get whether spoof protection is enabled

Trait Implementations§

Source§

impl Clone for QueryManager

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more