mirror of
https://github.com/aljazceru/ark.git
synced 2025-12-17 20:24:21 +01:00
* api-spec: move the api-spec to root and init go.mod * go mod tidy * move buf files in the root as well * gh action for api-spec changes only * gh action for api-spec on push and pr * introduce go.work and remove all replaces * solve dependencies and force btcd/btcec@v2.3.3 * go work sync * force btcd/btcec@v2.3.3 * go mod tidy
24 lines
654 B
Go
24 lines
654 B
Go
package interceptors
|
|
|
|
import (
|
|
"github.com/ark-network/ark/server/pkg/macaroons"
|
|
middleware "github.com/grpc-ecosystem/go-grpc-middleware"
|
|
"google.golang.org/grpc"
|
|
)
|
|
|
|
// UnaryInterceptor returns the unary interceptor
|
|
func UnaryInterceptor(svc *macaroons.Service) grpc.ServerOption {
|
|
return grpc.UnaryInterceptor(middleware.ChainUnaryServer(
|
|
unaryLogger,
|
|
unaryMacaroonAuthHandler(svc),
|
|
))
|
|
}
|
|
|
|
// StreamInterceptor returns the stream interceptor with a logrus log
|
|
func StreamInterceptor(svc *macaroons.Service) grpc.ServerOption {
|
|
return grpc.StreamInterceptor(middleware.ChainStreamServer(
|
|
streamLogger,
|
|
streamMacaroonAuthHandler(svc),
|
|
))
|
|
}
|