protocols/mdns: Removed obsolete lazy static use from mdns (#2977)

Co-authored-by: Max Inden <mail@max-inden.de>
This commit is contained in:
Hannes
2022-10-05 01:26:30 +02:00
committed by GitHub
parent 4577c5a81d
commit da0403dc45
4 changed files with 7 additions and 9 deletions

View File

@@ -8,8 +8,11 @@
- Fix a bug that could cause a delay of ~10s until peers would get discovered when using the tokio runtime. See [PR 2939]. - Fix a bug that could cause a delay of ~10s until peers would get discovered when using the tokio runtime. See [PR 2939].
- Removed the `lazy_static` dependency. See [PR 2977].
[PR 2918]: https://github.com/libp2p/rust-libp2p/pull/2918 [PR 2918]: https://github.com/libp2p/rust-libp2p/pull/2918
[PR 2939]: https://github.com/libp2p/rust-libp2p/pull/2939 [PR 2939]: https://github.com/libp2p/rust-libp2p/pull/2939
[PR 2977]: https://github.com/libp2p/rust-libp2p/pull/2977
# 0.40.0 # 0.40.0

View File

@@ -15,7 +15,6 @@ data-encoding = "2.3.2"
dns-parser = "0.8.0" dns-parser = "0.8.0"
futures = "0.3.13" futures = "0.3.13"
if-watch = "1.1.1" if-watch = "1.1.1"
lazy_static = "1.4.0"
libp2p-core = { version = "0.37.0", path = "../../core" } libp2p-core = { version = "0.37.0", path = "../../core" }
libp2p-swarm = { version = "0.40.0", path = "../../swarm" } libp2p-swarm = { version = "0.40.0", path = "../../swarm" }
log = "0.4.14" log = "0.4.14"

View File

@@ -120,8 +120,8 @@ where
config.query_interval + Duration::from_millis(jitter) config.query_interval + Duration::from_millis(jitter)
}; };
let multicast_addr = match addr { let multicast_addr = match addr {
IpAddr::V4(_) => IpAddr::V4(*crate::IPV4_MDNS_MULTICAST_ADDRESS), IpAddr::V4(_) => IpAddr::V4(crate::IPV4_MDNS_MULTICAST_ADDRESS),
IpAddr::V6(_) => IpAddr::V6(*crate::IPV6_MDNS_MULTICAST_ADDRESS), IpAddr::V6(_) => IpAddr::V6(crate::IPV6_MDNS_MULTICAST_ADDRESS),
}; };
Ok(Self { Ok(Self {
addr, addr,

View File

@@ -30,7 +30,6 @@
//! implements the `NetworkBehaviour` trait. This struct will automatically discover other //! implements the `NetworkBehaviour` trait. This struct will automatically discover other
//! libp2p nodes on the local network. //! libp2p nodes on the local network.
//! //!
use lazy_static::lazy_static;
use std::net::{Ipv4Addr, Ipv6Addr}; use std::net::{Ipv4Addr, Ipv6Addr};
use std::time::Duration; use std::time::Duration;
@@ -48,11 +47,8 @@ const SERVICE_NAME: &[u8] = b"_p2p._udp.local";
/// The meta query for looking up the `SERVICE_NAME`. /// The meta query for looking up the `SERVICE_NAME`.
const META_QUERY_SERVICE: &[u8] = b"_services._dns-sd._udp.local"; const META_QUERY_SERVICE: &[u8] = b"_services._dns-sd._udp.local";
lazy_static! { pub const IPV4_MDNS_MULTICAST_ADDRESS: Ipv4Addr = Ipv4Addr::new(224, 0, 0, 251);
pub static ref IPV4_MDNS_MULTICAST_ADDRESS: Ipv4Addr = Ipv4Addr::new(224, 0, 0, 251); pub const IPV6_MDNS_MULTICAST_ADDRESS: Ipv6Addr = Ipv6Addr::new(0xFF02, 0, 0, 0, 0, 0, 0, 0xFB);
pub static ref IPV6_MDNS_MULTICAST_ADDRESS: Ipv6Addr =
Ipv6Addr::new(0xFF02, 0, 0, 0, 0, 0, 0, 0xFB);
}
/// Configuration for mDNS. /// Configuration for mDNS.
#[derive(Debug, Clone)] #[derive(Debug, Clone)]