7 releases

Uses new Rust 2024

new 0.3.0 May 21, 2026
0.2.0 May 20, 2026
0.1.4 Jul 21, 2025
0.1.3 May 8, 2025

#17 in #multicast

Download history 309/week @ 2026-05-17

309 downloads per month
Used in 65 crates (2 directly)

MPL-2.0 license

60KB
786 lines

switchy_mdns

mDNS service registration for MoosicBox servers.

Features

  • Service Registration: Register MoosicBox servers on the local network via mDNS
  • Simulator: Simulated mDNS daemon for testing (enabled by default)

Cargo Features

Feature Default Description
simulator Yes Provides a simulated mDNS daemon for testing
fail-on-warnings No Enables strict warning handling through the moosicbox_assert crate

Installation

[dependencies]
switchy_mdns = "0.1.4"

# Or disable default features (disables the simulator)
switchy_mdns = { version = "0.1.4", default-features = false }

Usage

Registering a Service

use switchy_mdns::register_service;

async fn example() -> Result<(), switchy_mdns::RegisterServiceError> {
    register_service("my-server", "192.168.1.100", 8080).await?;
    Ok(())
}

Public API

  • register_service(instance_name, ip, port): Registers a MoosicBox mDNS service instance
  • SERVICE_TYPE: The service type constant used for registration (_moosicboxserver._tcp.local.)
  • RegisterServiceError: Error type returned by register_service
    • RegisterServiceError::MdnsSd: Underlying mdns_sd daemon or registration error
    • RegisterServiceError::IO: Hostname lookup I/O error
  • switchy_mdns::service::MdnsServiceDaemon: Trait abstraction for service daemon implementations
  • switchy_mdns::service::MdnsSdServiceDaemon: Wrapper for real mdns_sd::ServiceDaemon
  • switchy_mdns::service::simulator::SimulatorServiceDaemon: Simulator daemon (available with simulator feature)

License

This project is licensed under the MPL-2.0 License.

Dependencies

~1–12MB
~70K SLoC