Change metrics whitelist to use IpNetwork

This commit is contained in:
artemws 2026-02-20 16:03:57 +02:00 committed by GitHub
parent dbd9b53940
commit 0d2958fea7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 2 deletions

View File

@ -1,5 +1,6 @@
use std::net::IpAddr; use std::net::IpAddr;
use std::collections::HashMap; use std::collections::HashMap;
use ipnetwork::IpNetwork;
use serde::Deserialize; use serde::Deserialize;
// Helper defaults kept private to the config module. // Helper defaults kept private to the config module.
@ -66,8 +67,11 @@ pub(crate) fn default_weight() -> u16 {
1 1
} }
pub(crate) fn default_metrics_whitelist() -> Vec<IpAddr> { pub(crate) fn default_metrics_whitelist() -> Vec<IpNetwork> {
vec!["127.0.0.1".parse().unwrap(), "::1".parse().unwrap()] vec![
"127.0.0.1/32".parse().unwrap(),
"::1/128".parse().unwrap(),
]
} }
pub(crate) fn default_prefer_4() -> u8 { pub(crate) fn default_prefer_4() -> u8 {