Struct trust_dns_server::store::file::FileAuthority
source · [−]pub struct FileAuthority(_);
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
sourceimpl 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)
This is supported 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(
&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 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<()>
This is supported 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<()>
This is supported 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<()>
This is supported 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
sourceimpl Authority for FileAuthority
impl Authority for FileAuthority
sourcefn is_axfr_allowed(&self) -> bool
fn is_axfr_allowed(&self) -> bool
Return true if AXFR is allowed
sourcefn update<'life0, 'life1, 'async_trait>(
&'life0 self,
_update: &'life1 MessageRequest
) -> Pin<Box<dyn Future<Output = UpdateResult<bool>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn update<'life0, 'life1, 'async_trait>(
&'life0 self,
_update: &'life1 MessageRequest
) -> Pin<Box<dyn Future<Output = UpdateResult<bool>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Perform a dynamic update of a zone
sourcefn origin(&self) -> &LowerName
fn origin(&self) -> &LowerName
Get the origin of this zone, i.e. example.com is the origin for www.example.com
sourcefn 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
'life0: 'async_trait,
'life1: 'async_trait,
Self: '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
'life0: 'async_trait,
'life1: 'async_trait,
Self: '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.
sourcefn 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
'life0: 'async_trait,
'life1: 'async_trait,
Self: '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
'life0: 'async_trait,
'life1: 'async_trait,
Self: '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 vectory 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.
sourcefn ns<'life0, 'async_trait>(
&'life0 self,
lookup_options: LookupOptions
) -> Pin<Box<dyn Future<Output = Result<Self::Lookup, LookupError>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: '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
'life0: 'async_trait,
Self: 'async_trait,
Get the NS, NameServer, record for the zone
sourcefn 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
'life0: 'async_trait,
'life1: 'async_trait,
Self: '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
'life0: 'async_trait,
'life1: 'async_trait,
Self: '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
sourcefn soa<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<Self::Lookup, LookupError>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn soa<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<Self::Lookup, LookupError>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: '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.
sourcefn soa_secure<'life0, 'async_trait>(
&'life0 self,
lookup_options: LookupOptions
) -> Pin<Box<dyn Future<Output = Result<Self::Lookup, LookupError>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: '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
'life0: 'async_trait,
Self: 'async_trait,
Returns the SOA record for the zone
type Lookup = <InMemoryAuthority as Authority>::Lookup
type Lookup = <InMemoryAuthority as Authority>::Lookup
Result of a lookup
sourceimpl Deref for FileAuthority
impl Deref for FileAuthority
type Target = InMemoryAuthority
type Target = InMemoryAuthority
The resulting type after dereferencing.
sourceimpl DerefMut for FileAuthority
impl DerefMut for FileAuthority
sourceimpl DnssecAuthority for FileAuthority
This is supported on crate feature dnssec
only.
impl DnssecAuthority for FileAuthority
dnssec
only.sourcefn add_update_auth_key<'life0, 'async_trait>(
&'life0 self,
name: Name,
key: KEY
) -> Pin<Box<dyn Future<Output = DnsSecResult<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: '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
'life0: 'async_trait,
Self: 'async_trait,
Add a (Sig0) key that is authorized to perform updates against this authority
sourcefn add_zone_signing_key<'life0, 'async_trait>(
&'life0 self,
signer: SigSigner
) -> Pin<Box<dyn Future<Output = DnsSecResult<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn add_zone_signing_key<'life0, 'async_trait>(
&'life0 self,
signer: SigSigner
) -> Pin<Box<dyn Future<Output = DnsSecResult<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Add Signer
sourcefn secure_zone<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = DnsSecResult<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn secure_zone<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = DnsSecResult<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Sign the zone for DNSSEC
Auto Trait Implementations
impl !RefUnwindSafe for FileAuthority
impl Send for FileAuthority
impl Sync for FileAuthority
impl Unpin for FileAuthority
impl UnwindSafe for FileAuthority
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
pub fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
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
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more