keepsimple1 / mdns-sd

Rust library for mDNS based Service Discovery
Apache License 2.0
88 stars 38 forks source link

Implemented unicast responses to direct unicast, unicast questions and legacy unicast queries. #190

Open pixsperdavid opened 3 months ago

pixsperdavid commented 3 months ago

Draft for now as I now need to construct some tests for this to verify it functions as expected.

One missing area for now is the following from RFC 6762:

When receiving a question with the unicast-response bit set, a responder SHOULD usually respond with a unicast packet directed back to the querier. However, if the responder has not multicast that record recently (within one quarter of its TTL), then the responder SHOULD instead multicast the response so as to keep all the peer caches up to date, and to permit passive conflict detection. In the case of answering a probe question (Section 8.1) with the unicast- response bit set, the responder should always generate the requested unicast response, but it may also send a multicast announcement if the time since the last multicast announcement of that record is more than a quarter of its TTL.

Implementing the above will require storing the time in which each service record was last multicasted on each specific interface so is therefore quite complex. For now I have simply used the logic that if all the questions in a given query request a unicast response, a unicast response is sent.

keepsimple1 commented 3 months ago

Implementing the above will require storing the time in which each service record was last multicasted on each specific interface so is therefore quite complex. For now I have simply used the logic that if all the questions in a given query request a unicast response, a unicast response is sent.

Sounds good to me, to implement this part later / separately.