middleware

package
v0.0.77 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2026 License: BSD-2-Clause Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Client

func Client(logger log.Logger) middleware.Middleware

Client is a client logging middleware.

func ClientCorrelationIdInjector

func ClientCorrelationIdInjector() middleware.Middleware

ClientCorrelationIdInjector middleware injects the correlation ID into the client request header

func GetRequestTime added in v0.0.67

func GetRequestTime(ctx context.Context) time.Time

GetRequestTime retrieves the injected time from the context. It returns the zero value for time.Time if the key is not found.

func InjectRequestTime added in v0.0.67

func InjectRequestTime() middleware.Middleware

InjectRequestTime is a Kratos middleware that injects the current time into the context.

func Server

func Server(logger log.Logger) middleware.Middleware

Server is a server logging middleware.

func ServerCorrelationIdInjector

func ServerCorrelationIdInjector() middleware.Middleware

ServerCorrelationIdInjector middleware injects the correlation ID into the server context

func ServerSecurityHeaderValidator

func ServerSecurityHeaderValidator() middleware.Middleware

ServerSecurityHeaderValidator middleware validates the presence of required security headers

func Validator

func Validator() middleware.Middleware

Validator is a validator middleware.

Types

type CtxKey

type CtxKey string

CtxKey is a custom type for context keys

const (
	CtxCorrelationIdKey   CtxKey = "x-correlation-id"
	CtxSystemPeerKey      CtxKey = "x-system-peer"
	CtxSignedHeadersKey   CtxKey = "x-signed-headers"
	CtxAuthorizationKey   CtxKey = "Authorization"
	CtxRequestIDKey       CtxKey = "rid"
	CtxMdCorrelationIdKey CtxKey = "x-md-global-correlation-id"
	CtxMdRequestIdKey     CtxKey = "x-md-global-rid"
)

Context keys for various headers

type Redacter

type Redacter interface {
	Redact() string
}

Jump to

Keyboard shortcuts

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