-
-
Notifications
You must be signed in to change notification settings - Fork 214
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
feat: support CNAME records in customDNS mappings #1352
Conversation
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 picking this up!
I've got a couple comments about details, but also wanted to bring up maybe we should use dns.ZoneParser which supports the standard zonefile format instead of making something custom? UnmarshalYAML
could error if any RR is not an A
/AAAA
/CNAME
.
That also would have the benefit of allowing to split the mapping into another file via $INCLUDE
.
That shouldn't be a blocker for this PR though.
Agreed that the zone parser looks promising but is out of scope and could be implemented later on. |
Thanks for the review @kwitsch and @ThinkChaos! I'll get these changes implemented tonight 😄 |
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.
A couple new minor things and some follow-up from the previous threads.
Progress is looking great :)
…stream timeout duration
I think that I've implemented most of the PR feedback. I'm not a regular golang user and have been having a heck of a time implementing the |
If you want to post something that's blocking you feel free and I can take a look :) I resolved most threads, there's just that and one error in |
I'm mostly just not sure how to get the nested unmarshalling working. I took the sample posted earlier and tried to run with it. Conceptually, the code makes sense to me, however, when I run it, the UnmarshallYAML function gets called and I'm getting empty strings as the input. I'm sure that I've simply mapped something incorrectly. Here's a gist of the error: https://gist.github.com/BenMcH/32137efc5f5d5f0ce9f33bc94ccda796
Sorry for my ignorance, but which error in processIP am I missing? I thought that I had updated all of the calls that could return an error to bubble the error up and out of the function. I'll take a look at the linter soon! 🚀 |
The code you posted works for me!
The one from this thread: #1352 (comment) |
Thank you for all of your help on this, @ThinkChaos! Turns out I was overthinking it and failed to assign I'll go ahead and implement the rest of the feedback tonight. I think that the processIPs change is implemented. The current diff has the following:
|
Alright, The reverse DNS and old log file deletion tests are failing on both branches on my machine, so I don't think that I introduced it. If I did introduce them, let me know, and I can continue looking into it. |
Seems I just had to walk away and come back with fresh eyes. I was able to fix the reverse DNS tests and now both |
Alright, I put the create answer function on the custom resolver and made a setter func, like I saw in the NextResolver struct and forced an error for the create answer path. My local coverage.html file now shows that the file is 100% covered 😁 |
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.
Looks good to me.
One small comment how to possibly prevent CNAME loops.
Nice work & communication. 👍
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.
Can you delete the blocky
binary and add it to .gitignore
?
… mapping along with a CNAME
@ThinkChaos thanks for the thorough review! I think that I've implemented all of your suggestions. We now conditionally resolve A or AAAA records on CNAMEs based on the question type and we prevent blocky from starting if there is more than 1 mapping for a domain and any of them are a CNAME. |
Sorry, I should have run lint locally before pushing. Now it should pass 🤞 I verified both tests and lint |
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.
Ok last round for me I think :)
IDK why we need to re-approve the CI on every push, I don't remember it being like that before. Maybe because it's your first MR to this repo? |
That would make sense. Some github actions are things that you wouldn't want to run unless the code has been reviewed/trusted unless the user is a contributor/trusted. I've been making do with the makefile targets locally though 😄 |
As far as I observed the behavior: |
First time contributors need always approval (this is some kind of protection from GitHub to avoid execution of project workflows on each PR) 🤷 |
I think that the e2e test failure may have been a false positive. The errors reported were for an http port timeout and an error communicating with mariadb. I ran e2e tests on my local machine this morning and all tests passed. |
This PR is related to #465. Currently, I have only implemented CNAME records, but it would be simple to add additional record types mentioned in #996.
Please let me know if you'd prefer a different approach, but this PR being merged would allow me to replace pihole with Blocky in my home network. I'm happy to add more record types if they make sense. My understanding of DNS is that most other record types typically have more complex use-cases that may not make sense to implement, as they're usually reserved for serving data such as mail configuration or DNS ownership, neither of which I would expect Blocky to be utilized for, given its local-network scope and risk associated with hosting a publicly accessible DNS server.
Further DNS response types can be added with a simple if statement in both the custom_dns.go and custom_dns_resolver.go.