http

package
v3.35.0 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2023 License: Apache-2.0, Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

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

Handler represents an HTTP handler.

func NewHandler

func NewHandler(router http.Handler, opts ...HandlerOption) (*Handler, error)

NewHandler returns a new instance of Handler with a default logger.

func (*Handler) Close

func (h *Handler) Close() error

Close tries to cleanly shutdown the HTTP server, and failing that, after a timeout, calls Server.Close.

func (*Handler) Serve

func (h *Handler) Serve() error

func (*Handler) ServeHTTP

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

ServeHTTP handles an HTTP request.

type HandlerOption

type HandlerOption func(s *Handler) error

HandlerOption is a functional option type for Handler

func OptHandlerBind

func OptHandlerBind(b string) HandlerOption

func OptHandlerCloseTimeout

func OptHandlerCloseTimeout(d time.Duration) HandlerOption

OptHandlerCloseTimeout controls how long to wait for the http Server to shutdown cleanly before forcibly destroying it. Default is 30 seconds.

func OptHandlerComputer

func OptHandlerComputer(handler http.Handler) HandlerOption

func OptHandlerController added in v3.30.0

func OptHandlerController(c *controller.Controller) HandlerOption

func OptHandlerListener

func OptHandlerListener(ln net.Listener, url string) HandlerOption

OptHandlerListener set the listener that will be used by the HTTP server. Url must be the advertised URL. It will be used to show a log to the user about where the Web UI is. This option is mandatory.

func OptHandlerLogger

func OptHandlerLogger(l logger.Logger) HandlerOption

func OptHandlerQueryer

func OptHandlerQueryer(q *queryer.Queryer) HandlerOption

func OptHandlerSnapshotter

func OptHandlerSnapshotter(s *snapshotter.Snapshotter) HandlerOption

func OptHandlerWritelogger added in v3.29.0

func OptHandlerWritelogger(w *writelogger.Writelogger) HandlerOption

Jump to

Keyboard shortcuts

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