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

chore: refactor dns #250

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

LiquidTheDangerous
Copy link
Collaborator

@LiquidTheDangerous LiquidTheDangerous commented Sep 17, 2024

A minor refactoring of the DNS functionality has been completed. The dns.Resolve function had an unclear interface and primarily handled cross-cutting concerns (such as logging and error handling). A new entity, the DNS handler, has been introduced to manage these cross-cutting concerns. The advantage of this approach is the ability to dynamically add new cross-cutting logic (for example, dns caching) simply by adding a new handler to the chain. Please take a look.

enableDOH,
),
)
return dnshandler.Apply(factoryResolver, dnshandler.NewLoggingHandler(), dnshandler.NewErrorHandler())
Copy link
Collaborator Author

@LiquidTheDangerous LiquidTheDangerous Sep 19, 2024

Choose a reason for hiding this comment

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

To add cross-cutting logic, need to add a handler implementation to this chain.
Handlers applies in given order

@Ledorub
Copy link
Collaborator

Ledorub commented Sep 27, 2024

@LiquidTheDangerous, pinging you in case you haven't seen the code comments yet. They don't update comment counter, it seems.

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.

2 participants