middleware

package
v0.0.0-...-34fb709 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetIP

func GetIP(r *http.Request) string

GetIP gets a requests IP address by reading off the forwarded-for header (for proxies) and falls back to use the remote address.

Types

type LoggerHandler

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

LoggerHandler Handler only for logger middleware

func NewLoggerHandler

func NewLoggerHandler(logger *zap.SugaredLogger) *LoggerHandler

NewLoggerHandler creates a new LoggerHandler

func (*LoggerHandler) ContentTypeJSON

func (h *LoggerHandler) ContentTypeJSON(next http.Handler) http.Handler

ContentTypeJSON sets the content type and x-content-type-options to json

func (*LoggerHandler) LogRoute

func (h *LoggerHandler) LogRoute(next http.Handler) http.Handler

LogRoute logs the called route together

func (*LoggerHandler) LogRouteWithIP

func (h *LoggerHandler) LogRouteWithIP(next http.Handler) http.Handler

LogRouteWithIP logs the called route together with the ip

Jump to

Keyboard shortcuts

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