Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultHandlerTestConfig = DnsRequestHandlerConfig{ Upstream: []upstream.Config{ { Ip: "1.1.1.1", Port: 53, Protocol: "udp", Timeout: 1000, }, }, GeoIp: geoip.Config{ Enable: true, CountryDB: "../../assets/geoCity.mmdb", ASNDB: "../../assets/geoIsp.mmdb", }, }
View Source
var DefaultRedisDataTestConfig = storage.DataHandlerConfig{ ZoneCacheSize: 10000, ZoneCacheTimeout: 60, ZoneReload: 60, RecordCacheSize: 1000000, RecordCacheTimeout: 60, MinTTL: 5, MaxTTL: 3600, Redis: hiredis.Config{ Address: "redis:6379", Net: "tcp", DB: 0, Password: "", Prefix: "test_", Suffix: "_test", Connection: hiredis.ConnectionConfig{ MaxIdleConnections: 10, MaxActiveConnections: 10, ConnectTimeout: 500, ReadTimeout: 500, IdleKeepAlive: 30, MaxKeepAlive: 0, WaitForConnection: true, }, }, }
Functions ¶
func CenterText ¶
func DefaultApplyAndVerify ¶
func DefaultApplyAndVerify(testCase *TestCase, requestHandler *DnsRequestHandler, t *testing.T)
Types ¶
type DnsRequestHandler ¶
type DnsRequestHandler struct { Config *DnsRequestHandlerConfig RedisData *storage.DataHandler // contains filtered or unexported fields }
func DefaultInitialize ¶
func DefaultInitialize(testCase *TestCase) (*DnsRequestHandler, error)
func NewHandler ¶
func NewHandler(config *DnsRequestHandlerConfig, redisData *storage.DataHandler, requestLogger *zap.Logger) *DnsRequestHandler
func (*DnsRequestHandler) HandleRequest ¶
func (h *DnsRequestHandler) HandleRequest(context *RequestContext)
func (*DnsRequestHandler) ShutDown ¶
func (h *DnsRequestHandler) ShutDown()
type DnsRequestHandlerConfig ¶
type RequestContext ¶
type RequestContext struct { request.Request StartTime time.Time Auth bool Res int Answer []dns.RR Authority []dns.RR Additional []dns.RR DomainUid string SourceIp net.IP SourceSubnet string SourceCountry string SourceASN uint // contains filtered or unexported fields }
func NewRequestContext ¶
func NewRequestContext(w dns.ResponseWriter, r *dns.Msg) *RequestContext
func (*RequestContext) RawName ¶
func (context *RequestContext) RawName() string
func (*RequestContext) Response ¶
func (context *RequestContext) Response()
type TestCase ¶
type TestCase struct { Name string Description string Enabled bool RedisDataConfig storage.DataHandlerConfig HandlerConfig DnsRequestHandlerConfig Initialize func(testCase *TestCase) (*DnsRequestHandler, error) ApplyAndVerify func(testCase *TestCase, handler *DnsRequestHandler, t *testing.T) Zones []string ZoneConfigs []string Entries [][][]string TestCases []test.Case }
Click to show internal directories.
Click to hide internal directories.