Documentation ¶
Overview ¶
* Copyright 2018 - 2020 Christian Müller <dev@c-mueller.xyz> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.
Index ¶
- Constants
- Variables
- type BlockingResponseWriter
- func (b *BlockingResponseWriter) Close() error
- func (b *BlockingResponseWriter) Hijack()
- func (b *BlockingResponseWriter) LocalAddr() net.Addr
- func (b *BlockingResponseWriter) RemoteAddr() net.Addr
- func (b *BlockingResponseWriter) TsigStatus() error
- func (b *BlockingResponseWriter) TsigTimersOnly(b2 bool)
- func (b *BlockingResponseWriter) Write(bytes []byte) (int, error)
- func (b *BlockingResponseWriter) WriteMsg(msg *dns.Msg) error
- type ConfiguredRuleSet
- func (r *ConfiguredRuleSet) AddRegexToBlacklist(regex string) error
- func (r *ConfiguredRuleSet) AddRegexToWhitelist(regex string) error
- func (r *ConfiguredRuleSet) AddToBlacklist(qname string)
- func (r *ConfiguredRuleSet) AddToWhitelist(qname string)
- func (r *ConfiguredRuleSet) IsBlacklisted(qname string) bool
- func (r *ConfiguredRuleSet) IsWhitelisted(qname string) bool
- type DNSAdBlock
- func (e *DNSAdBlock) IsBlacklisted(qname string) bool
- func (e *DNSAdBlock) IsWhitelisted(qname string) bool
- func (e *DNSAdBlock) Name() string
- func (e *DNSAdBlock) NotBlock() bool
- func (e *DNSAdBlock) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (int, error)
- func (e *DNSAdBlock) ShouldBlock(qname string) bool
- type IRuleset
- type ListMap
- type ListUpdater
- type StoredListConfiguration
- type UpdateableRuleset
Constants ¶
View Source
const Version = "0.2.8"
Variables ¶
View Source
var ValidateQName = regexp.MustCompile("([a-zA-Z0-9]|\\.|-)*").MatchString
Functions ¶
This section is empty.
Types ¶
type BlockingResponseWriter ¶
type BlockingResponseWriter struct { Writer dns.ResponseWriter Plugin *DNSAdBlock Request *dns.Msg RequestState *request.Request }
func (*BlockingResponseWriter) Close ¶
func (b *BlockingResponseWriter) Close() error
func (*BlockingResponseWriter) Hijack ¶
func (b *BlockingResponseWriter) Hijack()
func (*BlockingResponseWriter) LocalAddr ¶
func (b *BlockingResponseWriter) LocalAddr() net.Addr
func (*BlockingResponseWriter) RemoteAddr ¶
func (b *BlockingResponseWriter) RemoteAddr() net.Addr
func (*BlockingResponseWriter) TsigStatus ¶
func (b *BlockingResponseWriter) TsigStatus() error
func (*BlockingResponseWriter) TsigTimersOnly ¶
func (b *BlockingResponseWriter) TsigTimersOnly(b2 bool)
type ConfiguredRuleSet ¶
type ConfiguredRuleSet struct { Blacklist map[string]bool Whitelist map[string]bool WhitelistRegex []*regexp.Regexp BlacklistRegex []*regexp.Regexp }
func BuildRuleset ¶
func BuildRuleset(whitelist, blacklist []string) ConfiguredRuleSet
func (*ConfiguredRuleSet) AddRegexToBlacklist ¶
func (r *ConfiguredRuleSet) AddRegexToBlacklist(regex string) error
func (*ConfiguredRuleSet) AddRegexToWhitelist ¶
func (r *ConfiguredRuleSet) AddRegexToWhitelist(regex string) error
func (*ConfiguredRuleSet) AddToBlacklist ¶
func (r *ConfiguredRuleSet) AddToBlacklist(qname string)
func (*ConfiguredRuleSet) AddToWhitelist ¶
func (r *ConfiguredRuleSet) AddToWhitelist(qname string)
func (*ConfiguredRuleSet) IsBlacklisted ¶
func (r *ConfiguredRuleSet) IsBlacklisted(qname string) bool
func (*ConfiguredRuleSet) IsWhitelisted ¶
func (r *ConfiguredRuleSet) IsWhitelisted(qname string) bool
type DNSAdBlock ¶
type DNSAdBlock struct { Next plugin.Handler ConfiguredRuleSet ConfiguredRuleSet FileRuleSet ConfiguredRuleSet Fall fall.F // contains filtered or unexported fields }
func (*DNSAdBlock) IsBlacklisted ¶
func (e *DNSAdBlock) IsBlacklisted(qname string) bool
func (*DNSAdBlock) IsWhitelisted ¶
func (e *DNSAdBlock) IsWhitelisted(qname string) bool
func (*DNSAdBlock) NotBlock ¶ added in v1.1.5
func (e *DNSAdBlock) NotBlock() bool
func (*DNSAdBlock) ServeDNS ¶
func (e *DNSAdBlock) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (int, error)
func (*DNSAdBlock) ShouldBlock ¶
func (e *DNSAdBlock) ShouldBlock(qname string) bool
type ListMap ¶
func GenerateListMap ¶
type ListUpdater ¶
type ListUpdater struct { Enabled bool UpdateInterval time.Duration RetryCount int RetryDelay time.Duration Plugin *DNSAdBlock // contains filtered or unexported fields }
func (*ListUpdater) Start ¶
func (u *ListUpdater) Start()
type StoredListConfiguration ¶
type StoredListConfiguration struct { UpdateTimestamp int `json:"update_timestamp"` BlacklistURLs []string `json:"blacklist_urls"` WhitelistURLs []string `json:"whitelist_urls"` Blacklist ListMap `json:"blacklist"` Whitelist ListMap `json:"whitelist"` }
func ReadListConfiguration ¶
func ReadListConfiguration(path string) (*StoredListConfiguration, error)
func (*StoredListConfiguration) NeedsUpdate ¶
func (s *StoredListConfiguration) NeedsUpdate(updateDuration time.Duration) bool
func (*StoredListConfiguration) Persist ¶
func (s *StoredListConfiguration) Persist(path string) error
type UpdateableRuleset ¶
type UpdateableRuleset struct { Blacklist map[string]bool Whitelist map[string]bool BlacklistSources []string WhitelistSources []string }
func NewFileRuleSet ¶
func NewFileRuleSet(whitelist, blacklist []string) *UpdateableRuleset
func (*UpdateableRuleset) IsBlacklisted ¶
func (u *UpdateableRuleset) IsBlacklisted(qn string) bool
func (*UpdateableRuleset) IsWhitelisted ¶
func (u *UpdateableRuleset) IsWhitelisted(qn string) bool
Click to show internal directories.
Click to hide internal directories.