dns

package
v1.24.0-rc.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 28, 2020 License: Apache-2.0, BSD-3-Clause, Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Example (Client)
Output:

Example (Server)
Output:

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Exchange

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

Exchange calls dns.Exchange and traces the request.

func ExchangeConn

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

ExchangeConn calls dns.ExchangeConn and traces the request.

func ExchangeContext

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

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

ListenAndServe calls dns.ListenAndServe with a wrapped Handler.

func ListenAndServeTLS

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

ListenAndServeTLS calls dns.ListenAndServeTLS with a wrapped Handler.

Types

type Client

type Client struct {
	*dns.Client
}

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

func (*Client) Exchange

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

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

type Handler struct {
	dns.Handler
}

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

func WrapHandler

func WrapHandler(handler dns.Handler) *Handler

WrapHandler creates a new, wrapped DNS handler.

func (*Handler) ServeDNS

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

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL