1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
//! Access the operating system's built-in
//! [DNS-SD](https://en.wikipedia.org/wiki/Zero-configuration_networking#DNS-based_service_discovery) /
//! [mDNS](https://en.wikipedia.org/wiki/Multicast_DNS) stack for service
//! discovery.
//!
//! This crate provides a cross-platform async API (using [Tokio](https://tokio.rs)) for
//! browsing DNS-SD services via the native OS facilities:
//!
//! - **macOS**: native [DNS-SD framework](https://developer.apple.com/documentation/dnssd) (available since macOS 10.12)
//! - **Windows**: native [Win32 DNS-SD API](https://learn.microsoft.com/en-us/uwp/api/windows.networking.servicediscovery.dnssd?view=winrt-28000) (available since Windows 10)
//! - **Linux/FreeBSD**: [Avahi](https://avahi.org) via D-Bus (no binary dependency on libavahi)
//!
//! Service registration lives in a separate crate.
//!
//! # Discovery
//!
//! By default a [`ServiceBrowser`] discovers every service type on the network.
//! Filter on [`DiscoveredService::service_type`], or narrow to a single type
//! with [`ServiceBrowserBuilder::service_type`].
//!
//! ```no_run
//! use mdns_sd_discovery::{BrowseEvent, ServiceBrowserBuilder};
//!
//! # async fn example() -> Result<(), Box<dyn std::error::Error>> {
//! let mut browser = ServiceBrowserBuilder::new().browse().await?;
//!
//! while let Some(event) = browser.recv().await {
//! match event? {
//! BrowseEvent::Found(svc) => {
//! println!("+ [{}] {} at {}:{}", svc.service_type, svc.name, svc.host_name, svc.port);
//! }
//! BrowseEvent::Removed(svc) => println!("- [{}] {}", svc.service_type, svc.name),
//! }
//! }
//! // Dropping `browser` stops the browse.
//! # Ok(())
//! # }
//! ```
pub use *;