Documentation ¶
Index ¶
- Constants
- func GetEmptyAnswerForQuestionType(questionType uint16, domain string) dns.RR
- type BlockDomainsDecider
- func NewBlockDomainsDeciderABPFile(filePath string, logger Logger) BlockDomainsDecider
- func NewBlockDomainsDeciderABPUrl(url string, logger Logger) BlockDomainsDecider
- func NewBlockDomainsDeciderHostsFile(filePath string, logger Logger) BlockDomainsDecider
- func NewBlockDomainsDeciderHostsUrl(url string, logger Logger) BlockDomainsDecider
- func PrepareBlocklist(filePath string, blocklistUpdateFrequency string, blocklistType string, ...) (BlockDomainsDecider, []func() error, error)
- type BlockDomainsDeciderABP
- type BlockDomainsDeciderABPUrl
- type BlockDomainsDeciderHosts
- type BlockDomainsDeciderHostsUrl
- 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 ¶
This section is empty.
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 NewBlockDomainsDeciderABPFile ¶
func NewBlockDomainsDeciderABPFile(filePath string, logger Logger) BlockDomainsDecider
Name ...
func NewBlockDomainsDeciderABPUrl ¶
func NewBlockDomainsDeciderABPUrl(url string, logger Logger) BlockDomainsDecider
Name ...
func NewBlockDomainsDeciderHostsFile ¶
func NewBlockDomainsDeciderHostsFile(filePath string, logger Logger) BlockDomainsDecider
Name ...
func NewBlockDomainsDeciderHostsUrl ¶
func NewBlockDomainsDeciderHostsUrl(url 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 BlockDomainsDeciderABPUrl ¶
type BlockDomainsDeciderABPUrl struct {
// contains filtered or unexported fields
}
func (*BlockDomainsDeciderABPUrl) IsBlocklistUpdateRequired ¶
func (d *BlockDomainsDeciderABPUrl) IsBlocklistUpdateRequired() bool
IsBlocklistUpdateRequired ...
func (*BlockDomainsDeciderABPUrl) IsDomainBlocked ¶
func (d *BlockDomainsDeciderABPUrl) IsDomainBlocked(domain string) bool
IsDomainBlocked ...
func (*BlockDomainsDeciderABPUrl) StartBlocklistUpdater ¶
func (d *BlockDomainsDeciderABPUrl) StartBlocklistUpdater(ticker *time.Ticker)
StartBlocklistUpdater ...
func (*BlockDomainsDeciderABPUrl) UpdateBlocklist ¶
func (d *BlockDomainsDeciderABPUrl) 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 BlockDomainsDeciderHostsUrl ¶
type BlockDomainsDeciderHostsUrl struct {
// contains filtered or unexported fields
}
func (*BlockDomainsDeciderHostsUrl) IsBlocklistUpdateRequired ¶
func (d *BlockDomainsDeciderHostsUrl) IsBlocklistUpdateRequired() bool
IsBlocklistUpdateRequired ...
func (*BlockDomainsDeciderHostsUrl) IsDomainBlocked ¶
func (d *BlockDomainsDeciderHostsUrl) IsDomainBlocked(domain string) bool
IsDomainBlocked ...
func (*BlockDomainsDeciderHostsUrl) StartBlocklistUpdater ¶
func (d *BlockDomainsDeciderHostsUrl) StartBlocklistUpdater(ticker *time.Ticker)
StartBlocklistUpdater ...
func (*BlockDomainsDeciderHostsUrl) UpdateBlocklist ¶
func (d *BlockDomainsDeciderHostsUrl) 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 ¶
type ResponseType string
const ( ResponseType_Empty ResponseType = "empty" ResponseType_NXDOMAIN ResponseType = "nxdomain" )
Source Files ¶
Click to show internal directories.
Click to hide internal directories.