Struct trust_dns_server::store::file::FileAuthority
source · pub struct FileAuthority(/* private fields */);
Expand description
FileAuthority is responsible for storing the resource records for a particular zone.
Authorities 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 FileAuthority
impl FileAuthority
sourcepub fn new(
origin: Name,
records: BTreeMap<RrKey, RecordSet>,
zone_type: ZoneType,
allow_axfr: bool
) -> Result<Self, String>
pub fn new( origin: Name, records: BTreeMap<RrKey, RecordSet>, zone_type: ZoneType, allow_axfr: bool ) -> Result<Self, String>
Creates a new Authority.
Arguments
origin
- The zoneName
being created, this should match that of theRecordType::SOA
record.records
- The map of the initial set of records in the zone.zone_type
- The type of zone, i.e. is this authoritative?allow_update
- If true, then this zone accepts dynamic updates.is_dnssec_enabled
- If true, then the zone will sign the zone with all registered keys, (seeadd_zone_signing_key()
)
Return value
The new Authority
.
sourcepub fn try_from_config(
origin: Name,
zone_type: ZoneType,
allow_axfr: bool,
root_dir: Option<&Path>,
config: &FileConfig
) -> Result<Self, String>
pub fn try_from_config( origin: Name, zone_type: ZoneType, allow_axfr: bool, root_dir: Option<&Path>, config: &FileConfig ) -> Result<Self, String>
Read the Authority for the origin from the specified configuration
sourcepub fn unwrap(self) -> InMemoryAuthority
pub fn unwrap(self) -> InMemoryAuthority
Unwrap the InMemoryAuthority
Methods from Deref<Target = InMemoryAuthority>§
sourcepub fn set_allow_axfr(&mut self, allow_axfr: bool)
Available on crate feature testing
only.
pub fn set_allow_axfr(&mut self, allow_axfr: bool)
testing
only.Allow AXFR’s (zone transfers)
sourcepub async fn secure_keys(&self) -> impl Deref<Target = [SigSigner]> + '_
pub async fn secure_keys(&self) -> impl Deref<Target = [SigSigner]> + '_
Retrieve the Signer, which contains the private keys, for this zone
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 it’s existence in the authority.
Guarantees that SOA, CNAME only has one record, will implicitly update if they already exist.
Arguments
record
- TheRecord
to 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_update_auth_key_mut(
&mut self,
name: Name,
key: KEY
) -> DnsSecResult<()>
Available on crate feature dnssec
only.
pub fn add_update_auth_key_mut( &mut self, name: Name, key: KEY ) -> DnsSecResult<()>
dnssec
only.Non-async method of add_update_auth_key when behind a mutable reference
sourcepub fn add_zone_signing_key_mut(
&mut self,
signer: SigSigner
) -> DnsSecResult<()>
Available on crate feature dnssec
only.
pub fn add_zone_signing_key_mut( &mut self, signer: SigSigner ) -> 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 Authority for FileAuthority
impl Authority for FileAuthority
source§fn is_axfr_allowed(&self) -> bool
fn is_axfr_allowed(&self) -> bool
Return true if AXFR is allowed
source§fn update<'life0, 'life1, 'async_trait>(
&'life0 self,
_update: &'life1 MessageRequest
) -> Pin<Box<dyn Future<Output = UpdateResult<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn update<'life0, 'life1, 'async_trait>(
&'life0 self,
_update: &'life1 MessageRequest
) -> Pin<Box<dyn Future<Output = UpdateResult<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Perform a dynamic update of a zone
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, 'async_trait>(
&'life0 self,
name: &'life1 LowerName,
rtype: RecordType,
lookup_options: LookupOptions
) -> Pin<Box<dyn Future<Output = Result<Self::Lookup, LookupError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn lookup<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 LowerName,
rtype: RecordType,
lookup_options: LookupOptions
) -> Pin<Box<dyn Future<Output = Result<Self::Lookup, LookupError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Looks up all Resource Records matching the giving Name
and RecordType
.
Arguments
name
- TheName
, label, to lookup.rtype
- TheRecordType
, to lookup.RecordType::ANY
will return all records matchingname
.RecordType::AXFR
will return all record types exceptRecordType::SOA
due to the requirements that on zone transfers theRecordType::SOA
must both precede and follow all other records.is_secure
- If the DO bit is set on the EDNS OPT record, then return RRSIGs as well.
Return value
None if there are no matching records, otherwise a Vec
containing the found records.
source§fn search<'life0, 'life1, 'async_trait>(
&'life0 self,
request_info: RequestInfo<'life1>,
lookup_options: LookupOptions
) -> Pin<Box<dyn Future<Output = Result<Self::Lookup, LookupError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn search<'life0, 'life1, 'async_trait>(
&'life0 self,
request_info: RequestInfo<'life1>,
lookup_options: LookupOptions
) -> Pin<Box<dyn Future<Output = Result<Self::Lookup, LookupError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Using the specified query, perform a lookup against this zone.
Arguments
query
- the query to perform the lookup with.is_secure
- if true, then RRSIG records (if this is a secure zone) will be returned.
Return value
Returns a vector containing the results of the query, it will be empty if not found. If
is_secure
is true, in the case of no records found then NSEC records will be returned.
source§fn ns<'life0, 'async_trait>(
&'life0 self,
lookup_options: LookupOptions
) -> Pin<Box<dyn Future<Output = Result<Self::Lookup, LookupError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn ns<'life0, 'async_trait>(
&'life0 self,
lookup_options: LookupOptions
) -> Pin<Box<dyn Future<Output = Result<Self::Lookup, LookupError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get the NS, NameServer, record for the zone
source§fn get_nsec_records<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 LowerName,
lookup_options: LookupOptions
) -> Pin<Box<dyn Future<Output = Result<Self::Lookup, LookupError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_nsec_records<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 LowerName,
lookup_options: LookupOptions
) -> Pin<Box<dyn Future<Output = Result<Self::Lookup, LookupError>> + 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 thisis_secure
- if true then it will return RRSIG records as well
source§fn soa<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<Self::Lookup, LookupError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn soa<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<Self::Lookup, LookupError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Returns the SOA of the authority.
Note: This will only return the SOA, if this is fulfilling a request, a standard lookup
should be used, see soa_secure()
, which will optionally return RRSIGs.
source§fn soa_secure<'life0, 'async_trait>(
&'life0 self,
lookup_options: LookupOptions
) -> Pin<Box<dyn Future<Output = Result<Self::Lookup, LookupError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn soa_secure<'life0, 'async_trait>(
&'life0 self,
lookup_options: LookupOptions
) -> Pin<Box<dyn Future<Output = Result<Self::Lookup, LookupError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Returns the SOA record for the zone
§type Lookup = <InMemoryAuthority as Authority>::Lookup
type Lookup = <InMemoryAuthority as Authority>::Lookup
source§impl Deref for FileAuthority
impl Deref for FileAuthority
source§impl DerefMut for FileAuthority
impl DerefMut for FileAuthority
source§impl DnssecAuthority for FileAuthority
Available on crate feature dnssec
only.
impl DnssecAuthority for FileAuthority
dnssec
only.source§fn add_update_auth_key<'life0, 'async_trait>(
&'life0 self,
name: Name,
key: KEY
) -> Pin<Box<dyn Future<Output = DnsSecResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn add_update_auth_key<'life0, 'async_trait>(
&'life0 self,
name: Name,
key: KEY
) -> Pin<Box<dyn Future<Output = DnsSecResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Add a (Sig0) key that is authorized to perform updates against this authority
source§fn add_zone_signing_key<'life0, 'async_trait>(
&'life0 self,
signer: SigSigner
) -> 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: SigSigner
) -> 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