refactor dns handlers
introduce a handler struct, which - enables lifting of all the handle* closures to methods - eliminates the passing around of defaultMaxResponseSize - reduces the number of free-floating functions
This commit is contained in:
1 parent
f399c3a888
commit
8182022d52
2 files changed
+130
-125
No files matched your search
@@ -93,7 +93,8 @@ func TestTruncateResponse(t *testing.T) {
|
||||
|
||||
// pick a random max size, truncate response to that, check it
|
||||
maxSize := 512 + rand.Intn(response.Len()-512)
|
||||
truncateResponse(response, maxSize)
|
||||
h := handler{maxResponseSize: maxSize}
|
||||
h.truncateResponse(&dns.Msg{}, response)
|
||||
require.True(t, response.Len() <= maxSize)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user