aboutsummaryrefslogtreecommitdiff
path: root/plugin/dnstap/msg/wrapper.go
diff options
context:
space:
mode:
Diffstat (limited to 'plugin/dnstap/msg/wrapper.go')
-rw-r--r--plugin/dnstap/msg/wrapper.go8
1 files changed, 5 insertions, 3 deletions
diff --git a/plugin/dnstap/msg/wrapper.go b/plugin/dnstap/msg/wrapper.go
index a74c604d8..3396b1342 100644
--- a/plugin/dnstap/msg/wrapper.go
+++ b/plugin/dnstap/msg/wrapper.go
@@ -7,9 +7,10 @@ import (
"github.com/golang/protobuf/proto"
)
-func wrap(m *lib.Message) *lib.Dnstap {
+// Wrap a dnstap message in the top-level dnstap type.
+func Wrap(m *lib.Message) lib.Dnstap {
t := lib.Dnstap_MESSAGE
- return &lib.Dnstap{
+ return lib.Dnstap{
Type: &t,
Message: m,
}
@@ -17,7 +18,8 @@ func wrap(m *lib.Message) *lib.Dnstap {
// Marshal encodes the message to a binary dnstap payload.
func Marshal(m *lib.Message) (data []byte, err error) {
- data, err = proto.Marshal(wrap(m))
+ payload := Wrap(m)
+ data, err = proto.Marshal(&payload)
if err != nil {
err = fmt.Errorf("proto: %s", err)
return