mirror of
https://github.com/LowderPlay/cheburcheck.git
synced 2026-09-30 02:37:55 +03:00
chore: bump hickory resolver
This commit is contained in:
Generated
BIN
Binary file not shown.
+1
-1
@@ -13,7 +13,7 @@ reqwest = { workspace = true }
|
||||
csv = "1.4.0"
|
||||
maxminddb = "0.27.3"
|
||||
log = { workspace = true }
|
||||
hickory-resolver = { version = "0.26.0-beta.3", features = ["tokio", "webpki-roots", "https-ring"] }
|
||||
hickory-resolver = { version = "0.26.0", features = ["tokio", "webpki-roots", "https-ring"] }
|
||||
thiserror = "2.0.18"
|
||||
url = "2.5.8"
|
||||
indicatif = "0.18.4"
|
||||
|
||||
+20
-9
@@ -64,14 +64,14 @@ impl CdnList {
|
||||
let record: NetworkRecord = result?;
|
||||
trie.insert(record.cidr, record);
|
||||
}
|
||||
let (v4, v6) = trie.ip_count();
|
||||
info!("ip count: v4={}, v6={}", v4, v6);
|
||||
let count = trie.ip_count();
|
||||
info!("ip count: v4={}, v6={:?}", count.ipv4, count.ipv6);
|
||||
self.trie = trie;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn v4_count(&self) -> u32 {
|
||||
self.trie.ip_count().0
|
||||
pub fn v4_count(&self) -> u64 {
|
||||
self.trie.ip_count().ipv4
|
||||
}
|
||||
|
||||
pub fn contains(&self, ip: &IpAddr) -> Option<NetworkRecord> {
|
||||
@@ -141,8 +141,8 @@ impl RuBlacklist {
|
||||
IpNet::from_str(&net).map_err(|e| Error::new(io::ErrorKind::InvalidData, e))?;
|
||||
ip_trie.insert(net, ());
|
||||
}
|
||||
let (v4, v6) = ip_trie.ip_count();
|
||||
info!("ip count: v4={}, v6={}", v4, v6);
|
||||
let count = ip_trie.ip_count();
|
||||
info!("ip count: v4={}, v6={:?}", count.ipv4, count.ipv6);
|
||||
self.ip_trie = ip_trie;
|
||||
|
||||
let mut blocked_domains = Vec::new();
|
||||
@@ -160,8 +160,8 @@ impl RuBlacklist {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn v4_count(&self) -> u32 {
|
||||
self.ip_trie.ip_count().0
|
||||
pub fn v4_count(&self) -> u64 {
|
||||
self.ip_trie.ip_count().ipv4
|
||||
}
|
||||
|
||||
pub fn contains_ip(&self, ip: &IpAddr) -> Option<IpNet> {
|
||||
@@ -219,9 +219,20 @@ impl Updatable for RuBlacklist {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::RuBlacklist;
|
||||
use super::{CdnList, RuBlacklist};
|
||||
use std::io::Cursor;
|
||||
|
||||
#[test]
|
||||
fn ipv4_counts_can_represent_the_entire_address_space() {
|
||||
let cdn = CdnList::load(Cursor::new("provider,cidr,region\nexample,0.0.0.0/0,\n")).unwrap();
|
||||
let blacklist =
|
||||
RuBlacklist::load(Cursor::new("0.0.0.0/0\n"), Cursor::new(""), Cursor::new(""))
|
||||
.unwrap();
|
||||
|
||||
assert_eq!(cdn.v4_count(), 1_u64 << 32);
|
||||
assert_eq!(blacklist.v4_count(), 1_u64 << 32);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn domain_lookup_matches_subdomains_on_label_boundaries() {
|
||||
let list = RuBlacklist::load(
|
||||
|
||||
@@ -77,7 +77,7 @@ impl Resolver {
|
||||
.map_err(map_resolve_error)?
|
||||
.answers()
|
||||
.iter()
|
||||
.filter_map(|record| match record.data() {
|
||||
.filter_map(|record| match &record.data {
|
||||
RData::PTR(ptr) => Some(ptr.to_string().trim_end_matches('.').to_string()),
|
||||
_ => None,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user