diff --git a/easytier/Cargo.toml b/easytier/Cargo.toml index 34dc1fc8..d80ae481 100644 --- a/easytier/Cargo.toml +++ b/easytier/Cargo.toml @@ -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" diff --git a/easytier/src/dns/utils/authority.rs b/easytier/src/dns/utils/authority.rs index 167e6ff7..51dc448e 100644 --- a/easytier/src/dns/utils/authority.rs +++ b/easytier/src/dns/utils/authority.rs @@ -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 { 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]