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 ¶
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 ¶
SetFallback upstream server for the given domains.
Click to show internal directories.
Click to hide internal directories.