1#![doc = include_str!("../README.md")]
2#![cfg_attr(not(test), forbid(unsafe_code))]
3#![cfg_attr(test, deny(unsafe_code))]
4#![deny(missing_docs)]
5#![cfg_attr(docsrs, feature(doc_cfg))]
6#![cfg_attr(docsrs, allow(unused_attributes))]
7
8mod command;
9mod discovery;
10mod driver;
11mod endpoint;
12mod error;
13mod options;
14mod proto;
15mod query;
16mod service;
17#[cfg(all(test, feature = "tracing", not(miri)))]
18mod trace_cov;
19
20pub use discovery::{Lookup, QueryParam, ServiceEntry};
21pub use endpoint::Endpoint;
22pub use error::{CancelError, RegisterError, ServerError, StartQueryError};
23pub use options::ServerOptions;
24pub use query::{Query, QueryEvent};
25pub use service::Service;
26
27pub use mdns_proto::{
29 CollectedAnswer, EndpointConfig, Name, QueryHandle, QuerySpec, ServiceHandle, ServiceRecords,
30 ServiceRenamed, ServiceSpec, ServiceUpdate, config, error as proto_error, event, wire,
31};
32
33#[cfg(feature = "tokio")]
35#[cfg_attr(docsrs, doc(cfg(feature = "tokio")))]
36pub mod tokio {
37 use crate::options::ServerOptions;
38
39 pub type Endpoint = crate::Endpoint;
41
42 #[inline]
46 pub async fn server(opts: ServerOptions) -> Result<Endpoint, crate::ServerError> {
47 Endpoint::server::<agnostic_net::tokio::Net>(opts).await
48 }
49}
50
51#[cfg(feature = "smol")]
53#[cfg_attr(docsrs, doc(cfg(feature = "smol")))]
54pub mod smol {
55 use crate::options::ServerOptions;
56
57 pub type Endpoint = crate::Endpoint;
59
60 #[inline]
64 pub async fn server(opts: ServerOptions) -> Result<Endpoint, crate::ServerError> {
65 Endpoint::server::<agnostic_net::smol::Net>(opts).await
66 }
67}