mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-06 03:18:01 +00:00
* replace is_global to is_private, maybe fixing #9922 * use of ip_network for private_ipv4 filtering * check is_global for both ip4 and ip6 * fix for rustfmt
This commit is contained in:
@@ -512,14 +512,10 @@ impl NetworkBehaviour for DiscoveryBehaviour {
|
||||
list_to_filter.extend(self.mdns.addresses_of_peer(peer_id));
|
||||
|
||||
if !self.allow_private_ipv4 {
|
||||
list_to_filter.retain(|addr| {
|
||||
if let Some(Protocol::Ip4(addr)) = addr.iter().next() {
|
||||
if addr.is_private() {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
true
|
||||
list_to_filter.retain(|addr| match addr.iter().next() {
|
||||
Some(Protocol::Ip4(addr)) if !IpNetwork::from(addr).is_global() => false,
|
||||
Some(Protocol::Ip6(addr)) if !IpNetwork::from(addr).is_global() => false,
|
||||
_ => true,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user