dispatcher

package
v1.5.7 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2020 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrUpstreamsFailed all upstreams are failed or not respond in time.
	ErrUpstreamsFailed = errors.New("all upstreams failed or not respond in time")
)

Functions

This section is empty.

Types

type Dispatcher

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

Dispatcher represents a dns query dispatcher

func InitDispatcher

func InitDispatcher(c *config.Config) (*Dispatcher, error)

InitDispatcher inits a dispatcher from configuration

func (*Dispatcher) Dispatch added in v1.5.7

func (d *Dispatcher) Dispatch(ctx context.Context, q *dns.Msg) (*dns.Msg, error)

Dispatch sends q to upstreams and return its first valid result.

func (*Dispatcher) ServeDNS

func (d *Dispatcher) ServeDNS(ctx context.Context, q *dns.Msg) (r *dns.Msg, err error)

ServeDNS sends q to upstreams and return its first valid result. ServeDNS will add r's IPs to ipset. If all upstreams failed, ServeDNS will return a r with r.Code = dns.RcodeServerFailure

func (*Dispatcher) StartServer added in v1.3.1

func (d *Dispatcher) StartServer() error

StartServer starts mos-chinadns. Will always return a non-nil err.

Directories

Path Synopsis
logger for the whole dispatcher package
logger for the whole dispatcher package
matcher

Jump to

Keyboard shortcuts

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