dnsserver

package
v0.0.0-...-7bc2641 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2020 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package dnsserver implements a DNS server, that uses the given resolvers to handle requests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCachingResolver

func NewCachingResolver(back Resolver) *cachingResolver

NewCachingResolver returns a new resolver which implements a cache on top of the given one.

Types

type Resolver

type Resolver interface {
	// Initialize the resolver.
	Init() error

	// Maintain performs resolver maintenance. It's expected to run
	// indefinitely, but may return early if appropriate.
	Maintain()

	// Query responds to a DNS query.
	Query(r *dns.Msg, tr trace.Trace) (*dns.Msg, error)
}

Resolver is the interface for DNS resolvers that can answer queries.

type Server

type Server struct {
	Addr string
	// contains filtered or unexported fields
}

Server implements a DNS proxy, which will (mostly) use the given resolver to resolve queries.

func New

func New(addr string, resolver Resolver, unqUpstream string) *Server

New *Server, which will listen on addr, use resolver as the backend resolver, and use unqUpstream to resolve unqualified queries.

func (*Server) Handler

func (s *Server) Handler(w dns.ResponseWriter, r *dns.Msg)

Handler for the incoming DNS queries.

func (*Server) ListenAndServe

func (s *Server) ListenAndServe()

ListenAndServe launches the DNS proxy.

func (*Server) SetFallback

func (s *Server) SetFallback(upstream string, domains []string)

SetFallback upstream server for the given domains.

Jump to

Keyboard shortcuts

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