propagation

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MiddlewareName = "propagation"
)

Variables

This section is empty.

Functions

func WithLogger added in v1.3.0

func WithLogger(logger log.Logger) options.Option

WithLogger sets the logger for the middleware. It uses the runtime's log.WithLogger to ensure consistency.

func WithPropagationType

func WithPropagationType(pt principal.PropagationType) options.Option

WithPropagationType sets the propagation type for the principal.

Types

type Middleware

type Middleware struct {
	*Options
	// contains filtered or unexported fields
}

Middleware is a Kratos middleware for principal propagation.

func New

func New(opts ...options.Option) *Middleware

New is a convenience function for creating a new principal propagation middleware.

func (*Middleware) Client

func (m *Middleware) Client() middleware.KMiddleware

Client implements the Kratos middleware for client-side principal propagation.

func (*Middleware) Server

func (m *Middleware) Server() middleware.KMiddleware

Server implements the Kratos middleware for server-side principal extraction.

type Options

type Options struct {
	// PropagationType determines how the principal is propagated (e.g., via gRPC metadata or HTTP headers).
	PropagationType principal.PropagationType
	// Logger is the logger instance for the middleware.
	Logger log.Logger
}

Options holds the configuration for the principal middleware.

Jump to

Keyboard shortcuts

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