dd-trace-go.v1: gopkg.in/DataDog/dd-trace-go.v1/contrib/miekg/dns Index | Examples | Files

package dns

import "gopkg.in/DataDog/dd-trace-go.v1/contrib/miekg/dns"

Code:

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)

Code:

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)

Index

Examples

Package Files

dns.go

func Exchange Uses

func Exchange(m *dns.Msg, addr string) (r *dns.Msg, err error)

Exchange calls dns.Exchange and traces the request.

func ExchangeConn Uses

func ExchangeConn(c net.Conn, m *dns.Msg) (r *dns.Msg, err error)

ExchangeConn calls dns.ExchangeConn and traces the request.

func ExchangeContext Uses

func ExchangeContext(ctx context.Context, m *dns.Msg, addr string) (r *dns.Msg, err error)

ExchangeContext calls dns.ExchangeContext and traces the request.

func ListenAndServe Uses

func ListenAndServe(addr string, network string, handler dns.Handler) error

ListenAndServe calls dns.ListenAndServe with a wrapped Handler.

func ListenAndServeTLS Uses

func ListenAndServeTLS(addr, certFile, keyFile string, handler dns.Handler) error

ListenAndServeTLS calls dns.ListenAndServeTLS with a wrapped Handler.

type Client Uses

type Client struct {
    *dns.Client
}

A Client wraps a DNS Client so that requests are traced.

func (*Client) Exchange Uses

func (c *Client) Exchange(m *dns.Msg, addr string) (r *dns.Msg, rtt time.Duration, err error)

Exchange calls the underlying Client.Exchange and traces the request.

func (*Client) ExchangeContext Uses

func (c *Client) ExchangeContext(ctx context.Context, m *dns.Msg, addr string) (r *dns.Msg, rtt time.Duration, err error)

ExchangeContext calls the underlying Client.ExchangeContext and traces the request.

type Handler Uses

type Handler struct {
    dns.Handler
}

A Handler wraps a DNS Handler so that requests are traced.

func WrapHandler Uses

func WrapHandler(handler dns.Handler) *Handler

WrapHandler creates a new, wrapped DNS handler.

func (*Handler) ServeDNS Uses

func (h *Handler) ServeDNS(w dns.ResponseWriter, r *dns.Msg)

ServeDNS dispatches requests to the underlying Handler. All requests will be traced.

Package dns imports 8 packages (graph). Updated 2020-02-19. Refresh now. Tools for package owners.