Documentation
¶
Index ¶
- Constants
- Variables
- func GetEmptyAnswerForQuestionType(questionType uint16, domain string) dns.RR
- type BlockDomainsDecider
- func NewBlockDomainsDeciderABP(filePath string, logger Logger) BlockDomainsDecider
- func NewBlockDomainsDeciderHosts(filePath string, logger Logger) BlockDomainsDecider
- func PrepareBlocklist(filePath string, blocklistUpdateFrequency string, blocklistType string, ...) (BlockDomainsDecider, []func() error, error)
- type BlockDomainsDeciderABP
- type BlockDomainsDeciderHosts
- type Blocker
- type BlocklistType
- type Logger
- type ResponseType
Constants ¶
View Source
const MetadataRequestBlocked = "blocker/request-blocked"
View Source
const PluginName = "blocker"
View Source
const RequiredArgs = 4
Variables ¶
View Source
var ( // RequestBlockCount is the number of DNS requests being blocked. RequestBlockCount = promauto.NewCounter(prometheus.CounterOpts{ Namespace: plugin.Namespace, Subsystem: PluginName, Name: "blocked_requests_total", Help: "Counter of DNS requests being blocked.", }) // RequestAllowCount is the number of DNS requests being Allowed. RequestAllowCount = promauto.NewCounter(prometheus.CounterOpts{ Namespace: plugin.Namespace, Subsystem: PluginName, Name: "allowed_requests_total", Help: "Counter of DNS requests being allowed.", }) )
Functions ¶
Types ¶
type BlockDomainsDecider ¶
type BlockDomainsDecider interface {
IsDomainBlocked(domain string) bool
StartBlocklistUpdater(ticker *time.Ticker)
UpdateBlocklist() error
}
BlockDomainsDecider is the interface which must be implemented by any type which intends to become a blocker. The purpose of each of the functions is described below.
func NewBlockDomainsDeciderABP ¶
func NewBlockDomainsDeciderABP(filePath string, logger Logger) BlockDomainsDecider
Name ...
func NewBlockDomainsDeciderHosts ¶
func NewBlockDomainsDeciderHosts(filePath string, logger Logger) BlockDomainsDecider
Name ...
func PrepareBlocklist ¶
func PrepareBlocklist(filePath string, blocklistUpdateFrequency string, blocklistType string, logger Logger) (BlockDomainsDecider, []func() error, error)
PrepareBlocklist ...
type BlockDomainsDeciderABP ¶
type BlockDomainsDeciderABP struct {
// contains filtered or unexported fields
}
func (*BlockDomainsDeciderABP) IsBlocklistUpdateRequired ¶
func (d *BlockDomainsDeciderABP) IsBlocklistUpdateRequired() bool
IsBlocklistUpdateRequired ...
func (*BlockDomainsDeciderABP) IsDomainBlocked ¶
func (d *BlockDomainsDeciderABP) IsDomainBlocked(domain string) bool
IsDomainBlocked ...
func (*BlockDomainsDeciderABP) StartBlocklistUpdater ¶
func (d *BlockDomainsDeciderABP) StartBlocklistUpdater(ticker *time.Ticker)
StartBlocklistUpdater ...
func (*BlockDomainsDeciderABP) UpdateBlocklist ¶
func (d *BlockDomainsDeciderABP) UpdateBlocklist() error
UpdateBlocklist ...
type BlockDomainsDeciderHosts ¶
type BlockDomainsDeciderHosts struct {
// contains filtered or unexported fields
}
func (*BlockDomainsDeciderHosts) IsBlocklistUpdateRequired ¶
func (d *BlockDomainsDeciderHosts) IsBlocklistUpdateRequired() bool
IsBlocklistUpdateRequired ...
func (*BlockDomainsDeciderHosts) IsDomainBlocked ¶
func (d *BlockDomainsDeciderHosts) IsDomainBlocked(domain string) bool
IsDomainBlocked ...
func (*BlockDomainsDeciderHosts) StartBlocklistUpdater ¶
func (d *BlockDomainsDeciderHosts) StartBlocklistUpdater(ticker *time.Ticker)
StartBlocklistUpdater ...
func (*BlockDomainsDeciderHosts) UpdateBlocklist ¶
func (d *BlockDomainsDeciderHosts) UpdateBlocklist() error
UpdateBlocklist ...
type Blocker ¶
type Blocker struct {
Next plugin.Handler
Decider BlockDomainsDecider
ResponseType string
}
type BlocklistType ¶
type BlocklistType string
const BlocklistType_ABP BlocklistType = "abp"
const BlocklistType_Hosts BlocklistType = "hosts"
type Logger ¶
type Logger interface {
// Copied from the list of functions provided by https://pkg.go.dev/github.com/coredns/coredns/plugin/pkg/log
Debug(v ...interface{})
Debugf(format string, v ...interface{})
Error(v ...interface{})
Errorf(format string, v ...interface{})
Fatal(v ...interface{})
Fatalf(format string, v ...interface{})
Info(v ...interface{})
Infof(format string, v ...interface{})
Warning(v ...interface{})
Warningf(format string, v ...interface{})
}
type ResponseType ¶ added in v0.2.0
type ResponseType string
const ( ResponseType_Empty ResponseType = "empty" ResponseType_NXDOMAIN ResponseType = "nxdomain" )
Click to show internal directories.
Click to hide internal directories.