-
-
Notifications
You must be signed in to change notification settings - Fork 40
/
interfaces.go
68 lines (58 loc) · 1.39 KB
/
interfaces.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
package setup
import (
"github.com/miekg/dns"
"github.com/prometheus/client_golang/prometheus"
"github.com/qdm12/dns/v2/pkg/middlewares/filter/update"
"github.com/qdm12/log"
)
type Logger interface {
Debug(s string)
Info(s string)
Warn(s string)
Error(s string)
}
type LoggerConstructor interface {
New(options ...log.Option) *log.Logger
}
type Filter interface {
FilterRequest(request *dns.Msg) (blocked bool)
FilterResponse(response *dns.Msg) (blocked bool)
Update(settings update.Settings) (err error)
}
type FilterMetrics interface {
SetBlockedHostnames(n int)
SetBlockedIPs(n int)
SetBlockedIPPrefixes(n int)
HostnamesFilteredInc(qClass, qType string)
IPsFilteredInc(rrtype string)
}
type Middleware interface {
String() string
Wrap(next dns.Handler) dns.Handler
Stop() (err error)
}
type DoTMetrics interface {
DoTDialInc(provider, address, outcome string)
DNSDialInc(address, outcome string)
}
type DoHMetrics interface {
DoHDialInc(url string)
DoTDialInc(provider, address, outcome string)
DNSDialInc(address, outcome string)
}
type CacheMetrics interface { //nolint:interfacebloat
SetCacheType(cacheType string)
CacheInsertInc()
CacheRemoveInc()
CacheMoveInc()
CacheGetEmptyInc()
CacheInsertEmptyInc()
CacheRemoveEmptyInc()
CacheHitInc()
CacheMissInc()
CacheExpiredInc()
CacheMaxEntriesSet(maxEntries int)
}
type PrometheusRegistry interface {
prometheus.Registerer
}