[PR #1347] [MERGED] Discovery: Refactor and add Avahi DBus backend #1349

Closed
opened 2026-02-27 20:02:06 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/librespot-org/librespot/pull/1347
Author: @wisp3rwind
Created: 9/23/2024
Status: Merged
Merged: 10/26/2024
Merged by: @roderickvd

Base: devHead: avahi-dbus-v2


📝 Commits (10+)

  • 903843f discovery: use opaque error type for DnsSdError
  • 09a6171 discovery: map all MDNS/DNS-SD errors to DiscoveryError::DnsSdError
  • 62e14e5 discovery: de-duplicate zerconf data into module consts
  • 9e6c615 discovery: use an opaque type for the handle to the DNS-SD service
  • 5383be1 discovery: move service registration into separate functions
  • 283a501 discovery: make features additive
  • c8744a5 discovery: add --zeroconf-backend CLI flag
  • 512c558 discovery: Add minimal Avahi zeroconf backend
  • c9f0aeb bump MSRV to 1.75
  • 582537a update Cargo.lock and docs

📊 Changes

15 files changed (+1156 additions, -129 deletions)

View changed files

📝 .devcontainer/Dockerfile (+1 -1)
📝 .github/workflows/test.yml (+3 -3)
📝 CHANGELOG.md (+5 -0)
📝 COMPILING.md (+11 -0)
📝 Cargo.lock (+432 -12)
📝 Cargo.toml (+7 -4)
📝 contrib/Dockerfile (+1 -1)
📝 core/Cargo.toml (+0 -4)
📝 core/src/error.rs (+0 -10)
📝 discovery/Cargo.toml (+9 -2)
discovery/src/avahi.rs (+151 -0)
📝 discovery/src/lib.rs (+395 -42)
📝 discovery/src/server.rs (+36 -30)
📝 oauth/Cargo.toml (+1 -1)
📝 src/main.rs (+104 -19)

📄 Description

So... I was mildly annoyed by the

*** WARNING *** The program 'librespot' uses the Apple Bonjour compatibility layer of Avahi.
*** WARNING *** Please fix your application to use the native API of Avahi!
*** WARNING *** For more information see <http://0pointer.de/blog/projects/avahi-compat.html>

warnings from the dns_sd compat library and thought it would be a fun little project to write an additional MDNS/DNS-SD backend that directly talks to Avahi via DBus.

This PR is a minimal working example of that. I made quite some refactorings to the discovery module in order to keep the code readable and not litter it too much with #[cfg(feature = "with-xyz")] guards. This should be fairly easy to review by looking at the individual commits and their messages.

I have a local branch with some more error handling in the avahi_task, but I'd be happy about your opinion on this before making things more complicated (I'd also need to clean that up a bit).

Does this have a place in librespot upstream? If so, I'd add some more documentation around the new feature flags and commandline flag.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/librespot-org/librespot/pull/1347 **Author:** [@wisp3rwind](https://github.com/wisp3rwind) **Created:** 9/23/2024 **Status:** ✅ Merged **Merged:** 10/26/2024 **Merged by:** [@roderickvd](https://github.com/roderickvd) **Base:** `dev` ← **Head:** `avahi-dbus-v2` --- ### 📝 Commits (10+) - [`903843f`](https://github.com/librespot-org/librespot/commit/903843fb673b17048030798caf469d1d594853c6) discovery: use opaque error type for DnsSdError - [`09a6171`](https://github.com/librespot-org/librespot/commit/09a6171b6b47cca2b7db8a91e0f436bc72d66ea0) discovery: map all MDNS/DNS-SD errors to DiscoveryError::DnsSdError - [`62e14e5`](https://github.com/librespot-org/librespot/commit/62e14e55f491853c0a1d9e12acacac5f95bcc737) discovery: de-duplicate zerconf data into module consts - [`9e6c615`](https://github.com/librespot-org/librespot/commit/9e6c615a2a7fef7f977b5a4b34e4c7ca6f0310d4) discovery: use an opaque type for the handle to the DNS-SD service - [`5383be1`](https://github.com/librespot-org/librespot/commit/5383be11691ff388e714fad3f935a621b5f6f759) discovery: move service registration into separate functions - [`283a501`](https://github.com/librespot-org/librespot/commit/283a501bbe9a91fe2e06ae4b5fe2104561c0b592) discovery: make features additive - [`c8744a5`](https://github.com/librespot-org/librespot/commit/c8744a52364f96d83f94297ea3d4da8c1628e7a4) discovery: add --zeroconf-backend CLI flag - [`512c558`](https://github.com/librespot-org/librespot/commit/512c5580aa76468e88e58e2dcb4a735729fbb631) discovery: Add minimal Avahi zeroconf backend - [`c9f0aeb`](https://github.com/librespot-org/librespot/commit/c9f0aeb7c0408f71f99e732e4fb7fa6d1a4d6497) bump MSRV to 1.75 - [`582537a`](https://github.com/librespot-org/librespot/commit/582537a0313b1d5b359d1e791901b0d80b613f00) update Cargo.lock and docs ### 📊 Changes **15 files changed** (+1156 additions, -129 deletions) <details> <summary>View changed files</summary> 📝 `.devcontainer/Dockerfile` (+1 -1) 📝 `.github/workflows/test.yml` (+3 -3) 📝 `CHANGELOG.md` (+5 -0) 📝 `COMPILING.md` (+11 -0) 📝 `Cargo.lock` (+432 -12) 📝 `Cargo.toml` (+7 -4) 📝 `contrib/Dockerfile` (+1 -1) 📝 `core/Cargo.toml` (+0 -4) 📝 `core/src/error.rs` (+0 -10) 📝 `discovery/Cargo.toml` (+9 -2) ➕ `discovery/src/avahi.rs` (+151 -0) 📝 `discovery/src/lib.rs` (+395 -42) 📝 `discovery/src/server.rs` (+36 -30) 📝 `oauth/Cargo.toml` (+1 -1) 📝 `src/main.rs` (+104 -19) </details> ### 📄 Description So... I was mildly annoyed by the ``` *** WARNING *** The program 'librespot' uses the Apple Bonjour compatibility layer of Avahi. *** WARNING *** Please fix your application to use the native API of Avahi! *** WARNING *** For more information see <http://0pointer.de/blog/projects/avahi-compat.html> ``` warnings from the `dns_sd` compat library and thought it would be a fun little project to write an additional MDNS/DNS-SD backend that directly talks to Avahi via DBus. This PR is a minimal working example of that. I made quite some refactorings to the discovery module in order to keep the code readable and not litter it too much with `#[cfg(feature = "with-xyz")]` guards. This should be fairly easy to review by looking at the individual commits and their messages. I have a local branch with some more error handling in the `avahi_task`, but I'd be happy about your opinion on this before making things more complicated (I'd also need to clean that up a bit). Does this have a place in librespot upstream? If so, I'd add some more documentation around the new feature flags and commandline flag. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-27 20:02:06 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/librespot#1349
No description provided.