mirror of
https://github.com/EasyTier/EasyTier.git
synced 2026-09-03 17:45:44 +00:00
server: use HashSet in DnsClientInfo
This commit is contained in:
@@ -19,11 +19,10 @@ use tokio::{
|
|||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
use super::{utils::NameServerAddr, zone::Zone};
|
use super::{utils::NameServerAddr, zone::Zone};
|
||||||
use crate::dns::utils::NameServerAddrGroup;
|
|
||||||
use crate::dns::zone::ZoneGroup;
|
use crate::dns::zone::ZoneGroup;
|
||||||
use crate::proto::dns::DnsSnapshot;
|
use crate::proto::dns::DnsSnapshot;
|
||||||
use crate::proto::rpc_types;
|
use crate::proto::rpc_types;
|
||||||
use crate::utils::DeterministicDigest;
|
use crate::utils::{DeterministicDigest, MapTryInto};
|
||||||
use crate::{
|
use crate::{
|
||||||
common::global_ctx::GlobalCtx,
|
common::global_ctx::GlobalCtx,
|
||||||
proto::{
|
proto::{
|
||||||
@@ -36,8 +35,8 @@ use crate::{
|
|||||||
pub struct DnsClientInfo {
|
pub struct DnsClientInfo {
|
||||||
digest: Vec<u8>,
|
digest: Vec<u8>,
|
||||||
zones: ZoneGroup,
|
zones: ZoneGroup,
|
||||||
addresses: NameServerAddrGroup,
|
addresses: HashSet<NameServerAddr>,
|
||||||
listeners: NameServerAddrGroup,
|
listeners: HashSet<NameServerAddr>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TryFrom<&DnsSnapshot> for DnsClientInfo {
|
impl TryFrom<&DnsSnapshot> for DnsClientInfo {
|
||||||
@@ -47,8 +46,8 @@ impl TryFrom<&DnsSnapshot> for DnsClientInfo {
|
|||||||
Ok(Self {
|
Ok(Self {
|
||||||
digest: value.digest(),
|
digest: value.digest(),
|
||||||
zones: (&value.zones).try_into()?,
|
zones: (&value.zones).try_into()?,
|
||||||
addresses: (&value.addresses).try_into()?,
|
addresses: value.addresses.iter().map_try_into().try_collect()?,
|
||||||
listeners: (&value.listeners).try_into()?,
|
listeners: value.listeners.iter().map_try_into().try_collect()?,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user