resolver

package
v3.16.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 7, 2022 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package resolver contains a censoring DNS resolver. Most queries are answered without censorship, but selected queries could either be discarded or replied to with a bogon or NXDOMAIN answer.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CensoringResolver

type CensoringResolver struct {
	// contains filtered or unexported fields
}

CensoringResolver is a censoring resolver.

func NewCensoringResolver

func NewCensoringResolver(
	blocked, hijacked, ignored []string, uncensored Resolver,
) *CensoringResolver

NewCensoringResolver creates a new CensoringResolver instance using the specified list of keywords to censor. blocked is the list of keywords that trigger NXDOMAIN if they appear in a query. hijacked is similar but redirects to 127.0.0.1, where the transparent HTTP and TLS proxies will pick them up. dnsNetwork and dnsAddress are the settings to configure the upstream, non censored DNS.

func (*CensoringResolver) ServeDNS

func (r *CensoringResolver) ServeDNS(rw dns.ResponseWriter, req *dns.Msg)

ServeDNS serves a DNS request

func (*CensoringResolver) Start

func (r *CensoringResolver) Start(address string) (*dns.Server, error)

Start starts the DNS resolver

type Resolver added in v3.13.0

type Resolver interface {
	LookupHost(ctx context.Context, hostname string) ([]string, error)
}

Resolver resolves domain names.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL