mirror of
https://github.com/coredns/coredns.git
synced 2025-10-27 16:24:19 -04:00
Adds the dnstap I/O routines and should fix some issues (#1083)
* adds the dnstap I/O thread and should fix a lot of mistakes * docs * -race test * oops * docs
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user