mirror of
https://github.com/EasyTier/EasyTier.git
synced 2026-08-07 04:59:49 +00:00
zone: move iter_records to test
This commit is contained in:
+17
-15
@@ -4,7 +4,7 @@ use crate::dns::utils::authority::ArcAuthority;
|
||||
use crate::proto;
|
||||
use crate::proto::utils::RepeatedMessageModel;
|
||||
use crate::utils::MapTryInto;
|
||||
use hickory_proto::rr::{LowerName, Record, RecordSet, RrKey, RrsetRecords};
|
||||
use hickory_proto::rr::{LowerName, RecordSet, RrKey};
|
||||
use hickory_proto::serialize::txt::Parser;
|
||||
use hickory_resolver::config::ResolverOpts;
|
||||
use hickory_resolver::name_server::TokioConnectionProvider;
|
||||
@@ -78,19 +78,6 @@ impl Zone {
|
||||
.map(|f| Arc::new(f) as ArcAuthority)
|
||||
})
|
||||
}
|
||||
|
||||
// TODO: remove this
|
||||
pub fn iter_records(&self) -> impl Iterator<Item = &Record> {
|
||||
self.records
|
||||
.values()
|
||||
.filter(|set| !set.is_empty())
|
||||
.flat_map(|set| {
|
||||
let RrsetRecords::RecordsOnly(records) = set.records_without_rrsigs() else {
|
||||
unreachable!()
|
||||
};
|
||||
records
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
impl TryFrom<&proto::dns::ZoneData> for Zone {
|
||||
@@ -181,7 +168,7 @@ mod tests {
|
||||
use crate::dns::utils::response::ResponseHandle;
|
||||
use hickory_client::client::{Client, ClientHandle};
|
||||
use hickory_proto::op::{Message, MessageType, OpCode, Query, ResponseCode};
|
||||
use hickory_proto::rr::{rdata, DNSClass, Name, RData, RecordType};
|
||||
use hickory_proto::rr::{rdata, DNSClass, Name, RData, Record, RecordType, RrsetRecords};
|
||||
use hickory_proto::runtime::TokioRuntimeProvider;
|
||||
use hickory_proto::serialize::binary::{BinDecodable, BinEncodable, BinEncoder};
|
||||
use hickory_proto::udp::UdpClientStream;
|
||||
@@ -196,6 +183,21 @@ mod tests {
|
||||
use tokio::spawn;
|
||||
use tokio::time::timeout;
|
||||
|
||||
impl Zone {
|
||||
// TODO: remove this
|
||||
pub fn iter_records(&self) -> impl Iterator<Item = &Record> {
|
||||
self.records
|
||||
.values()
|
||||
.filter(|set| !set.is_empty())
|
||||
.flat_map(|set| {
|
||||
let RrsetRecords::RecordsOnly(records) = set.records_without_rrsigs() else {
|
||||
unreachable!()
|
||||
};
|
||||
records
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const CONFIG: &str = r#"
|
||||
listeners = [
|
||||
"127.0.0.1:5353",
|
||||
|
||||
Reference in New Issue
Block a user