dns

package
v0.0.0-...-fbfc268 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TypeA represents th resource record type A, an IPv4 address.
	TypeA = dns.TypeA
	// TypeAAAA represents the resource record type AAAA, an IPv6 address.
	TypeAAAA = dns.TypeAAAA
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler func(*Request) *Reply

Handler represents the handler for a DNS request.

type Proxy

type Proxy struct {
	Handler Handler
	// contains filtered or unexported fields
}

Proxy represents a DNS proxy.

func NewProxy

func NewProxy(cache *cache.Cache, client dnsutil.Client, logger *sql.Logger) (*Proxy, error)

NewProxy creates a new DNS proxy.

func (*Proxy) Close

func (p *Proxy) Close() error

Close closes the proxy.

func (*Proxy) ListenAndServe

func (p *Proxy) ListenAndServe(addr string, network string) error

ListenAndServe listens on the network address addr and uses the server to process requests.

func (*Proxy) ServeDNS

func (p *Proxy) ServeDNS(w dns.ResponseWriter, r *dns.Msg)

ServeDNS implements the dns.Handler interface.

type Reply

type Reply struct {
	// contains filtered or unexported fields
}

Reply represents a simplifed DNS reply.

func ReplyA

func ReplyA(name string, ipAddr ...net.IP) *Reply

ReplyA creates a resource record of type A.

func ReplyAAAA

func ReplyAAAA(name string, ipAddr ...net.IP) *Reply

ReplyAAAA creates a resource record of type AAAA.

func (*Reply) String

func (r *Reply) String() string

type Request

type Request struct {
	Type uint16
	Name string
}

Request represents a simplified DNS request.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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