fix: filter overlapped proxy cidrs in ProxyCidrsMonitor (#2079)

* feat(route): add async methods to list proxy CIDRs for IPv4 and IPv6
* refactor(ProxyCidrsMonitor): get proxy cidrs from list_proxy_cidrs
This commit is contained in:
Luna Yao
2026-04-12 16:18:54 +02:00
committed by GitHub
parent 6f3e708679
commit ec7ddd3bad
4 changed files with 66 additions and 30 deletions
+13 -6
View File
@@ -1,3 +1,8 @@
use anyhow::Context;
use async_trait::async_trait;
use cidr::{Ipv4Cidr, Ipv6Cidr};
use dashmap::DashMap;
use std::collections::BTreeSet;
use std::{
fmt::Debug,
net::{IpAddr, Ipv4Addr, Ipv6Addr},
@@ -5,11 +10,6 @@ use std::{
time::{Duration, Instant, SystemTime},
};
use anyhow::Context;
use async_trait::async_trait;
use dashmap::DashMap;
use tokio::{
sync::{
Mutex, RwLock,
@@ -1254,6 +1254,14 @@ impl PeerManager {
self.get_route().get_peer_info_last_update_time().await
}
pub async fn list_proxy_cidrs(&self) -> BTreeSet<Ipv4Cidr> {
self.get_route().list_proxy_cidrs().await
}
pub async fn list_proxy_cidrs_v6(&self) -> BTreeSet<Ipv6Cidr> {
self.get_route().list_proxy_cidrs_v6().await
}
pub async fn dump_route(&self) -> String {
self.get_route().dump().await
}
@@ -1985,7 +1993,6 @@ impl PeerManager {
#[cfg(test)]
mod tests {
use std::{
fmt::Debug,
sync::Arc,