engine

package
v0.0.0-...-06d884a Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotConfigUpstream = errors.New("not configuration upstream")

ErrNotConfigUpstream not config upstream

Functions

func QuestionStream

func QuestionStream(name string, qtype uint16) (r *dns.Msg, rtt time.Duration, err error)

QuestionStream query upstream

Types

type DNSCall

type DNSCall func(r *dns.Msg) error

DNSCall dns controller func

type Engine

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

Engine dns engine

func NewEngine

func NewEngine() (h *Engine)

NewEngine New new dns engine

func (*Engine) Handle

func (h *Engine) Handle(msg *dns.Msg) (err error)

Handle engine handle

func (*Engine) LoadCache

func (h *Engine) LoadCache(msg *dns.Msg) (hasCache bool, err error)

LoadCache load record cache

func (*Engine) Register

func (h *Engine) Register(qtype uint16, handle DNSCall)

Register register dns controller

func (*Engine) ServeDNS

func (h *Engine) ServeDNS(w dns.ResponseWriter, r *dns.Msg)

ServeDNS export func to serve

func (*Engine) StoreCache

func (h *Engine) StoreCache(msg *dns.Msg) (err error)

StoreCache store record cache

type Option

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

Option server option

type OptionsFunc

type OptionsFunc func(c *Option)

OptionsFunc option func

func WithDNSAddr

func WithDNSAddr(addr string) OptionsFunc

WithDNSAddr option set tcp and udp Addr

func WithDNSHandle

func WithDNSHandle(dnsHandle *Engine) OptionsFunc

WithDNSHandle option set dnsHandle

func WithHTTPAPIAddr

func WithHTTPAPIAddr(httpAPIAddr string) OptionsFunc

WithHTTPAPIAddr option set httpAPIAddr

func WithHTTPDNSAddr

func WithHTTPDNSAddr(httpDNSAddr string) OptionsFunc

WithHTTPDNSAddr option set httpDNSAddr

func WithHttpAPIHandle

func WithHttpAPIHandle(httpAPIHandle *gin.Engine) OptionsFunc

WithHttpAPIHandle option set httpAPIHandle

func WithHttpDNSHandle

func WithHttpDNSHandle(httpDNSHandle *gin.Engine) OptionsFunc

WithHttpDNSHandle option set httpDNSHandle

func WithTCPAddr

func WithTCPAddr(tcpAddr string) OptionsFunc

WithTCPAddr option set tcpAddr

func WithUDPAddr

func WithUDPAddr(udpAddr string) OptionsFunc

WithUDPAddr option set udpAddr

type Server

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

Server server

func NewServer

func NewServer(opts ...OptionsFunc) *Server

NewServer new listen server

func (Server) ListenAndServe

func (s Server) ListenAndServe() (err error)

ListenAndServe listen all serve

func (Server) Shutdown

func (s Server) Shutdown(ctx context.Context) (err error)

Shutdown gracefully shuts down the server without interrupting any active connections.

Jump to

Keyboard shortcuts

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