31 lines
887 B
TOML
Raw Normal View History

[package]
name = "libp2p-mdns"
edition = "2018"
version = "0.32.0"
description = "Implementation of the libp2p mDNS discovery method"
authors = ["Parity Technologies <admin@parity.io>"]
license = "MIT"
repository = "https://github.com/libp2p/rust-libp2p"
keywords = ["peer-to-peer", "libp2p", "networking"]
categories = ["network-programming", "asynchronous"]
[dependencies]
async-io = "1.3.1"
data-encoding = "2.3.2"
dns-parser = "0.8.0"
futures = "0.3.13"
if-watch = "0.2.0"
lazy_static = "1.4.0"
libp2p-core = { version = "0.30.0", path = "../../core" }
libp2p-swarm = { version = "0.31.0", path = "../../swarm" }
log = "0.4.14"
rand = "0.8.3"
smallvec = "1.6.1"
socket2 = { version = "0.4.0", features = ["all"] }
void = "1.0.2"
misc/mdns: Update to futures-preview (#1247) * misc/mdns/service: Use async std with stack pinned futures * misc/mdns: Define mdns broadcast address as lazy static * misc/mdns: Drop future before borrowing their arguments again * misc/mdns: Send queries on query socket, not socket * misc/mdns: Use poll_next_unpin on query interval stream * misc/mdns: Ensure underlying task is woken up on next interval tick * misc/mdns: Wrap match expression in scope to drop future early * misc/mdns: Adjust 'discovery_ourselves' test * misc/mdns: Make query interval fire instantly on first tick This is an optimization only important for short lived use cases, e.g. unit tests. Instead of waiting for 20 seconds at first, the query interval fires right away and thereby the service makes progress instantly. * misc/mdns: Adjust MdnsService documentation tests * misc/mdns: Do not drop UDP socket send and reicv futures Libp2p-mdns uses the async-std crate for network io. This crate only offers async send and receive functions. In order to use this in non async/await functions one needs to keep the future returned by the crate functions around across `poll` invocations. The future returned by the crate functions references the io resource. Thus one has to keep both the io resource as well as the future referencing it. This results in a self-referencing struct which is not possible to create with safe Rust. Instead, by having `MdnsService::next` (former `MdnsService::poll`) take ownership of `self`, the Rust async magic takes care of the above (See code comments for more details). As a (negative) side effect, given that `MdnsService::next` takes ownership of `self`, there is nothing to bind the lifetime of the returned `MdnsPacket` to. With no better solution in mind, this patch makes `MdnsPacket` static, not referencing the `MdnsService` receive buffer. * misc/mdns: Fix code comments and remove *if Free* TODO * misc/mdns: Minor refactorings * misc/mdns: Build responses in behaviour.rs directly * misc/mdns: Move response ttl duration to constant * misc/mdns: Remove optimization todo comment * misc/mdns: Add query interval test * misc/mdns: Move packet parsing into MdnPacket impl * misc/mdns: Don't have receiving packets starve the query interval When we 'await' on receiving a packet on the udp socket without receiving a single packet we starve the remaining logic of the mdns service, in this case the logic triggered on the receive interval. * misc/mdns: Add debug_assert to MaybeBusyMdnsService check * misc/mdns: Implement Debug for MaybeBusyMdnsService * misc/mdns: Make ownership note a normal comment, not a doc comment * misc/mdns: Have discovered_peers return an iterator
2019-11-20 13:25:12 +01:00
[dev-dependencies]
async-std = "1.9.0"
if-addrs = "0.6.5"
tokio = { version = "1.2.0", default-features = false, features = ["rt", "rt-multi-thread"] }