server

package
v0.0.0-...-1d29830 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2019 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DnsClient

type DnsClient interface {
	Exchange(m *dns.Msg, address string) (*dns.Msg, time.Duration, error)
}

type HttpClient

type HttpClient interface {
	Post(url, contentType string, body io.Reader) (resp *http.Response, err error)
}

type Server

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

servers is the list of DNS servers that we forward to/ask

func NewServer

func NewServer(cache *cache.Cache, config *config.Config, dnsClient DnsClient, httpClient HttpClient) (*Server, error)

Get a new server ready to start serving

func (*Server) HandleRequest

func (s *Server) HandleRequest(dnsWriter dns.ResponseWriter, clientRequest *dns.Msg)

Handle a client request Check if there is a cache record and return it or create it Ask one of the DNS servers if the record is not in the cache

func (*Server) ListenAndServe

func (s *Server) ListenAndServe() error

Start the server

func (*Server) Shutdown

func (s *Server) Shutdown() error

Shutdown gracefully

Jump to

Keyboard shortcuts

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