http_handler

package
Version: v1.8.7 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2021 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadMsgFromReq

func ReadMsgFromReq(req *http.Request) (*dns.Msg, error)

Types

type Handler

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

func NewHandler

func NewHandler(dnsHandler dns_handler.Handler, options ...Option) *Handler

func (*Handler) ServeHTTP

func (h *Handler) ServeHTTP(w http.ResponseWriter, req *http.Request)

type Option

type Option func(h *Handler)

func WithClientSrcIPHeader

func WithClientSrcIPHeader(s string) Option

WithClientSrcIPHeader sets the header that Handler can read client's source IP when server is behind a proxy. e.g. "X-Forwarded-For" (nginx).

func WithPath

func WithPath(s string) Option

WithPath sets the server entry point url path. If empty, Handler will not check the request path.

func WithTimeout

func WithTimeout(d time.Duration) Option

WithTimeout sets the query maximum executing time. Default is defaultTimeout.

Jump to

Keyboard shortcuts

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