pub struct QueryManager { /* private fields */ }Expand description
Manager for in-flight DNS queries
Implementations§
Source§impl QueryManager
impl QueryManager
Sourcepub 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
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
Sourcepub fn set_stats(&mut self, stats: Arc<SharedStats>)
pub fn set_stats(&mut self, stats: Arc<SharedStats>)
Set the statistics tracker
Sourcepub fn set_cache(&mut self, cache: SyncDnsCache)
pub fn set_cache(&mut self, cache: SyncDnsCache)
Set the DNS cache
Sourcepub fn set_allowed_zones(&mut self, allowed_zones: AllowedZones)
pub fn set_allowed_zones(&mut self, allowed_zones: AllowedZones)
Set the allowed zones
Sourcepub fn set_nx_zones(&mut self, nx_zones: NxZones)
pub fn set_nx_zones(&mut self, nx_zones: NxZones)
Set the nonexistent zones
Sourcepub fn set_hooks(&mut self, hooks: Arc<SharedHooks>)
pub fn set_hooks(&mut self, hooks: Arc<SharedHooks>)
Set the hooks
Sourcepub fn set_query_logger(&mut self, query_logger: Arc<QueryLogger>)
pub fn set_query_logger(&mut self, query_logger: Arc<QueryLogger>)
Set the query logger
Sourcepub fn get_stats(&self) -> Option<Arc<SharedStats>>
pub fn get_stats(&self) -> Option<Arc<SharedStats>>
Get the statistics tracker
Sourcepub fn get_hooks(&self) -> Option<Arc<SharedHooks>>
pub fn get_hooks(&self) -> Option<Arc<SharedHooks>>
Get the hooks
Sourcepub 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>>
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.
Sourcepub 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>>
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.
Sourcepub async fn in_flight_count(&self) -> usize
pub async fn in_flight_count(&self) -> usize
Get the number of in-flight queries
Sourcepub fn get_server_timeout(&self) -> u64
pub fn get_server_timeout(&self) -> u64
Get the server timeout in seconds
Sourcepub fn get_dns_packet_len_max(&self) -> usize
pub fn get_dns_packet_len_max(&self) -> usize
Get the maximum DNS packet size
Sourcepub fn get_load_balancing_strategy(&self) -> LoadBalancingStrategy
pub fn get_load_balancing_strategy(&self) -> LoadBalancingStrategy
Get the load balancing strategy
Sourcepub fn get_enable_ecs(&self) -> bool
pub fn get_enable_ecs(&self) -> bool
Get whether EDNS-client-subnet is enabled
Sourcepub fn get_ecs_prefix_v4(&self) -> u8
pub fn get_ecs_prefix_v4(&self) -> u8
Get the IPv4 prefix length for EDNS-client-subnet
Sourcepub fn get_ecs_prefix_v6(&self) -> u8
pub fn get_ecs_prefix_v6(&self) -> u8
Get the IPv6 prefix length for EDNS-client-subnet
Sourcepub fn get_spoof_protection(&self) -> bool
pub fn get_spoof_protection(&self) -> bool
Get whether spoof protection is enabled