-
Notifications
You must be signed in to change notification settings - Fork 62
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
Almost-dynamic zone update #15
Almost-dynamic zone update #15
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #15 +/- ##
==========================================
+ Coverage 97.46% 97.54% +0.08%
==========================================
Files 4 4
Lines 197 204 +7
Branches 37 37
==========================================
+ Hits 192 199 +7
Misses 3 3
Partials 2 2
Continue to review full report at Codecov.
|
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 few suggestions.
weird, my review was lost, I'll try again. |
@@ -173,3 +181,6 @@ def stop(self): | |||
@property | |||
def is_running(self): | |||
return (self.udp_server and self.udp_server.isAlive()) or (self.tcp_server and self.tcp_server.isAlive()) | |||
|
|||
def add_record(self, zone: Zone): | |||
self.records.zones.append(zone) |
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.
humm, have you actually tried this? I think because of self.records = [Record(zone) for zone in records.zones]
this won't actually add another record to the dns server.
Best option would be to store Records
directly on ProxyResolver
and BaseResolver
, with that, extending self.records
should actually affect the dns server.
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.
humm, have you actually tried this? I think because of self.records = [Record(zone) for zone in records.zones] this won't actually add another record to the dns server.
Well, there is a unit test for that. Do you think this is not tested enough?
Best option would be to store Records directly on ProxyResolver and BaseResolver, with that, extending self.records should actually affect the dns server.
I just pushed that. Indeed, doing this way actually not requires the server to be restarted when a zone is added.
@samuelcolvin the very last thing I plan to tackle is allowing to create a |
Surely that's as simple as passing an empty list of zones/records? If the change is bigger than that, best to create a new PR. |
I was thinking of making the |
ok. |
This follows the discussion on #14
This patch adds a
DNSServer.add_record
method to dynamically add zones. As the DNS server runs in a thread, at the moment it is needed to reload the server after callingadd_record
.If the approach is fine to you, I will submit a second PR where the record list will be shared between the threads. I am open to implementations ideas :)