Struct trust_dns_server::authority::Catalog
source · [−]pub struct Catalog { /* private fields */ }
Expand description
Set of authorities, zones, available to this server.
Implementations
sourceimpl Catalog
impl Catalog
sourcepub fn upsert(&mut self, name: LowerName, authority: Box<dyn AuthorityObject>)
pub fn upsert(&mut self, name: LowerName, authority: Box<dyn AuthorityObject>)
Insert or update a zone authority
Arguments
name
- zone name, e.g. example.com.authority
- the zone data
sourcepub fn remove(&mut self, name: &LowerName) -> Option<Box<dyn AuthorityObject>>
pub fn remove(&mut self, name: &LowerName) -> Option<Box<dyn AuthorityObject>>
Remove a zone from the catalog
sourcepub async fn update<R: ResponseHandler>(
&self,
update: &Request,
response_edns: Option<Edns>,
response_handle: R
) -> Result<ResponseInfo>
pub async fn update<R: ResponseHandler>(
&self,
update: &Request,
response_edns: Option<Edns>,
response_handle: R
) -> Result<ResponseInfo>
Update the zone given the Update request.
RFC 2136, DNS Update, April 1997
3.1 - Process Zone Section
3.1.1. The Zone Section is checked to see that there is exactly one
RR therein and that the RR's ZTYPE is SOA, else signal FORMERR to the
requestor. Next, the ZNAME and ZCLASS are checked to see if the zone
so named is one of this server's authority zones, else signal NOTAUTH
to the requestor. If the server is a zone Secondary, the request will be
forwarded toward the Primary Zone Server.
3.1.2 - Pseudocode For Zone Section Processing
if (zcount != 1 || ztype != SOA)
return (FORMERR)
if (zone_type(zname, zclass) == SECONDARY)
return forward()
if (zone_type(zname, zclass) == PRIMARY)
return update()
return (NOTAUTH)
Sections 3.2 through 3.8 describe the primary's behaviour,
whereas Section 6 describes a forwarder's behaviour.
3.8 - Response
At the end of UPDATE processing, a response code will be known. A
response message is generated by copying the ID and Opcode fields
from the request, and either copying the ZOCOUNT, PRCOUNT, UPCOUNT,
and ADCOUNT fields and associated sections, or placing zeros (0) in
the these "count" fields and not including any part of the original
update. The QR bit is set to one (1), and the response is sent back
to the requestor. If the requestor used UDP, then the response will
be sent to the requestor's source UDP port. If the requestor used
TCP, then the response will be sent back on the requestor's open TCP
connection.
The “request” should be an update formatted message. The response will be in the alternate, all 0’s format described in RFC 2136 section 3.8 as this is more efficient.
Arguments
request
- an update messageresponse_handle
- sink for the response message to be sent
sourcepub fn contains(&self, name: &LowerName) -> bool
pub fn contains(&self, name: &LowerName) -> bool
Checks whether the Catalog
contains DNS records for name
Use this when you know the exact LowerName
that was used when
adding an authority and you don’t care about the authority it
contains. For public domain names, LowerName
is usually the
top level domain name like example.com.
.
If you do not know the exact domain name to use or you actually
want to use the authority it contains, use find
instead.
sourcepub async fn lookup<R: ResponseHandler>(
&self,
request: &Request,
response_edns: Option<Edns>,
response_handle: R
) -> ResponseInfo
pub async fn lookup<R: ResponseHandler>(
&self,
request: &Request,
response_edns: Option<Edns>,
response_handle: R
) -> ResponseInfo
Given the requested query, lookup and return any matching results.
Arguments
request
- the query message.response_handle
- sink for the response message to be sent
sourcepub fn find(&self, name: &LowerName) -> Option<&(dyn AuthorityObject + 'static)>
pub fn find(&self, name: &LowerName) -> Option<&(dyn AuthorityObject + 'static)>
Recursively searches the catalog for a matching authority
Trait Implementations
sourceimpl RequestHandler for Catalog
impl RequestHandler for Catalog
sourcefn handle_request<'life0, 'life1, 'async_trait, R: ResponseHandler>(
&'life0 self,
request: &'life1 Request,
response_handle: R
) -> Pin<Box<dyn Future<Output = ResponseInfo> + Send + 'async_trait>> where
R: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn handle_request<'life0, 'life1, 'async_trait, R: ResponseHandler>(
&'life0 self,
request: &'life1 Request,
response_handle: R
) -> Pin<Box<dyn Future<Output = ResponseInfo> + Send + 'async_trait>> where
R: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Determines what needs to happen given the type of request, i.e. Query or Update.
Arguments
request
- the requested action to perform.response_handle
- sink for the response message to be sent
Auto Trait Implementations
impl !RefUnwindSafe for Catalog
impl Send for Catalog
impl Sync for Catalog
impl Unpin for Catalog
impl !UnwindSafe for Catalog
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