mirror of
https://github.com/EasyTier/EasyTier.git
synced 2026-08-07 04:59:49 +00:00
utils(authority): delegate
This commit is contained in:
@@ -51,6 +51,7 @@ toml = "0.8.12"
|
||||
chrono = { version = "0.4.37", features = ["serde"] }
|
||||
|
||||
cfg-if = "1.0"
|
||||
delegate = "0.13.5"
|
||||
|
||||
itertools = "0.14.0"
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
use crate::utils::BoxExt;
|
||||
use delegate::delegate;
|
||||
use derive_more::{Deref, DerefMut, From};
|
||||
use hickory_proto::rr::{LowerName, RecordType};
|
||||
use hickory_server::authority::{
|
||||
@@ -23,23 +25,19 @@ where
|
||||
{
|
||||
type Lookup = A::Lookup;
|
||||
|
||||
#[inline]
|
||||
fn zone_type(&self) -> ZoneType {
|
||||
self.0.zone_type()
|
||||
}
|
||||
#[inline]
|
||||
fn is_axfr_allowed(&self) -> bool {
|
||||
self.0.is_axfr_allowed()
|
||||
delegate! {
|
||||
to self.0 {
|
||||
fn zone_type(&self) -> ZoneType;
|
||||
fn is_axfr_allowed(&self) -> bool;
|
||||
fn origin(&self) -> &LowerName;
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
async fn update(&self, update: &MessageRequest) -> UpdateResult<bool> {
|
||||
self.0.update(update).await
|
||||
}
|
||||
#[inline]
|
||||
fn origin(&self) -> &LowerName {
|
||||
self.0.origin()
|
||||
}
|
||||
#[inline]
|
||||
async fn lookup(
|
||||
&self,
|
||||
name: &LowerName,
|
||||
@@ -62,7 +60,7 @@ where
|
||||
self.0
|
||||
.lookup(name, rtype, lookup_options)
|
||||
.await
|
||||
.map(|l| Box::new(l) as _)
|
||||
.map(|l| l.boxed() as _)
|
||||
}
|
||||
}
|
||||
#[inline]
|
||||
|
||||
Reference in New Issue
Block a user