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
- type IRuleset
- type ListMap
- type ListUpdater
- type StoredListConfiguration
- type UpdateableRuleset
Constants ¶
View Source
const Version = "0.2.5"
Variables ¶
View Source
var ValidateQName = regexp.MustCompile("([a-zA-Z0-9]|\\.|-)*").MatchString
Functions ¶
This section is empty.
Types ¶
type BlockingResponseWriter ¶ added in v0.2.4
type BlockingResponseWriter struct { Writer dns.ResponseWriter Plugin *DNSAdBlock Request *dns.Msg RequestState *request.Request }
func (*BlockingResponseWriter) Close ¶ added in v0.2.4
func (b *BlockingResponseWriter) Close() error
func (*BlockingResponseWriter) Hijack ¶ added in v0.2.4
func (b *BlockingResponseWriter) Hijack()
func (*BlockingResponseWriter) LocalAddr ¶ added in v0.2.4
func (b *BlockingResponseWriter) LocalAddr() net.Addr
func (*BlockingResponseWriter) RemoteAddr ¶ added in v0.2.4
func (b *BlockingResponseWriter) RemoteAddr() net.Addr
func (*BlockingResponseWriter) TsigStatus ¶ added in v0.2.4
func (b *BlockingResponseWriter) TsigStatus() error
func (*BlockingResponseWriter) TsigTimersOnly ¶ added in v0.2.4
func (b *BlockingResponseWriter) TsigTimersOnly(b2 bool)
type ConfiguredRuleSet ¶ added in v0.2.0
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 ¶ added in v0.2.0
func (r *ConfiguredRuleSet) AddRegexToBlacklist(regex string) error
func (*ConfiguredRuleSet) AddRegexToWhitelist ¶ added in v0.2.0
func (r *ConfiguredRuleSet) AddRegexToWhitelist(regex string) error
func (*ConfiguredRuleSet) AddToBlacklist ¶ added in v0.2.0
func (r *ConfiguredRuleSet) AddToBlacklist(qname string)
func (*ConfiguredRuleSet) AddToWhitelist ¶ added in v0.2.0
func (r *ConfiguredRuleSet) AddToWhitelist(qname string)
func (*ConfiguredRuleSet) IsBlacklisted ¶ added in v0.2.0
func (r *ConfiguredRuleSet) IsBlacklisted(qname string) bool
func (*ConfiguredRuleSet) IsWhitelisted ¶ added in v0.2.0
func (r *ConfiguredRuleSet) IsWhitelisted(qname string) bool
type DNSAdBlock ¶
type DNSAdBlock struct { Next plugin.Handler ConfiguredRuleSet ConfiguredRuleSet FileRuleSet UpdateableRuleset // contains filtered or unexported fields }
func (*DNSAdBlock) IsBlacklisted ¶ added in v0.2.0
func (e *DNSAdBlock) IsBlacklisted(qname string) bool
func (*DNSAdBlock) IsWhitelisted ¶ added in v0.2.0
func (e *DNSAdBlock) IsWhitelisted(qname string) bool
func (*DNSAdBlock) ServeDNS ¶
func (e *DNSAdBlock) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (int, error)
func (*DNSAdBlock) ShouldBlock ¶ added in v0.2.0
func (e *DNSAdBlock) ShouldBlock(qname string) bool
type ListMap ¶ added in v0.2.0
func GenerateListMap ¶ added in v0.2.0
func GenerateListMapFromFileUrls ¶ added in v0.2.0
func GenerateListMapFromHTTPUrls ¶ added in v0.2.0
type ListUpdater ¶ added in v0.2.0
type ListUpdater struct { Enabled bool UpdateInterval time.Duration RetryCount int RetryDelay time.Duration Plugin *DNSAdBlock // contains filtered or unexported fields }
func (*ListUpdater) Start ¶ added in v0.2.0
func (u *ListUpdater) Start()
type StoredListConfiguration ¶ added in v0.2.0
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 ¶ added in v0.2.0
func ReadListConfiguration(path string) (*StoredListConfiguration, error)
func (*StoredListConfiguration) NeedsUpdate ¶ added in v0.2.0
func (s *StoredListConfiguration) NeedsUpdate(updateDuration time.Duration) bool
func (*StoredListConfiguration) Persist ¶ added in v0.2.0
func (s *StoredListConfiguration) Persist(path string) error
type UpdateableRuleset ¶ added in v0.2.0
type UpdateableRuleset struct { Blacklist map[string]bool Whitelist map[string]bool BlacklistSources []string WhitelistSources []string }
func NewFileRuleSet ¶ added in v0.2.0
func NewFileRuleSet(whitelist, blacklist []string) *UpdateableRuleset
func (*UpdateableRuleset) IsBlacklisted ¶ added in v0.2.0
func (u *UpdateableRuleset) IsBlacklisted(qn string) bool
func (*UpdateableRuleset) IsWhitelisted ¶ added in v0.2.0
func (u *UpdateableRuleset) IsWhitelisted(qn string) bool
Click to show internal directories.
Click to hide internal directories.