mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-10-29 15:09:49 +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:
1 parent
e6ff531d0b
commit
44d1425e5c
1 file changed
+4
-8
@@ -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