Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow custom service name for mDNS #5949

Open
erhant opened this issue Mar 24, 2025 · 3 comments
Open

feat: allow custom service name for mDNS #5949

erhant opened this issue Mar 24, 2025 · 3 comments
Labels
decision-pending Marks issues where a decision is pending before we can move forward.

Comments

@erhant
Copy link

erhant commented Mar 24, 2025

Description

The mdns protocol always uses _p2p._udp (see here) as its service name.

We should be able to provide our own service name for mDNS instead.

Motivation

Multiple protocols on a single node using libp2p-mdns will collide due to service name, and have to resolve their collision at application level / other protocol's level (e.g. different gossipsub topic).

It makes most sense to allow a specific service name for the developer, also makes diagnostics with dns-sd command much easier.

Requirements

  • Allow service name to be provided from Config
  • Ensure that service name is well-formed (RFC6763 section 7)

Open questions

No response

Are you planning to do it yourself in a pull request?

Maybe

@elenaf9
Copy link
Contributor

elenaf9 commented Mar 26, 2025

The hardcoded _p2p._udp.local service name is part of the libp2p specs1.

Still, I agree that it is a realistic use-case that multiple protocols, or even multiple nodes in the same private network, need isolated mDNS discovery.
The default should still be _p2p._udp.local, but we can make it part of the config that a user can overwrite.

CC @jxs wdyt?

Footnotes

  1. https://github.com/libp2p/specs/blob/master/discovery/mdns.md#request

@elenaf9 elenaf9 added the decision-pending Marks issues where a decision is pending before we can move forward. label Mar 26, 2025
@erhant
Copy link
Author

erhant commented Mar 28, 2025

I would like to piggyback this issue with another question as well, is there a way for the user to add their custom TXT records? This would be reaaaallllly useful for my case, if possible 🙏🏻

@jxs
Copy link
Member

jxs commented Mar 28, 2025

Hi, thanks for the ping @elenaf9, this has been discussed before on #2898 and a spec issue was opened libp2p/specs#620 I think this should be discussed at the spec level.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
decision-pending Marks issues where a decision is pending before we can move forward.
Projects
None yet
Development

No branches or pull requests

3 participants