Documentation
¶
Overview ¶
Package server provides functions to create and manage DNS server instances
Index ¶
- Variables
- type AcceptAction
- type AcceptFunc
- type OptionsFunc
- func WithAcceptFunc(a AcceptFunc) OptionsFunc
- func WithCache(c cache.Cache) OptionsFunc
- func WithCollector(c collector.Collector) OptionsFunc
- func WithFilter(f filter.Engine) OptionsFunc
- func WithPacker(p packers.Packer) OptionsFunc
- func WithReader(r dio.Reader) OptionsFunc
- func WithResolver(r resolver.Resolver) OptionsFunc
- func WithUnpacker(u packers.Unpacker) OptionsFunc
- func WithWriter(w dio.Writer) OptionsFunc
- type Server
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type AcceptAction ¶
type AcceptAction int
const ( AcceptMessage AcceptAction = iota RejectMessage IgnoreMessage NoImplMessage )
func DefaultAcceptFunc ¶
func DefaultAcceptFunc(h dns.Header) AcceptAction
func (AcceptAction) String ¶
func (a AcceptAction) String() string
type AcceptFunc ¶
type AcceptFunc func(dns.Header) AcceptAction
type OptionsFunc ¶
func WithAcceptFunc ¶
func WithAcceptFunc(a AcceptFunc) OptionsFunc
func WithCache ¶
func WithCache(c cache.Cache) OptionsFunc
func WithCollector ¶
func WithCollector(c collector.Collector) OptionsFunc
func WithFilter ¶
func WithFilter(f filter.Engine) OptionsFunc
func WithPacker ¶
func WithPacker(p packers.Packer) OptionsFunc
func WithReader ¶
func WithReader(r dio.Reader) OptionsFunc
func WithResolver ¶
func WithResolver(r resolver.Resolver) OptionsFunc
func WithUnpacker ¶
func WithUnpacker(u packers.Unpacker) OptionsFunc
func WithWriter ¶
func WithWriter(w dio.Writer) OptionsFunc
type Server ¶
type Server struct { // The address the server is running on (default: 0.0.0.0) Address net.IP // Network the server is using (default: udp) Network string // Port the server is listening on (default: 53) Port int // If the server is running in TCP mode, this listener // listens for incoming DNS messages TCPListener *net.TCPListener // If the server us running in UDP mode, this listener // listens for incoming UDP messages UDPListener *net.UDPConn // Logger is a light-weight wrapper around zap.Logger which // allows to the server (and all sub-components) to write // structured and leveled logs to one or multiple files Logger *logger.Logger // Reader implements the Reader interface to read // incoming TCP and UDP messages Reader dio.Reader // Writer implements the Writer interface to write // outgoing TCP and UDP messages Writer dio.Writer // Unpacker implements the Unpacker interface to unwrap // DNS messages Unpacker packers.Unpacker // Packer implements the Packer interface to pack // DNS messages Packer packers.Packer // Filter implements the Filter interface to enable DNS // filtering Filter filter.Engine // Cache implements the Cache interface to store record // data in memory for a specified TTL Cache cache.Cache // RecordStore implements the RecordStore interface to get and set // record data. A store can be anything, e.g. a file or // a database. The store has access to a cache instance // which stores record data in memory. The default store // does not use the cache as it is implemented as a // in-memory tree structure RecordStore store.Store // Resolver implements the Resolver interface to resolve // unknown domain names either iteratively or recursively. // After resolving the record data should get stored in // the cache Resolver resolver.Resolver // Collector implements the Collector interface to collect // query logs Collector collector.Collector // UDPMessageSize is the default message size to create // the temporary slice of bytes within the messageList // pool UDPMessageSize int // AncillarySize is the maximum size required to store // ancillary data of UDP messages. This is culculated // beforehand to avoid re-calculation of the same size // over and over again AncillarySize int // AcceptFunc validates if the DNS message should be // accepted or rejected (when sending invalid data) AcceptFunc AcceptFunc // contains filtered or unexported fields }
Server describes options for running a DNS server
func (*Server) Configure ¶
func (s *Server) Configure(opts ...OptionsFunc) error
Configure configures custom server components
func (*Server) Defaults ¶
func (s *Server) Defaults()
Defaults initializes default server parameters and checks if all neccesary components are registered. If not it falls back to defaults. This functions expects a validated config.Config
Click to show internal directories.
Click to hide internal directories.