ws

package
v0.0.0-...-acf41ad Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Logger

type Logger interface {
	Printf(format string, args ...interface{})
}

type Option

type Option func(ws *WS)

Option wrapper for web server.

func WithCustomPort

func WithCustomPort(p int) Option

WithCustomPort set service port.

func WithMiddlewareCustomAfter

func WithMiddlewareCustomAfter(f func(w http.ResponseWriter, r *http.Request) error) Option

WithMiddlewareCustomAfter add custom logger.

func WithMiddlewareCustomBefore

func WithMiddlewareCustomBefore(f func(w http.ResponseWriter, r *http.Request) error) Option

WithMiddlewareCustomBefore add custom logger.

func WithMiddlewareDefaultLogger

func WithMiddlewareDefaultLogger() Option

WithMiddlewareDefaultLogger add default logger.

func WithMiddlewareRealIP

func WithMiddlewareRealIP() Option

WithMiddlewareRealIP add X-Real-IP header.

func WithMiddlewareRecover

func WithMiddlewareRecover() Option

WithMiddlewareRecover recovers from panics.

func WithMiddlewareReqID

func WithMiddlewareReqID() Option

WithMiddlewareReqID injects a request ID into the context (uid as string) of each request.

func WithMiddlewareTimeout

func WithMiddlewareTimeout(sec int) Option

WithMiddlewareTimeout set request execution timeout.

func WithShutdownTimeout

func WithShutdownTimeout(sec int16) Option

WithShutdownTimeout set timeout for shutting down listener.

type WS

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

WS object.

func New

func New(opts ...Option) (*WS, error)

New return WS object.

func (*WS) Router

func (ws *WS) Router() *chi.Mux

Router object.

func (*WS) Run

func (ws *WS) Run(ctx context.Context, l Logger)

Run web-server.

Jump to

Keyboard shortcuts

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