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

Make Root nameserver more flexible for plugins #558

Merged
merged 4 commits into from Mar 10, 2021

Conversation

pinheadmz
Copy link
Member

@pinheadmz pinheadmz commented Feb 9, 2021

Closes #541

TODO: Include example plugins to close...

@coveralls
Copy link

coveralls commented Feb 9, 2021

Pull Request Test Coverage Report for Build 622382144

  • 11 of 17 (64.71%) changed or added relevant lines in 2 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage increased (+0.2%) to 59.578%

Changes Missing Coverage Covered Lines Changed/Added Lines %
lib/dns/server.js 11 13 84.62%
lib/node/node.js 0 4 0.0%
Files with Coverage Reduction New Missed Lines %
lib/protocol/consensus.js 1 82.79%
Totals Coverage Status
Change from base Build 615190829: 0.2%
Covered Lines: 19616
Relevant Lines: 30652

💛 - Coveralls

@pinheadmz
Copy link
Member Author

All of the use cases for this modification are exemplified in this WIP hsd plugin: https://github.com/pinheadmz/holdmyhand

The one exception might be "alternative DNS systems" but the plugin can force lookup of certain names to ICANN (before checking the HNS root zone) and it should be clear to developers that the same method can be used to redirect queries to other systems resolvers like ENS, IPFS, Sia, Footnote, etc. They will just have to return a Message object the same way ns.icann.lookup() does.

@pinheadmz
Copy link
Member Author

Moving the guide to hsd-dev.org, stay tuned for PR over there...

@pinheadmz
Copy link
Member Author

Converted to draft while working on more plugin implementations and ensure everything is properly covered.

@pinheadmz pinheadmz force-pushed the dnsplugins1 branch 4 times, most recently from a7fd332 to 1cc2086 Compare March 4, 2021 20:57
@pinheadmz pinheadmz marked this pull request as ready for review March 4, 2021 21:04
@pinheadmz
Copy link
Member Author

Okay I think this one is ready. It should be a total NO-OP unless a user has a plugin installed, examples include https://github.com/imperviousinc/handover and https://github.com/pinheadmz/holdmyhand.

Docs will be updated when merged, working on that here: handshake-org/handshake-org.github.io#113

@buffrr
Copy link
Contributor

buffrr commented Mar 7, 2021

Nice! I tried holdmyhand and handover. Having the ability to customize how the root nameserver works with plugins is going to be very useful.

@pinheadmz pinheadmz merged commit 9d6e094 into handshake-org:master Mar 10, 2021
// lookup for special TLDs before checking Urkel tree.
// We also pass the entire question in case a plugin
// is able to return an authoritative (non-referral) answer.
if (typeof this.middle === 'function') {
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe hook or resolveHook would be more intuitive name?

Copy link
Member Author

Choose a reason for hiding this comment

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

Hmmm, appreciate the feedback. I've already written two plugins using this and documented the middle() property here: https://hsd-dev.org/guides/plugins.html 🤷‍♂️

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.

DNS server should be more flexible to plugins
4 participants