Skip to main content

Crate dns_sd_native

Crate dns_sd_native 

Source
Expand description

Access the operating system’s built-in DNS-SD / mDNS stack for service registration.

This crate provides a cross-platform async API (using Tokio) for registering DNS-SD services via the native OS facilities:

  • macOS: native DNS-SD framework (available since macOS 10.12)
  • Windows: native Win32 DNS-SD API (available since Windows 10)
  • Linux/FreeBSD: Avahi via D-Bus (no binary dependency on libavahi)

Note: This crate currently supports registration of services only, not browsing/discovery.

§Example

use dns_sd_native::ServiceRegistrationBuilder;

let service = ServiceRegistrationBuilder::new("_http._tcp", 8080)
    .name("My Web Server")
    .register()
    .await?;

// Service is now discoverable on the network.
// It will be automatically unregistered when dropped,
// or you can unregister explicitly:
service.unregister().await?;

Structs§

ServiceRegistration
Reference to a registered service instance.
ServiceRegistrationBuilder
Builder for DNS-SD service registrations.

Enums§

ServiceRegistrationError
Error type for service registration failures.