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

source

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 zone Name being created, this should match that of the RecordType::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, (see add_zone_signing_key())
Return value

The new Authority.

source

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

source

pub fn unwrap(self) -> InMemoryAuthority

Unwrap the InMemoryAuthority

Methods from Deref<Target = InMemoryAuthority>§

source

pub fn class(&self) -> DNSClass

The DNSClass of this zone

source

pub fn set_allow_axfr(&mut self, allow_axfr: bool)

Available on crate feature testing only.

Allow AXFR’s (zone transfers)

source

pub fn clear(&mut self)

Clears all records (including SOA, etc)

source

pub async fn secure_keys(&self) -> impl Deref<Target = [SigSigner]> + '_

Retrieve the Signer, which contains the private keys, for this zone

source

pub async fn records(&self) -> BTreeMap<RrKey, Arc<RecordSet>>

Get all the records

source

pub async fn records_mut( &self ) -> impl DerefMut<Target = BTreeMap<RrKey, Arc<RecordSet>>> + '_

Get a mutable reference to the records

source

pub fn records_get_mut(&mut self) -> &mut BTreeMap<RrKey, Arc<RecordSet>>

Get a mutable reference to the records

source

pub async fn minimum_ttl(&self) -> u32

Returns the minimum ttl (as used in the SOA record)

source

pub async fn serial(&self) -> u32

get the current serial number for the zone.

source

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 - The Record to be inserted or updated.
  • serial - Current serial number to be recorded against updates.
Return value

true if the value was inserted, false otherwise

source

pub fn upsert_mut(&mut self, record: Record, serial: u32) -> bool

Non-async version of upsert when behind a mutable reference.

source

pub fn add_update_auth_key_mut( &mut self, name: Name, key: KEY ) -> DnsSecResult<()>

Available on crate feature dnssec only.

Non-async method of add_update_auth_key when behind a mutable reference

source

pub fn add_zone_signing_key_mut( &mut self, signer: SigSigner ) -> DnsSecResult<()>

Available on crate feature dnssec only.

Non-async method of add_zone_signing_key when behind a mutable reference

source

pub fn secure_zone_mut(&mut self) -> DnsSecResult<()>

Available on crate feature dnssec only.

(Re)generates the nsec records, increments the serial number and signs the zone

Trait Implementations§

source§

impl Authority for FileAuthority

source§

fn zone_type(&self) -> ZoneType

What type is this zone

source§

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,

Perform a dynamic update of a zone

source§

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,

Looks up all Resource Records matching the giving Name and RecordType.

Arguments
  • name - The Name, label, to lookup.
  • rtype - The RecordType, to lookup. RecordType::ANY will return all records matching name. RecordType::AXFR will return all record types except RecordType::SOA due to the requirements that on zone transfers the RecordType::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,

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,

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,

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 this
  • is_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,

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,

Returns the SOA record for the zone

§

type Lookup = <InMemoryAuthority as Authority>::Lookup

Result of a lookup
source§

impl Deref for FileAuthority

§

type Target = InMemoryAuthority

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl DerefMut for FileAuthority

source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
source§

impl DnssecAuthority for FileAuthority

Available on crate feature 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,

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,

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,

Sign the zone for DNSSEC

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> 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, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

§

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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

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