Documentation
¶
Overview ¶
Based on github.com/miekg/dns/serve_mux.go
Index ¶
- func MakeWildcard(fqdn string) string
- func MakeWildcards(fqdn string) []string
- func Must(rrs []dns.RR, err error) []dns.RR
- func NewRR(name string, qtype uint16, ttl int, value string) dns.RR
- func NewRRs(name string, qtype uint16, ttl int, values []string) []dns.RR
- func ParseRecords(s string, origin string) ([]dns.RR, error)
- func ParseRecordsFile(rdr io.Reader, origin string) ([]dns.RR, error)
- func QtypeString(qtype uint16) string
- func RRToString(rr dns.RR) string
- func RRsToStrings(rrs []dns.RR) []string
- func ReplaceWildcards(rrs []dns.RR, name string) []dns.RR
- type Answer
- type Handler
- type HandlerFunc
- type HandlerProvider
- type Meta
- type NofitifyFunc
- type Option
- type Question
- type RecordGetter
- type Recorder
- type Records
- type ServeMux
- type Server
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MakeWildcard ¶
func MakeWildcards ¶
func Must ¶
Must is a helper that wraps a call to a function returning ([]dns.RR, error) and panics if the error is non-nil.
func ParseRecords ¶
ParseRecords parses DNS records from string.
func ParseRecordsFile ¶
ParseRecordsFile parses DNS records from file.
func QtypeString ¶
QtypeString return string representation of uint16 DNS query type.
func RRToString ¶
RRToString returns string representation of dns.RR value.
func RRsToStrings ¶
RRsToStings returns representaion of []dns.RR as []string.
Types ¶
type Handler ¶
func ChainHandler ¶
func ChainHandler(set RecordGetter, next Handler) Handler
ChainHandler tries to handle query using provided DNS records set, if there is no answer for the query in set it calls next dns.Handler.
func NotifyHandler ¶
func NotifyHandler(notify NofitifyFunc, next Handler) Handler
NotifyHandler calls notify function after processing query.
func RecordSetHandler ¶
func RecordSetHandler(set RecordGetter) Handler
RecordSetHandler wraps RecordGetter interface and implements Handlerinterface using it.
type HandlerFunc ¶
func (HandlerFunc) ServeDNS ¶
func (f HandlerFunc) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg)
type HandlerProvider ¶
func ChallengeHandler ¶
func ChallengeHandler(next Handler) HandlerProvider
type NofitifyFunc ¶
type Option ¶
type Option func(*options)
func NotifyStartedFunc ¶
func NotifyStartedFunc(f func()) Option
type RecordGetter ¶
type RecordGetter interface {
Get(ctx context.Context, name string, qtype uint16) ([]dns.RR, error)
}
RecordGetter is an interface which must be implemented by any records providers like database records, in-memory records, etc.
type Recorder ¶
Recorder is a type of dns.ResponseWriter that captures the rcode code written to it and also the size of the message written in the response. A rcode code does not have to be written, however, in which case 0 must be assumed. It is best to have the constructor initialize this type with that default status code.
func NewRecorder ¶
func NewRecorder(w dns.ResponseWriter) *Recorder
NewRecorder makes and returns a new Recorder, which captures the DNS rcode from the ResponseWriter and also the length of the response message written through it.
type Records ¶
type Records struct {
// contains filtered or unexported fields
}
Records represents in memory stored DNS records.
func NewRecords ¶
NewRecords returns new initialized Records instance.
type ServeMux ¶
type ServeMux struct {
// contains filtered or unexported fields
}
func (*ServeMux) HandleFunc ¶
func (mux *ServeMux) HandleFunc(pattern string, handler func(context.Context, dns.ResponseWriter, *dns.Msg))
HandleFunc adds a handler function to the ServeMux for pattern.