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:
Miek Gieben 2017-10-25 19:46:41 +01:00 committed by GitHub
parent 25367a4329
commit c2d93f7182
6 changed files with 64 additions and 61 deletions

View file

@ -79,7 +79,7 @@ func (h Dnstap) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg)
newCtx := context.WithValue(ctx, DnstapSendOption, &sendOption)
rw := &taprw.ResponseWriter{ResponseWriter: w, Tapper: &h, Query: r, Send: &sendOption}
rw.QueryEpoch()
rw.SetQueryEpoch()
code, err := plugin.NextOrFailure(h.Name(), h.Next, tapContext{newCtx, h}, rw, r)
if err != nil {