Documentation ¶
Index ¶
- func CacheKey(msg *dns.Msg) string
- type GoholeHandler
- type GoholeResolver
- func (ghr *GoholeResolver) AllowDomain(domain string)
- func (ghr *GoholeResolver) ApplyBlocklist(blocklistContent []byte)
- func (ghr *GoholeResolver) BlockDomain(domain string)
- func (ghr *GoholeResolver) FetchBlocklist(url string) ([]byte, error)
- func (ghr *GoholeResolver) Resolve(r *dns.Msg) *dns.Msg
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type GoholeHandler ¶
type GoholeHandler struct {
Resolver *GoholeResolver
}
GoholeHandler is kind of a proxy to the GoholeResolver
func (GoholeHandler) ServeDNS ¶
func (ghh GoholeHandler) ServeDNS(w dns.ResponseWriter, r *dns.Msg)
ServeDNS is the interface we need to satisfy for miekg/dns
type GoholeResolver ¶
type GoholeResolver struct { // This is the recursive DNS resolver UpstreamDNS []string DNSCache *ttlcache.Cache // contains filtered or unexported fields }
GoholeResolver is the cache and blocking mechanism
func NewGoholeResolver ¶
func NewGoholeResolver(c *cli.Context) *GoholeResolver
NewGoholeResolver sets up a new Resolver
func (*GoholeResolver) AllowDomain ¶
func (ghr *GoholeResolver) AllowDomain(domain string)
AllowDomain removes a domain from the blocklist.
func (*GoholeResolver) ApplyBlocklist ¶
func (ghr *GoholeResolver) ApplyBlocklist(blocklistContent []byte)
ApplyBlocklist applies the block list content to the resolver. the content must be in hosts file format
func (*GoholeResolver) BlockDomain ¶
func (ghr *GoholeResolver) BlockDomain(domain string)
BlockDomain blocks a domain in the Resolver. All queries for that domain will return NXDomain.
func (*GoholeResolver) FetchBlocklist ¶
func (ghr *GoholeResolver) FetchBlocklist(url string) ([]byte, error)
FetchBlocklist downloads the given block list and returns it as a string. Returns an error if downloading fails
Click to show internal directories.
Click to hide internal directories.