mirror of
https://github.com/coredns/coredns.git
synced 2025-10-27 08:14:18 -04:00
plugin/dnstap: some cleanup (#1172)
Some cleanup in proxy and dnstap: * just use time pkg directly and side step the indirection for Epoch * Use Set in SetQueryEpoch to be more Go like. (Looked like a reader) * Don't maintain two sets of time, we already track start, so use that. * Use time.Time and convert when needed * dedent the toDnstap function and put in a separate file
This commit is contained in:
@@ -5,7 +5,6 @@ import (
|
||||
"errors"
|
||||
"net"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
tap "github.com/dnstap/golang-dnstap"
|
||||
"github.com/miekg/dns"
|
||||
@@ -103,16 +102,6 @@ func (d *Data) Pack(m *dns.Msg) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Epoch returns the epoch time in seconds.
|
||||
func Epoch() uint64 {
|
||||
return uint64(time.Now().Unix())
|
||||
}
|
||||
|
||||
// Epoch sets the dnstap message epoch.
|
||||
func (d *Data) Epoch() {
|
||||
d.TimeSec = Epoch()
|
||||
}
|
||||
|
||||
// ToClientResponse transforms Data into a client response message.
|
||||
func (d *Data) ToClientResponse() *tap.Message {
|
||||
t := tap.Message_CLIENT_RESPONSE
|
||||
|
||||
Reference in New Issue
Block a user