global

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2022 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NewMiddlewares = map[string]NewMiddleware{}

NewMiddlewares contains all the registered new middleware functions.

View Source
var Services = map[string]NewService{}

Services is a map of service name and its new function.

Functions

func Register

func Register(name string, newFunc NewService)

Register registers a new HTTP services with name and new function.

func RegisterMiddleware

func RegisterMiddleware(name string, n NewMiddleware)

RegisterMiddleware registers a new HTTP middleware and its new function.

Types

type Middleware

type Middleware func(h http.Handler) http.Handler

Middleware is a middleware http handler.

type NewMiddleware

type NewMiddleware func(conf map[string]interface{}) (Middleware, int, error)

NewMiddleware is the function that HTTP middlewares need to register at init time.

type NewService

type NewService func(conf map[string]interface{}, log *zerolog.Logger) (Service, error)

NewService is the function that HTTP services need to register at init time.

type Service

type Service interface {
	Handler() http.Handler
	Prefix() string
	Close() error
	// List of url relative to the prefix to be unprotected by the authentication
	// middleware. To be seen if we need url-verb fine grained skip checks like
	// GET is public and POST is not.
	Unprotected() []string
}

Service represents a HTTP service.

Jump to

Keyboard shortcuts

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