balena-io-modules / bonjour

A Bonjour/Zeroconf protocol implementation in JavaScript
MIT License
8 stars 3 forks source link

Adds PTR records for `_services._dns-sd._udp.local` on every published service. #1

Closed hedss closed 7 years ago

hedss commented 7 years ago

This allows service type enumeration to occur (allowing a node to determine all services published by the host).

See the DNS-SD RFC for more information.

lekkas commented 7 years ago

@hedss can you please provide some context behind this PR? For instance, can you explain how this change will be used by the resin-discoverable-services module? What extra feature will this add, given that resin-discoverable-services can already discover resinOS devices? [Edit: atm r-d-s discovers resinOS, not resin.io devices on the LAN)

hedss commented 7 years ago

@lekkas Sure. At the moment, resin-discoverable-services allows for the discovery (and with the latest updates) publishing of services. However, there are parts of the DNS-SD RFC that bonjour doesn't implement, such as advertising all the services it currently has published, which I'd like resin-discoverable-services to include.

According to the DNS-SD RFC, a client may issue a _services._dns-sd._udp.local MDNS request to ask for all the services that any local node has published. This PR implements the ability to respond to such a request, by including a PTR record for it with each published service.

The intention is to use resin-discoverable-services as a 'full fat' client/server that'll allow us to also use it with the backend architecture (at the moment, I'm mostly concerned about the DevEnv and advertising the services within it).