interceptor

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2025 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthInterceptor

func AuthInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo,
	handler grpc.UnaryHandler) (resp interface{}, err error)

AuthInterceptor 简化版认证拦截器 - 只传递认证信息

func ChainUnaryInterceptors

func ChainUnaryInterceptors(interceptors ...grpc.UnaryServerInterceptor) grpc.UnaryServerInterceptor

ChainUnaryInterceptors 链式组合多个拦截器

func CreateDefaultInterceptorChain

func CreateDefaultInterceptorChain() grpc.UnaryServerInterceptor

创建默认拦截器链

func InitMetrics

func InitMetrics()

InitMetrics 初始化所有指标

func LoggingInterceptor

func LoggingInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo,
	handler grpc.UnaryHandler) (resp interface{}, err error)

LoggingInterceptor 详细日志拦截器

func MetricsInterceptor

func MetricsInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo,
	handler grpc.UnaryHandler) (resp interface{}, err error)

MetricsInterceptor 收集RPC请求指标的拦截器

func RateLimitInterceptor

func RateLimitInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo,
	handler grpc.UnaryHandler) (resp interface{}, err error)

RateLimitInterceptor 限流拦截器

func RecoveryInterceptor

func RecoveryInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo,
	handler grpc.UnaryHandler) (resp interface{}, err error)

RecoveryInterceptor 防止RPC服务因panic而崩溃的拦截器

func RequestInfoInterceptor

func RequestInfoInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo,
	handler grpc.UnaryHandler) (resp interface{}, err error)

RequestInfoInterceptor RPC请求信息中间件,提取客户端详细信息

Types

This section is empty.

Jump to

Keyboard shortcuts

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