pub struct Endpoint { /* private fields */ }Expand description
Handle to a running mDNS endpoint.
Cloneable; every clone shares the same underlying driver task. The driver
task is spawned at Self::server time and exits when the last clone is
dropped (the command channel closes).
Implementations§
Source§impl Endpoint
impl Endpoint
Sourcepub async fn browse(&self, param: QueryParam) -> Result<Lookup, StartQueryError>
pub async fn browse(&self, param: QueryParam) -> Result<Lookup, StartQueryError>
Browse for instances of a DNS-SD service type, resolving each into a
ServiceEntry. See Lookup and QueryParam.
Sourcepub async fn lookup(
&self,
service: Name,
timeout: Duration,
) -> Result<Lookup, StartQueryError>
pub async fn lookup( &self, service: Name, timeout: Duration, ) -> Result<Lookup, StartQueryError>
Convenience for Self::browse with default parameters and the given
browse timeout.
Sourcepub async fn resolve_host(
&self,
host: Name,
timeout: Duration,
) -> Result<Vec<IpAddr>, StartQueryError>
pub async fn resolve_host( &self, host: Name, timeout: Duration, ) -> Result<Vec<IpAddr>, StartQueryError>
Resolve a host name to its addresses via mDNS A / AAAA queries (RFC 6762), without the DNS-SD browse/resolve chain.
Issues both queries and collects every advertised address for the
timeout window (the answer window for multicast responses), returning
them IPv4 first then IPv6, deduplicated and capped per family. The result
is empty if nothing answers. Unlike Self::resolve_instance this does
not require — or interpret — DNS-SD records; it is the multicast analogue
of resolving a hostname.
Sourcepub async fn resolve_instance(
&self,
instance: Name,
timeout: Duration,
) -> Result<Option<ServiceEntry>, StartQueryError>
pub async fn resolve_instance( &self, instance: Name, timeout: Duration, ) -> Result<Option<ServiceEntry>, StartQueryError>
Resolve a known DNS-SD service instance directly into a ServiceEntry,
skipping the PTR browse step (e.g.
Name::try_from_str("Office._ipp._tcp.local.")).
Issues SRV + TXT for the instance and A / AAAA for the SRV target host, and
returns the first complete resolution — host + port, TXT, and at least one
address — or None if it does not complete within timeout. Use
Self::browse instead when the instance names are not known in advance.
Source§impl Endpoint
impl Endpoint
Sourcepub async fn server<N: Net>(opts: ServerOptions) -> Result<Self, ServerError>
pub async fn server<N: Net>(opts: ServerOptions) -> Result<Self, ServerError>
Bind the multicast sockets configured in opts and spawn the driver
task on the runtime exposed by N.
Sourcepub fn stats(&self) -> StatsSnapshot
Available on crate feature stats only.
pub fn stats(&self) -> StatsSnapshot
stats only.Return a point-in-time snapshot of the I/O + protocol counters for this endpoint.
The snapshot includes both counters incremented by the mdns-proto layer
(parse errors, cache operations, service/query lifecycle) and counters
added by the driver layer (raw wire rx/tx byte counts, socket-level send
errors). All counters share the same stats::Stats instance
so the snapshot is a single consistent view.
Sourcepub async fn register_service(
&self,
spec: ServiceSpec,
) -> Result<Service, RegisterError>
pub async fn register_service( &self, spec: ServiceSpec, ) -> Result<Service, RegisterError>
Register a new service with the responder. The returned Service
streams ServiceUpdate events; dropping
it unregisters the service.
Sourcepub async fn start_query(
&self,
spec: QuerySpec,
) -> Result<Query, StartQueryError>
pub async fn start_query( &self, spec: QuerySpec, ) -> Result<Query, StartQueryError>
Start a new query. The returned Query streams
QueryEvent values; dropping it cancels the query.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Endpoint
impl RefUnwindSafe for Endpoint
impl Send for Endpoint
impl Sync for Endpoint
impl Unpin for Endpoint
impl UnsafeUnpin for Endpoint
impl UnwindSafe for Endpoint
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more