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:
Matthias Radestock committed 2015-08-20 18:27:58 +01:00
1 parent f399c3a888
commit 8182022d52
2 files changed
+130 -125

No files matched your search

+2 -1
View File
@@ -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)
}
}