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

DNS-SD compatibility #13

Open
sammacbeth opened this issue Oct 18, 2019 · 2 comments
Open

DNS-SD compatibility #13

sammacbeth opened this issue Oct 18, 2019 · 2 comments

Comments

@sammacbeth
Copy link

sammacbeth commented Oct 18, 2019

It seems that the usage of multicast-dns here differs from the DNS-SD standard. This means that libraries and applications implementing these standards will ignore these broadcasts. This is an issue for applications that want to interopt with hyperswarm, but must use a higher level API (like ServiceDiscovery, Bonjour etc). This was also mentioned in #7 as an issue for mobile support in react-native.

Would it be possible to tweak the mdns usage to follow this standard? For example using a module such as bonjour (which is just a thin layer on top of multicast-dns) would do this.

@mafintosh
Copy link
Contributor

As long as it can be done with the same amount of roundtrips (i.e. 1) I'm 👍 if someone wants to try this out.

AFAIK it just involves adding the PTR record before sending the SRV which I think can be done in 1 roundtrip if you use the additional section of the record.

@sammacbeth
Copy link
Author

I had a little look into this. Unfortunately, with only a superficial knowledge of MDNS I was not able to work out how to add DNS-SD compatibility directly via multicast-dns usage. However, this seems to be exactly what the bonjour library is doing, and it's API is fairly simple to consume.

Testing with bonjour, it would be possible to announce and lookup as follows:

// announce
bonjour.publish({ name: key.toString('hex') type: 'hyperswarm', port: 10000 })
// lookup
bonjour.find({ type: 'hyperswarm' }, callback);

As this is DNS-SD compatible, tools such as dns-sd can see these announces:

$ dns-sd -B _hyperswarm local
DATE: ---Mon 21 Oct 2019---
18:01:05.959  ...STARTING...
Timestamp     A/R    Flags  if Domain               Service Type         Instance Name
18:01:05.960  Add        3   9 local.               _hyperswarm._tcp.    18bf0e130d7bd2b0c395e170312cddcecae54a04

Would it be ok to add a dependency on bonjour to implement this, or is there an advantage to implementing directly on multicast-dns?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants