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
309 downloads per month
Used in 65 crates
(2 directly)
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 instanceSERVICE_TYPE: The service type constant used for registration (_moosicboxserver._tcp.local.)RegisterServiceError: Error type returned byregister_serviceRegisterServiceError::MdnsSd: Underlyingmdns_sddaemon or registration errorRegisterServiceError::IO: Hostname lookup I/O error
switchy_mdns::service::MdnsServiceDaemon: Trait abstraction for service daemon implementationsswitchy_mdns::service::MdnsSdServiceDaemon: Wrapper for realmdns_sd::ServiceDaemonswitchy_mdns::service::simulator::SimulatorServiceDaemon: Simulator daemon (available withsimulatorfeature)
License
This project is licensed under the MPL-2.0 License.
Dependencies
~1–12MB
~70K SLoC