Documentation ¶
Overview ¶
Example (Client) ¶
package main import ( "fmt" dnstrace "github.com/KoddiDev/dd-trace-go/contrib/miekg/dns" "github.com/miekg/dns" ) func main() { m := new(dns.Msg) m.SetQuestion("miek.nl.", dns.TypeMX) // calling dnstrace.Exchange will call dns.Exchange but trace the request reply, err := dnstrace.Exchange(m, "127.0.0.1:53") fmt.Println(reply, err) }
Output:
Example (Server) ¶
package main import ( dnstrace "github.com/KoddiDev/dd-trace-go/contrib/miekg/dns" "github.com/miekg/dns" ) func main() { mux := dns.NewServeMux() mux.HandleFunc(".", func(w dns.ResponseWriter, r *dns.Msg) { m := new(dns.Msg) m.SetReply(r) w.WriteMsg(m) }) // calling dnstrace.ListenAndServe will call dns.ListenAndServe but all // requests will be traced dnstrace.ListenAndServe(":dns", "udp", mux) }
Output:
Index ¶
- func Exchange(m *dns.Msg, addr string) (r *dns.Msg, err error)
- func ExchangeConn(c net.Conn, m *dns.Msg) (r *dns.Msg, err error)
- func ExchangeContext(ctx context.Context, m *dns.Msg, addr string) (r *dns.Msg, err error)
- func ListenAndServe(addr string, network string, handler dns.Handler) error
- func ListenAndServeTLS(addr, certFile, keyFile string, handler dns.Handler) error
- type Client
- type Handler
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExchangeConn ¶
ExchangeConn calls dns.ExchangeConn and traces the request.
func ExchangeContext ¶
ExchangeContext calls dns.ExchangeContext and traces the request.
func ListenAndServe ¶
ListenAndServe calls dns.ListenAndServe with a wrapped Handler.
Types ¶
type Client ¶
A Client wraps a DNS Client so that requests are traced.
type Handler ¶
A Handler wraps a DNS Handler so that requests are traced.
func WrapHandler ¶
WrapHandler creates a new, wrapped DNS handler.
Click to show internal directories.
Click to hide internal directories.