Documentation ¶
Overview ¶
Package interceptor defines gRPC interceptors for Trillian.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Combine ¶
func Combine(interceptors ...grpc.UnaryServerInterceptor) grpc.UnaryServerInterceptor
Combine combines multiple unary interceptors. Interceptors are executed in the supplied order. If an interceptor fails (non-nil error), processing will stop and the error will be returned. If all interceptors succeed the handler will be called. Contexts are propagated between calls: the context of the first interceptor, as passed in to the handler function, is used for the second interceptor call and so on, until the handler is invoked. This ensures that request-level variables, transmitted via contexts, behave properly. Note that, as a limitation of the chaining logic, handler output cannot be modified by any of the interceptors supplied.
func WrapErrors ¶
func WrapErrors(i grpc.UnaryServerInterceptor) grpc.UnaryServerInterceptor
WrapErrors wraps the errors returned by the supplied interceptor using errors.WrapError. If used in conjunction with Combine, it should be the last call in the chain, ie: WrapErrors(Combine(i1, i2, ..., in)).
Types ¶
type TrillianInterceptor ¶
type TrillianInterceptor struct { Admin storage.AdminStorage QuotaManager quota.Manager }
TrillianInterceptor checks that: * Requests addressing a tree have the correct tree type and tree state; * TODO(codingllama): Requests are properly authenticated / authorized ; and * Requests are rate limited appropriately.
func (*TrillianInterceptor) UnaryInterceptor ¶
func (i *TrillianInterceptor) UnaryInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error)
UnaryInterceptor executes the TrillianInterceptor logic for unary RPCs.