server

package
v3.9.0 Latest Latest
Warning

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

Go to latest
Published: May 29, 2022 License: GPL-3.0 Imports: 17 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrServerClosed = errors.New("server closed")
)

Functions

This section is empty.

Types

type Server

type Server struct {
	// DNSHandler is the dns handler required by UDP, TCP, DoT server.
	DNSHandler dns_handler.Handler

	// HttpHandler is the http handler required by HTTP, DoH server.
	HttpHandler http.Handler

	// TLSConfig is required by DoT, DoH server.
	// It must contain at least one certificate. If not, caller should use
	// Cert, Key to load a certificate from disk.
	TLSConfig *tls.Config

	// Certificate files to start DoT, DoH server.
	// Only useful if there is no server certificate specified in TLSConfig.
	Cert, Key string

	// IdleTimeout limits the maximum time period that a connection
	// can idle. Default is defaultIdleTimeout.
	IdleTimeout time.Duration

	// Logger optionally specifies logger for the server logging.
	// A nil Logger will disables the logging.
	Logger *zap.Logger
	// contains filtered or unexported fields
}

Server is a DNS server. It's functions, Server.ServeUDP etc., will block and close the net.Listener/net.PacketConn and always return a non-nil error. If Server was closed, the returned err will be ErrServerClosed.

func (*Server) Close

func (s *Server) Close() error

Close closes the Server and all its inner listeners.

func (*Server) Closed

func (s *Server) Closed() bool

Closed returns true if server was closed.

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(l net.Listener) error

func (*Server) ServeHTTPS

func (s *Server) ServeHTTPS(l net.Listener) error

func (*Server) ServeTCP

func (s *Server) ServeTCP(l net.Listener) error

func (*Server) ServeTLS

func (s *Server) ServeTLS(l net.Listener) error

func (*Server) ServeUDP

func (s *Server) ServeUDP(c net.PacketConn) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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