parent
f33b02689c
commit
1b7492be6e
41 changed files with 3537 additions and 0 deletions
25
middleware/dnstap/msg/wrapper.go
Normal file
25
middleware/dnstap/msg/wrapper.go
Normal file
|
@ -0,0 +1,25 @@
|
|||
package msg
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
lib "github.com/dnstap/golang-dnstap"
|
||||
"github.com/golang/protobuf/proto"
|
||||
)
|
||||
|
||||
func wrap(m *lib.Message) *lib.Dnstap {
|
||||
t := lib.Dnstap_MESSAGE
|
||||
return &lib.Dnstap{
|
||||
Type: &t,
|
||||
Message: m,
|
||||
}
|
||||
}
|
||||
|
||||
func Marshal(m *lib.Message) (data []byte, err error) {
|
||||
data, err = proto.Marshal(wrap(m))
|
||||
if err != nil {
|
||||
err = fmt.Errorf("proto: %s", err)
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue