chore: remove unused deps, add cargo audit to CI

This commit is contained in:
Marco Cadetg
2025-12-29 17:19:51 +01:00
parent 87c9cf6529
commit e87696b4b5
8 changed files with 46 additions and 73 deletions

View File

@@ -8,8 +8,8 @@ use dashmap::DashMap;
use dns_lookup::lookup_addr;
use log::debug;
use std::net::IpAddr;
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::Arc;
use std::sync::atomic::{AtomicBool, Ordering};
use std::thread;
use std::time::{Duration, Instant};
@@ -151,7 +151,7 @@ impl DnsResolver {
ResolutionState::Pending => continue,
ResolutionState::Resolved if age < cache_ttl => continue,
ResolutionState::Failed if age < negative_cache_ttl => {
continue
continue;
}
_ => {} // Expired, re-resolve
}
@@ -215,10 +215,8 @@ impl DnsResolver {
// If cache is too large, remove oldest entries
if cache.len() > max_cache_size {
let mut entries: Vec<_> = cache
.iter()
.map(|e| (*e.key(), e.resolved_at))
.collect();
let mut entries: Vec<_> =
cache.iter().map(|e| (*e.key(), e.resolved_at)).collect();
entries.sort_by_key(|(_, time)| *time);
let to_remove = cache.len() - max_cache_size;
@@ -336,7 +334,11 @@ mod tests {
// Loopback should not be queued
resolver.request_resolution("127.0.0.1".parse().unwrap());
assert!(resolver.get_hostname(&"127.0.0.1".parse().unwrap()).is_none());
assert!(
resolver
.get_hostname(&"127.0.0.1".parse().unwrap())
.is_none()
);
resolver.stop();
}

View File

@@ -35,7 +35,6 @@ impl InterfaceStatsProvider for FreeBSDStatsProvider {
let mut current = ifap;
while let Some(ifa) = current.as_ref() {
// Only process AF_LINK entries (data link layer)
if !ifa.ifa_addr.is_null() && (*ifa.ifa_addr).sa_family as i32 == libc::AF_LINK {
let name = CStr::from_ptr(ifa.ifa_name).to_string_lossy().to_string();

View File

@@ -56,7 +56,6 @@ impl InterfaceStatsProvider for MacOSStatsProvider {
let mut current = ifap;
while let Some(ifa) = current.as_ref() {
// Only process AF_LINK entries (data link layer)
if !ifa.ifa_addr.is_null() && (*ifa.ifa_addr).sa_family as i32 == libc::AF_LINK {
let name = CStr::from_ptr(ifa.ifa_name).to_string_lossy().to_string();