-
Notifications
You must be signed in to change notification settings - Fork 43
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
Add support for resolving non-service hostnames #192
Add support for resolving non-service hostnames #192
Conversation
26f6320
to
823132a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your PR! With a quick look, it didn't feel quite right for me, even though it is based on what already discussed. I left one inline comment, but I need more time to think through and review other parts.
(I'm hoping to simplify the current solution and still meet your needs)
823132a
to
35c5422
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I went through the whole diff 😅 . It looks good to me overall. Please see inline for some comments. The main thing is still regarding the public API & enum. (That's always the hard part for a library ;-) ).
Also, could you please add test cases for this new feature? Thanks!
8540036
to
6e2762d
Compare
Okay, so I've added a |
69a8f32
to
ec0fd0a
Compare
ec0fd0a
to
51098fa
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the updates!
Btw, I added support for sending multiple questions in one query. You can try out the new |
69e0b37
to
2b7ae71
Compare
2b7ae71
to
d1eb6d3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for updating! Looks good! I only have one minor inline comment regarding naming.
d0e6ca6
to
1af65f9
Compare
1af65f9
to
69e6da2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks!
Resolves #191.
This adds several pieces of public API, for resolving mDNS hostnames as standalone.
ServiceDaemon::resolve(&self, hostname: &str) -> Result<Receiver<ResolutionEvent>>
ServiceDaemon::stop_resolve(&self, hostname: &str) -> Result<()>
as well as
The internal implementation uses the dns cache for addresses, which should make it possible for service discovery and hostname discovery to benefit from each other in the case that you are running both at the same time.
The rest of the implementation is largely either copy paste of- or merging with the code that handles the service discovery, with some exceptions where the events are reporting an aggregate of ip-addresses rather than reporting one at a time.
Other notes
I refactored
DnsCache::evict_expired
to resolve some borrow checker issues. The current implementation will evict all expired records before it starts sending out events. It should not have any effect on any users ofServiceDaemon::browse
, since they don't have direct access to the cache.The current implementation is a bit loud, because it's missing Known Answer Suppression (RFC6762, sec. 7.1) (which is stated as a MUST requirement). As far as I understand, the current implementation for service browsing does not have this either, so I think it should be considered as a new issue.