This repository was archived by the owner on Jun 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 678
Refactor dns server to pass configurables to handlers in a struct. #1334
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
f121737
to
c485b1e
Compare
@@ -286,9 +289,16 @@ func truncateResponse(response *dns.Msg, maxSize int) { | |||
response.Truncated = true | |||
} | |||
|
|||
func getMaxResponseSize(req *dns.Msg, defaultMaxResponseSize int) int { | |||
func (h *handler) responseTooBig(request, response *dns.Msg) bool { | |||
if len(response.Answer) <= 1 || h.maxResponseSize <= 0 { |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
It's not what I would have done. Handlers don't need to know about the ServeMux. Let alone do they need to be be a ServeMux. It's unnecessary coupling. |
i.e.
and
|
or
|
assert_raises "exec_on $HOST1 c0 dig MX $NAME | grep -q 'status: NXDOMAIN'" | ||
|
||
check() { | ||
M=$(exec_on $HOST1 c0 dig +short $@ $NAME A | grep -v ';;' | wc -l) | ||
assert_raises "test $M -eq $N" |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
return false | ||
} | ||
return response.Len() > h.getMaxResponseSize(request) | ||
} |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
Also ignore EDNS on tcp requests. Fixes #1332 Also fixes the case where recursive dns entries would be considered too big and compressed when using TCP.
6824487
to
52d88a1
Compare
Merged
Superseded #1344 |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Also ignore EDNS on tcp requests. Fixes #1332