-
Notifications
You must be signed in to change notification settings - Fork 475
/
alias.go
48 lines (37 loc) · 1.22 KB
/
alias.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package middleware
import (
"github.com/sirupsen/logrus"
"github.com/spiffe/spire/pkg/common/api/middleware"
"github.com/spiffe/spire/pkg/common/telemetry"
"google.golang.org/grpc"
)
type Middleware = middleware.Middleware
type PreprocessFunc = middleware.PreprocessFunc
type PostprocessFunc = middleware.PostprocessFunc
func Preprocess(fn PreprocessFunc) Middleware {
return middleware.Preprocess(fn)
}
func Postprocess(fn PostprocessFunc) Middleware {
return middleware.Postprocess(fn)
}
func Funcs(preprocess PreprocessFunc, postprocess PostprocessFunc) Middleware {
return middleware.Funcs(preprocess, postprocess)
}
func Chain(ms ...Middleware) Middleware {
return middleware.Chain(ms...)
}
func WithLogger(log logrus.FieldLogger) Middleware {
return middleware.WithLogger(log)
}
func WithMetrics(metrics telemetry.Metrics) Middleware {
return middleware.WithMetrics(metrics)
}
func Interceptors(m Middleware) (grpc.UnaryServerInterceptor, grpc.StreamServerInterceptor) {
return middleware.Interceptors(m)
}
func UnaryInterceptor(m Middleware) grpc.UnaryServerInterceptor {
return middleware.UnaryInterceptor(m)
}
func StreamInterceptor(m Middleware) grpc.StreamServerInterceptor {
return middleware.StreamInterceptor(m)
}