an atomdrift project
Hostile 100% go Download

github.com/DataDog/dd-trace-go/contrib/miekg/dns/v2 v2.11.0-dev

Legitimate Datadog tracing library

Go module checksum manifestGo module source archive layout

Evidence

SPDX license identifier LICENSE · lines 1–16
1## License
2
3This work is dual-licensed under Apache 2.0 or BSD3.
4You may select, at your option, one of the above-listed licenses.
5
6`SPDX-License-Identifier: Apache-2.0 OR BSD-3-Clause`
7
8 Apache License
⋯8 lines
imports github.com/miekg/dns dns.go · lines 4–28
4:9… ight 2016 Datadog, Inc.
5
6package dns
7
8import (
9 "context"
10 "errors"
11 "net"
12 "time"
13
14 "github.com/DataDog/dd-trace-go/v2/ddtrace/ext"
15 "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer"
16 "github.com/DataDog/dd-trace-go/v2/instrumentation"
17
18 "github.com/miekg/dns"
19)
20
⋯4 lines
25}
26
27// ListenAndServe calls dns.ListenAndServe with a wrapped Handler.
28func ListenAndServe(addr string, network string, handler dns.Handler) error …
Go DNS client Exchange call dns.go · lines 70–82
70:27… WriteMsg(msg)
71}
72
73// Exchange calls dns.Exchange and traces the request.
74func Exchange(m *dns.Msg, addr string) (r *dns.Msg, err error) {
75 span, _ := startClientSpan(context.Background(), m.Opcode)
76 r, err = dns.Exchange(m, addr)
77 span.Finish(tracer.WithError(err))
78 return r, err
⋯4 lines
imports github.com/DataDog/dd-trace-go/contrib/miekg/dns/v2 as dnstrace dns_test.go · lines 4–27
4:9… ight 2016 Datadog, Inc.
5
6package dns_test
7
8import (
9 "context"
10 "net"
11 "sync"
12 "testing"
13 "time"
14
15 dnstrace "github.com/DataDog/dd-trace-go/contrib/miekg/dns/v2"
16
17 "github.com/DataDog/dd-trace-go/v2/ddtrace/ext"
18 "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer"
19
20 "github.com/miekg/dns"
21 "github.com/stretchr/testify/assert"
22 "github.com/stretchr/testify/require"
23)
24
25type testHandler struct{}
26
27func (th *testHandler) ServeDNS(w dns.ResponseWriter, r *dns.Ms …
Go packet listener creation call dns_test.go · lines 29–44
29:5… etReply(r)
30 w.WriteMsg(m)
31}
32
33func startServer(t *testing.T, traced bool) (*dns.Server, string) {
34 var h dns.Handler = &testHandler{}
35 if traced {
36 h = dnstrace.WrapHandler(h)
37 }
38 pc, err := net.ListenPacket("udp", "127.0.0.1:0")
39 require.NoError(t, err)
40
⋯4 lines

Keyboard shortcuts on this page: j for the next sample, k for the previous one, x to go back to the feed, d to download the original bytes, r to re-queue the sample for analysis.