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

Implement backwards-compatible discovery API that uses mDNS #89

Merged
merged 2 commits into from
Jul 30, 2020

Conversation

fabdrol
Copy link
Member

@fabdrol fabdrol commented May 19, 2020

This PR brings back compatibility with mDNS, alongside Bonjour, so that the current build doesn't break compatibility anymore. Also contains an unit test for said behaviour.

@fabdrol fabdrol requested a review from tkurki May 19, 2020 18:55
@fabdrol fabdrol mentioned this pull request May 19, 2020
Copy link
Member

@tkurki tkurki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

grumble grumble such a noisy diff, please commit formatting separately

Could @cmotelet maybe help testing this?

Have you @fabdrol tried if this restores compatibility with the server's SK discovery connections?

this.found = []
const bonjourProps = ['_server', '_registry'].join(',')
const mdnsProps = ['dns_sd', 'Advertisement', 'createAdvertisement', 'Browser'].join(',')

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we testing that the order of the keys is exactly this and these are the first keys?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First keys was just bcs I didn't want to compare every key, seemed uncessary. My thinking re the order was that, if the order didn't match, chances are that it's a different module with similar methods or a very different version of the module. That way we have a loose version check, which would catch any major changes to those modules (i.e. fingerprinting)

I would have preferred a way to check the modules identity, but I don't think that's possible besides fingerprinting. If you know of a better way that allows us to check that a module is mdns or bonjour, and that the version is within a supported range, I'm all ears :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would just call hasOwnProperty on the prop names and be done with it. Relying on the order seems needlessly brittle.

src/lib/discovery.js Outdated Show resolved Hide resolved
dist/lib/discovery.js Outdated Show resolved Hide resolved
@fabdrol fabdrol merged commit 25add73 into master Jul 30, 2020
@fabdrol fabdrol deleted the feature/mdns-backwards-compatibility branch July 30, 2020 20:51
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

Successfully merging this pull request may close these issues.

3 participants