middleware

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2026 License: Apache-2.0 Imports: 11 Imported by: 2

Documentation

Overview

Package middleware provides reusable gRPC server interceptors for common production concerns such as authentication, structured logging, payload logging, and panic recovery.

The helper functions return interceptor slices so callers can compose them into their own preferred chain order.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddAuth added in v0.0.3

AddAuth returns unary and stream interceptors that enforce gRPC auth middleware.

func AddLogging

func AddLogging(
	logger *zap.Logger,
) ([]grpc.UnaryServerInterceptor, []grpc.StreamServerInterceptor)

AddLogging returns unary and stream interceptors for structured gRPC logging.

Example
unary, stream := AddLogging(zap.NewNop())
_, _ = unary, stream

func AddPayloadLogging

func AddPayloadLogging(
	logger *zap.Logger,
) ([]grpc.UnaryServerInterceptor, []grpc.StreamServerInterceptor)

AddPayloadLogging returns interceptors that log request and response payloads in addition to standard gRPC call metadata.

Example
unary, stream := AddPayloadLogging(zap.NewNop())
_, _ = unary, stream

func AddRecovery

AddRecovery returns interceptors that convert panics in gRPC handlers into internal errors.

Example
unary, stream := AddRecovery()
_, _ = unary, stream

Types

This section is empty.

Directories

Path Synopsis
`grpcauth` is an authentication and authorization gRPC server side authentication wrappers.
`grpcauth` is an authentication and authorization gRPC server side authentication wrappers.
Package zaplogger adapts zap loggers for gRPC internals and provides a small initialization helper for structured JSON logging.
Package zaplogger adapts zap loggers for gRPC internals and provides a small initialization helper for structured JSON logging.

Jump to

Keyboard shortcuts

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