listener

package
v2.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ListenerCfg

type ListenerCfg struct {
	// Address to listen on, ":dns" if empty.
	Addr string
	// if "tcp" or "tcp-tls" (DNS over TLS) it will invoke a TCP listener, otherwise an UDP one
	Net string
	// The net.Conn.SetReadTimeout value for new connections, defaults to 2 * time.Second.
	ReadTimeout time.Duration
	// The net.Conn.SetWriteTimeout value for new connections, defaults to 2 * time.Second.
	WriteTimeout time.Duration
}

type Option

type Option func(*Server)

func WithListener

func WithListener(cfg ListenerCfg) Option

func WithMaxRequests

func WithMaxRequests(max int) Option

func WithRouter

func WithRouter(r *router.Router) Option

type Server

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

func NewServer

func NewServer(opts ...Option) (*Server, error)

func (*Server) ServeDNS

func (s *Server) ServeDNS(w dns.ResponseWriter, req *dns.Msg)

func (*Server) Shutdown

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

func (*Server) Start

func (s *Server) Start() error

Jump to

Keyboard shortcuts

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