Versions in this module Expand all Collapse all v0 v0.1.1 Dec 24, 2020 v0.1.0 Dec 20, 2020 v0.0.0 Dec 19, 2020 Changes in this version + const DefaultTTL + var ErrInvalidDynamicRecordFormat = Error + var ErrMultiLineDynamicRecord = Error + var ErrNoSuchRecord = Error + func QtypeToString(qtype uint16) string + type AddressRecord struct + Address net.IP + Name Domain + TTL uint32 + func (r AddressRecord) GetName() Domain + func (r AddressRecord) GetQtype() uint16 + func (r AddressRecord) GetTTL() uint32 + func (r AddressRecord) IsV4() bool + func (r AddressRecord) String() string + func (r AddressRecord) ToRR() (dns.RR, error) + func (r AddressRecord) Validate() error + func (r AddressRecord) WithoutTTL() string + type AlternateResolver []Resolver + func (ar AlternateResolver) Close() error + func (ar AlternateResolver) RecursionAvailable() bool + func (ar AlternateResolver) Resolve(resp ResponseWriter, req Request) error + func (ar AlternateResolver) String() string + type CnameRecord struct + Name Domain + TTL uint32 + Target Domain + func (r CnameRecord) GetName() Domain + func (r CnameRecord) GetQtype() uint16 + func (r CnameRecord) GetTTL() uint32 + func (r CnameRecord) String() string + func (r CnameRecord) ToRR() (dns.RR, error) + func (r CnameRecord) Validate() error + func (r CnameRecord) WithoutTTL() string + type Domain string + func (d *Domain) UnmarshalText(text []byte) error + func (d Domain) MarshalText() ([]byte, error) + func (d Domain) Normalized() Domain + func (d Domain) String() string + func (d Domain) ToPath() string + func (d Domain) Validate() error + type DynamicAPI struct + Resolver DynamicResolver + func (d DynamicAPI) DeleteRecordByID(path, req, remote string) (string, *HTTPError) + func (d DynamicAPI) DeleteRecords(path, req, remote string) (string, *HTTPError) + func (d DynamicAPI) GetAllRecords(path, req, remote string) (string, *HTTPError) + func (d DynamicAPI) GetRecordByID(path, req, remote string) (string, *HTTPError) + func (d DynamicAPI) GetRecordsByGlob(path, req, remote string) (string, *HTTPError) + func (d DynamicAPI) GetRecordsBySuffix(path, req, remote string) (string, *HTTPError) + func (d DynamicAPI) Handler() http.Handler + func (d DynamicAPI) PostRecords(path, req, remote string) (string, *HTTPError) + type DynamicRecord struct + Disabled bool + ID *int + Record Record + Volatile bool + func NewDynamicRecord(record string) (DynamicRecord, error) + func (r *DynamicRecord) UnmarshalText(text []byte) error + func (r DynamicRecord) MarshalText() ([]byte, error) + func (r DynamicRecord) String() string + func (r DynamicRecord) VolatileRecord() (VolatileRecord, error) + type DynamicRecordSet []DynamicRecord + func NewDynamicRecordSet(records string) (DynamicRecordSet, error) + func (rs *DynamicRecordSet) UnmarshalText(text []byte) error + func (rs DynamicRecordSet) MarshalText() ([]byte, error) + func (rs DynamicRecordSet) String() string + type DynamicResolver interface + GetRecord func(int) (DynamicRecordSet, error) + GlobRecords func(string) (DynamicRecordSet, error) + Records func() (DynamicRecordSet, error) + RemoveRecord func(int) error + SearchRecords func(Domain) (DynamicRecordSet, error) + SetRecords func(DynamicRecordSet) error + type Error struct + Message string + Original error + Type ErrorType + func (e Error) Error() string + func (e Error) String() string + func (e Error) Unwrap() error + type ErrorSet []error + func (e ErrorSet) Error() string + type ErrorType uint8 + const TypeArgumentError + const TypeExpirationError + const TypeExternalError + const TypeInternalError + func (t ErrorType) String() string + type EtcdResolver struct + Prefix string + Timeout time.Duration + func NewEtcdResolver(endpoints []string, prefix string, timeout time.Duration, metrics *Metrics) (*EtcdResolver, error) + func (er *EtcdResolver) Close() error + func (er *EtcdResolver) GetRecord(id int) (DynamicRecordSet, error) + func (er *EtcdResolver) GlobRecords(glob string) (DynamicRecordSet, error) + func (er *EtcdResolver) Records() (DynamicRecordSet, error) + func (er *EtcdResolver) RecursionAvailable() bool + func (er *EtcdResolver) RemoveRecord(id int) error + func (er *EtcdResolver) Resolve(w ResponseWriter, r Request) error + func (er *EtcdResolver) SearchRecords(d Domain) (DynamicRecordSet, error) + func (er *EtcdResolver) SetRecords(rs DynamicRecordSet) error + func (er *EtcdResolver) String() string + type ForwardResolver struct + Metrics *Metrics + Upstreams []*net.UDPAddr + func NewForwardResolver(upstreams []*net.UDPAddr, timeout time.Duration, metrics *Metrics) ForwardResolver + func (fr ForwardResolver) Close() error + func (fr ForwardResolver) RecursionAvailable() bool + func (fr ForwardResolver) Resolve(w ResponseWriter, r Request) error + type HTTPError struct + Message string + StatusCode int + func (e HTTPError) Error() string + func (e HTTPError) ServeHTTP(w http.ResponseWriter, r *http.Request) + type Handler struct + Metrics *Metrics + RecursionAvailable bool + Resolver Resolver + func NewHandler(resolver Resolver, metrics *Metrics) Handler + func (h Handler) ServeDNS(w dns.ResponseWriter, r *dns.Msg) + type LocalCache struct + func NewLocalCache(upstream Resolver, metrics *Metrics) *LocalCache + func (lc *LocalCache) Close() error + func (lc *LocalCache) RecursionAvailable() bool + func (lc *LocalCache) Resolve(w ResponseWriter, r Request) error + func (lc *LocalCache) String() string + type MessageBuilder struct + func NewMessageBuilder(request *dns.Msg, recursionAvailable bool) *MessageBuilder + func (mb *MessageBuilder) Add(r Record) error + func (mb *MessageBuilder) Build() *dns.Msg + func (mb *MessageBuilder) IsAuthoritative() bool + func (mb *MessageBuilder) SetNoAuthoritative() + type Metrics struct + func NewMetrics(namespace string) *Metrics + func (m *Metrics) CacheHit(req Request) + func (m *Metrics) CacheMiss(req Request) + func (m *Metrics) Collect(ch chan<- prometheus.Metric) + func (m *Metrics) Describe(ch chan<- *prometheus.Desc) + func (m *Metrics) Error(req Request, err error) + func (m *Metrics) HTTPHandler() (http.Handler, error) + func (m *Metrics) Start(request *dns.Msg) func(*dns.Msg) + func (m *Metrics) UpstreamTime(duration time.Duration) + type MxRecord struct + Name Domain + Preference uint16 + TTL uint32 + Target Domain + func (r MxRecord) GetName() Domain + func (r MxRecord) GetQtype() uint16 + func (r MxRecord) GetTTL() uint32 + func (r MxRecord) String() string + func (r MxRecord) ToRR() (dns.RR, error) + func (r MxRecord) Validate() error + func (r MxRecord) WithoutTTL() string + type NsRecord struct + Name Domain + Target Domain + func (r NsRecord) GetName() Domain + func (r NsRecord) GetQtype() uint16 + func (r NsRecord) GetTTL() uint32 + func (r NsRecord) String() string + func (r NsRecord) ToRR() (dns.RR, error) + func (r NsRecord) Validate() error + func (r NsRecord) WithoutTTL() string + type Proto string + func (p *Proto) UnmarshalText(text []byte) error + func (p Proto) MarshalText() ([]byte, error) + func (p Proto) Normalized() Proto + func (p Proto) String() string + func (p Proto) Validate() error + type PtrRecord struct + Domain Domain + Name Domain + TTL uint32 + func (r PtrRecord) GetName() Domain + func (r PtrRecord) GetQtype() uint16 + func (r PtrRecord) GetTTL() uint32 + func (r PtrRecord) String() string + func (r PtrRecord) ToRR() (dns.RR, error) + func (r PtrRecord) Validate() error + func (r PtrRecord) WithoutTTL() string + type Record interface + GetName func() Domain + GetQtype func() uint16 + GetTTL func() uint32 + ToRR func() (dns.RR, error) + Validate func() error + WithoutTTL func() string + func NewRecord(str string) (Record, error) + func NewRecordFromRR(rr dns.RR) (Record, error) + func NewRecordWithExpire(str string, expire time.Time) (Record, error) + func NewRecordWithTTL(str string, ttl uint32) (Record, error) + type RedisCache struct + func NewRedisCache(addr net.Addr, database int, password string, upstream Resolver, ...) (RedisCache, error) + func (rc RedisCache) Close() error + func (rc RedisCache) RecursionAvailable() bool + func (rc RedisCache) Resolve(w ResponseWriter, r Request) error + func (rc RedisCache) String() string + type Request struct + RecursionDesired bool + func NewRequest(name string, qtype uint16, recursionDesired bool) Request + func (req Request) QtypeString() string + func (req Request) String() string + type Resolver interface + RecursionAvailable func() bool + Resolve func(ResponseWriter, Request) error + type ResolverConfig struct + Addresses map[Domain][]net.IP + Cnames map[Domain][]Domain + Services map[Domain][]SrvRecordConfig + TTL *uint32 + Texts map[Domain][]string + type ResolverSet []Resolver + func (rs ResolverSet) Close() error + func (rs ResolverSet) RecursionAvailable() bool + func (rs ResolverSet) Resolve(resp ResponseWriter, req Request) error + func (rs ResolverSet) String() string + type ResponseCallback struct + Authoritative bool + Callback func(Record) error + func NewResponseCallback(callback func(Record) error) *ResponseCallback + func (rc *ResponseCallback) Add(r Record) error + func (rc *ResponseCallback) IsAuthoritative() bool + func (rc *ResponseCallback) SetNoAuthoritative() + type ResponseWriter interface + Add func(Record) error + IsAuthoritative func() bool + SetNoAuthoritative func() + type ResponseWriterHook struct + OnAdd func(Record) error + Writer ResponseWriter + func (rh ResponseWriterHook) Add(r Record) error + func (rh ResponseWriterHook) IsAuthoritative() bool + func (rh ResponseWriterHook) SetNoAuthoritative() + type Server struct + DebugMode bool + DynamicResolver DynamicResolver + Metrics *Metrics + Name string + Resolvers Resolver + func (s *Server) DNSHandler() dns.Handler + func (s *Server) HTTPHandler() (http.Handler, error) + func (s *Server) ListenAndServe(ctx context.Context, apiAddress *net.TCPAddr, dnsAddress *net.UDPAddr, ...) error + type SimpleResolver map[uint16]map[Domain][]Record + func NewSimpleResolver(records []Record) SimpleResolver + func NewSimpleResolverFromConfig(config []byte) (SimpleResolver, error) + func (sr SimpleResolver) Close() error + func (sr SimpleResolver) RecursionAvailable() bool + func (sr SimpleResolver) Resolve(w ResponseWriter, r Request) error + func (sr SimpleResolver) String() string + func (sr SimpleResolver) Validate() error + type SqliteResolver struct + func NewSqliteResolver(path string, metrics *Metrics) (*SqliteResolver, error) + func (sr *SqliteResolver) Close() error + func (sr *SqliteResolver) GetRecord(id int) (DynamicRecordSet, error) + func (sr *SqliteResolver) GlobRecords(pattern string) (DynamicRecordSet, error) + func (sr *SqliteResolver) Records() (DynamicRecordSet, error) + func (sr *SqliteResolver) RecursionAvailable() bool + func (sr *SqliteResolver) RemoveRecord(id int) error + func (sr *SqliteResolver) Resolve(w ResponseWriter, r Request) error + func (sr *SqliteResolver) SearchRecords(suffix Domain) (DynamicRecordSet, error) + func (sr *SqliteResolver) SetRecords(rs DynamicRecordSet) error + func (sr *SqliteResolver) String() string + type SrvRecord struct + Name Domain + Port uint16 + Priority uint16 + TTL uint32 + Target Domain + Weight uint16 + func (r SrvRecord) GetName() Domain + func (r SrvRecord) GetQtype() uint16 + func (r SrvRecord) GetTTL() uint32 + func (r SrvRecord) String() string + func (r SrvRecord) ToRR() (dns.RR, error) + func (r SrvRecord) Validate() error + func (r SrvRecord) WithoutTTL() string + type SrvRecordConfig struct + Port uint16 + Priority uint16 + Proto Proto + Service string + Target Domain + Weight uint16 + func (s SrvRecordConfig) ToRecord(name Domain, ttl uint32) SrvRecord + type TxtRecord struct + Name Domain + TTL uint32 + Text string + func (r TxtRecord) GetName() Domain + func (r TxtRecord) GetQtype() uint16 + func (r TxtRecord) GetTTL() uint32 + func (r TxtRecord) String() string + func (r TxtRecord) ToRR() (dns.RR, error) + func (r TxtRecord) Validate() error + func (r TxtRecord) WithoutTTL() string + type VolatileRecord struct + Expire time.Time + RR dns.RR + func NewVolatileRecord(record string) (VolatileRecord, error) + func (r *VolatileRecord) UnmarshalText(text []byte) error + func (r VolatileRecord) MarshalText() ([]byte, error) + func (r VolatileRecord) Record() (Record, error) + func (r VolatileRecord) String() string