pub struct FileZoneHandler { /* private fields */ }Expand description
FileZoneHandler is responsible for storing the resource records for a particular zone.
Zone handlers default to DNSClass IN. The ZoneType specifies if this should be treated as the start of authority for the zone, is a Secondary, or a cached zone.
Implementations§
Source§impl FileZoneHandler
impl FileZoneHandler
Sourcepub async fn new(in_memory: InMemoryZoneHandler) -> Self
pub async fn new(in_memory: InMemoryZoneHandler) -> Self
Creates a new ZoneHandler.
§Arguments
origin- The zoneNamebeing created, this should match that of theRecordType::SOArecord.records- The map of the initial set of records in the zone.zone_type- The type of zone, i.e. is this authoritative?axfr_policy- A policy for determining if AXFR is allowed.nx_proof_kind- The kind of non-existence proof to be used by the server.
§Return value
The new ZoneHandler.
Sourcepub fn try_from_config(
origin: Name,
zone_type: ZoneType,
axfr_policy: AxfrPolicy,
root_dir: Option<&Path>,
config: &FileConfig,
nx_proof_kind: Option<NxProofKind>,
) -> Result<Self, String>
pub fn try_from_config( origin: Name, zone_type: ZoneType, axfr_policy: AxfrPolicy, root_dir: Option<&Path>, config: &FileConfig, nx_proof_kind: Option<NxProofKind>, ) -> Result<Self, String>
Read the ZoneHandler for the origin from the specified configuration
Methods from Deref<Target = InMemoryZoneHandler>§
Sourcepub fn set_axfr_policy(&mut self, policy: AxfrPolicy)
Available on crate features testing only.
pub fn set_axfr_policy(&mut self, policy: AxfrPolicy)
testing only.Set the AXFR policy for testing purposes
Sourcepub async fn secure_keys(&self) -> impl Deref<Target = [DnssecSigner]> + '_
Available on crate features __dnssec and testing only.
pub async fn secure_keys(&self) -> impl Deref<Target = [DnssecSigner]> + '_
__dnssec and testing only.Retrieve the Signer, which contains the private keys, for this zone
Sourcepub async fn records(
&self,
) -> impl Deref<Target = BTreeMap<RrKey, Arc<RecordSet>>> + '_
pub async fn records( &self, ) -> impl Deref<Target = BTreeMap<RrKey, Arc<RecordSet>>> + '_
Get all the records
Sourcepub async fn records_mut(
&self,
) -> impl DerefMut<Target = BTreeMap<RrKey, Arc<RecordSet>>> + '_
pub async fn records_mut( &self, ) -> impl DerefMut<Target = BTreeMap<RrKey, Arc<RecordSet>>> + '_
Get a mutable reference to the records
Sourcepub fn records_get_mut(&mut self) -> &mut BTreeMap<RrKey, Arc<RecordSet>>
pub fn records_get_mut(&mut self) -> &mut BTreeMap<RrKey, Arc<RecordSet>>
Get a mutable reference to the records
Sourcepub async fn minimum_ttl(&self) -> u32
pub async fn minimum_ttl(&self) -> u32
Returns the minimum ttl (as used in the SOA record)
Sourcepub async fn upsert(&self, record: Record, serial: u32) -> bool
pub async fn upsert(&self, record: Record, serial: u32) -> bool
Inserts or updates a Record depending on its existence in the zone.
Guarantees that SOA, CNAME only has one record, will implicitly update if they already exist.
§Arguments
record- TheRecordto be inserted or updated.serial- Current serial number to be recorded against updates.
§Return value
true if the value was inserted, false otherwise
Sourcepub fn upsert_mut(&mut self, record: Record, serial: u32) -> bool
pub fn upsert_mut(&mut self, record: Record, serial: u32) -> bool
Non-async version of upsert when behind a mutable reference.
Sourcepub fn add_zone_signing_key_mut(
&mut self,
signer: DnssecSigner,
) -> DnsSecResult<()>
Available on crate feature __dnssec only.
pub fn add_zone_signing_key_mut( &mut self, signer: DnssecSigner, ) -> DnsSecResult<()>
__dnssec only.Non-async method of add_zone_signing_key when behind a mutable reference
Sourcepub fn secure_zone_mut(&mut self) -> DnsSecResult<()>
Available on crate feature __dnssec only.
pub fn secure_zone_mut(&mut self) -> DnsSecResult<()>
__dnssec only.(Re)generates the nsec records, increments the serial number and signs the zone
Trait Implementations§
Source§impl Deref for FileZoneHandler
impl Deref for FileZoneHandler
Source§impl DerefMut for FileZoneHandler
impl DerefMut for FileZoneHandler
Source§impl DnssecZoneHandler for FileZoneHandler
impl DnssecZoneHandler for FileZoneHandler
Source§fn add_zone_signing_key<'life0, 'async_trait>(
&'life0 self,
signer: DnssecSigner,
) -> Pin<Box<dyn Future<Output = DnsSecResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn add_zone_signing_key<'life0, 'async_trait>(
&'life0 self,
signer: DnssecSigner,
) -> Pin<Box<dyn Future<Output = DnsSecResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Add Signer
Source§fn secure_zone<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = DnsSecResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn secure_zone<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = DnsSecResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Sign the zone for DNSSEC
Source§impl ZoneHandler for FileZoneHandler
impl ZoneHandler for FileZoneHandler
Source§fn axfr_policy(&self) -> AxfrPolicy
fn axfr_policy(&self) -> AxfrPolicy
Return the policy for determining if AXFR requests are allowed
Source§fn origin(&self) -> &LowerName
fn origin(&self) -> &LowerName
Get the origin of this zone, i.e. example.com is the origin for www.example.com
Source§fn lookup<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
name: &'life1 LowerName,
rtype: RecordType,
request_info: Option<&'life2 RequestInfo<'life3>>,
lookup_options: LookupOptions,
) -> Pin<Box<dyn Future<Output = LookupControlFlow<AuthLookup>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn lookup<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
name: &'life1 LowerName,
rtype: RecordType,
request_info: Option<&'life2 RequestInfo<'life3>>,
lookup_options: LookupOptions,
) -> Pin<Box<dyn Future<Output = LookupControlFlow<AuthLookup>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Looks up all Resource Records matching the given Name and RecordType.
§Arguments
name- The name to look up.rtype- TheRecordTypeto look up.RecordType::ANYwill return all records matchingname.RecordType::AXFRwill return all record types exceptRecordType::SOAdue to the requirements that on zone transfers theRecordType::SOAmust both precede and follow all other records.lookup_options- Query-related lookup options (e.g., DNSSEC DO bit, supported hash algorithms, etc.)
§Return value
A LookupControlFlow containing the lookup that should be returned to the client.
Source§fn search<'life0, 'life1, 'async_trait>(
&'life0 self,
request: &'life1 Request,
lookup_options: LookupOptions,
) -> Pin<Box<dyn Future<Output = (LookupControlFlow<AuthLookup>, Option<TSigResponseContext>)> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn search<'life0, 'life1, 'async_trait>(
&'life0 self,
request: &'life1 Request,
lookup_options: LookupOptions,
) -> Pin<Box<dyn Future<Output = (LookupControlFlow<AuthLookup>, Option<TSigResponseContext>)> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Using the specified query, perform a lookup against this zone.
§Arguments
request- the query to perform the lookup with.lookup_options- Query-related lookup options (e.g., DNSSEC DO bit, supported hash algorithms, etc.)
§Return value
A LookupControlFlow containing the lookup that should be returned to the client.
Source§fn nsec_records<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 LowerName,
lookup_options: LookupOptions,
) -> Pin<Box<dyn Future<Output = LookupControlFlow<AuthLookup>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn nsec_records<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 LowerName,
lookup_options: LookupOptions,
) -> Pin<Box<dyn Future<Output = LookupControlFlow<AuthLookup>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Return the NSEC records based on the given name
§Arguments
name- given this name (i.e. the lookup name), return the NSEC record that is less than thislookup_options- Query-related lookup options (e.g., DNSSEC DO bit, supported hash algorithms, etc.)
Source§fn zone_transfer<'life0, 'life1, 'async_trait>(
&'life0 self,
request: &'life1 Request,
lookup_options: LookupOptions,
now: u64,
) -> Pin<Box<dyn Future<Output = Option<(Result<ZoneTransfer, LookupError>, Option<TSigResponseContext>)>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn zone_transfer<'life0, 'life1, 'async_trait>(
&'life0 self,
request: &'life1 Request,
lookup_options: LookupOptions,
now: u64,
) -> Pin<Box<dyn Future<Output = Option<(Result<ZoneTransfer, LookupError>, Option<TSigResponseContext>)>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn nsec3_records<'life0, 'life1, 'async_trait>(
&'life0 self,
info: Nsec3QueryInfo<'life1>,
lookup_options: LookupOptions,
) -> Pin<Box<dyn Future<Output = LookupControlFlow<AuthLookup>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn nsec3_records<'life0, 'life1, 'async_trait>(
&'life0 self,
info: Nsec3QueryInfo<'life1>,
lookup_options: LookupOptions,
) -> Pin<Box<dyn Future<Output = LookupControlFlow<AuthLookup>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
__dnssec only.Source§fn nx_proof_kind(&self) -> Option<&NxProofKind>
fn nx_proof_kind(&self) -> Option<&NxProofKind>
__dnssec only.Source§fn metrics_label(&self) -> &'static str
fn metrics_label(&self) -> &'static str
metrics only.Source§fn can_validate_dnssec(&self) -> bool
fn can_validate_dnssec(&self) -> bool
Source§fn update<'life0, 'life1, 'async_trait>(
&'life0 self,
_update: &'life1 Request,
_now: u64,
) -> Pin<Box<dyn Future<Output = (Result<bool, ResponseCode>, Option<TSigResponseContext>)> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn update<'life0, 'life1, 'async_trait>(
&'life0 self,
_update: &'life1 Request,
_now: u64,
) -> Pin<Box<dyn Future<Output = (Result<bool, ResponseCode>, Option<TSigResponseContext>)> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn consult<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
_name: &'life1 LowerName,
_rtype: RecordType,
_request_info: Option<&'life2 RequestInfo<'life3>>,
_lookup_options: LookupOptions,
last_result: LookupControlFlow<AuthLookup>,
) -> Pin<Box<dyn Future<Output = (LookupControlFlow<AuthLookup>, Option<TSigResponseContext>)> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn consult<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
_name: &'life1 LowerName,
_rtype: RecordType,
_request_info: Option<&'life2 RequestInfo<'life3>>,
_lookup_options: LookupOptions,
last_result: LookupControlFlow<AuthLookup>,
) -> Pin<Box<dyn Future<Output = (LookupControlFlow<AuthLookup>, Option<TSigResponseContext>)> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Name and RecordType. This
will be called in a chained zone handler configuration after a zone handler in the chain has
returned a lookup with a LookupControlFlow::Continue action. Every other zone handler in the
chain will be called via this consult method, until one either returns a
LookupControlFlow::Break action, or all zone handlers have been consulted. The zone handler
that generated the primary lookup (the one returned via ‘lookup’) will not be consulted. Read moreAuto Trait Implementations§
impl !Freeze for FileZoneHandler
impl !RefUnwindSafe for FileZoneHandler
impl Send for FileZoneHandler
impl Sync for FileZoneHandler
impl Unpin for FileZoneHandler
impl UnsafeUnpin for FileZoneHandler
impl !UnwindSafe for FileZoneHandler
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more