MCPcopy Index your code
hub / github.com/PasarGuard/node / ConditionalMiddleware

Function ConditionalMiddleware

controller/rpc/middleware.go:200–220  ·  view source on GitHub ↗
(s *Service)

Source from the content-addressed store, hash-verified

198}
199
200func ConditionalMiddleware(s *Service) grpc.UnaryServerInterceptor {
201 return func(
202 ctx context.Context,
203 req interface{},
204 info *grpc.UnaryServerInfo,
205 handler grpc.UnaryHandler,
206 ) (interface{}, error) {
207 var interceptors []grpc.UnaryServerInterceptor
208
209 interceptors = append(interceptors, LoggingInterceptor(s))
210
211 interceptors = append(interceptors, validateApiKeyMiddleware(s))
212
213 if backendMethods[info.FullMethod] {
214 interceptors = append(interceptors, CheckBackendMiddleware(s))
215 }
216
217 chained := grpcmiddleware.ChainUnaryServer(interceptors...)
218 return chained(ctx, req, info, handler)
219 }
220}
221
222func ConditionalStreamMiddleware(s *Service) grpc.StreamServerInterceptor {
223 return func(

Callers 1

StartGRPCListenerFunction · 0.85

Calls 3

LoggingInterceptorFunction · 0.85
validateApiKeyMiddlewareFunction · 0.85
CheckBackendMiddlewareFunction · 0.85

Tested by

no test coverage detected