Documentation ¶
Overview ¶
Package middleware contains middlewares for gRPC unknown handlers.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Wrap ¶ added in v0.3.0
func Wrap(base grpc.StreamHandler, mws ...Middleware) grpc.StreamHandler
Wrap is a chain of middlewares.
Types ¶
type Middleware ¶
type Middleware func(grpc.StreamHandler) grpc.StreamHandler
Middleware is a function that intercepts the execution of a gRPC handler.
func AppInfo ¶
func AppInfo(app, author, version string) Middleware
AppInfo adds the app info to the header metadata.
func Maybe ¶ added in v0.3.0
func Maybe(apply bool, mw Middleware) Middleware
Maybe is a middleware that conditionally applies the given middleware.
func PassMetadata ¶ added in v0.3.0
func PassMetadata() Middleware
PassMetadata passes the incoming metadata into outgoing metadata.
func Recoverer ¶
func Recoverer() Middleware
Recoverer is a middleware that recovers from panics, logs the panic and returns a gRPC error if possible.
type Reflector ¶ added in v0.3.0
Reflector serves the reflection across multiple upstreams, by upstreaming the first request to each one and finding the one that doesn't respond a NotFound status and then piping the response back to the client.
func (Reflector) Middleware ¶ added in v0.3.0
func (r Reflector) Middleware(next grpc.StreamHandler) grpc.StreamHandler
Middleware returns a middleware that reflects the request to the upstreams.
type SRIClient ¶ added in v0.3.0
type SRIClient struct { Name string rapi1.ServerReflection_ServerReflectionInfoClient }
SRIClient is a shorthand for a server reflection stream client.