Documentation ¶
Index ¶
- Variables
- func Client(c config.Config) fx.Option
- func JaegerTracerOptions(tracer opentracing.Tracer) grpc.UnaryServerInterceptor
- func Metrics() *grpc_prometheus.ServerMetrics
- func MetricsRegister(reg *prometheus.Registry, s *grpc.Server, ...)
- func Middleware(c config.Config) fx.Option
- func New(lc fx.Lifecycle, params GrpcServerParams) (*grpc.Server, error)
- func NewMuxedListener(ctx context.Context, lc fx.Lifecycle, in MuxIn, tm *taskmanager.TaskManager) (*grpcmux.Mux, error)
- func OptsAggregator(params ServerOptsParams) (outOpts []grpc.ServerOption)
- func Recovery() (grpc.UnaryServerInterceptor, grpc.StreamServerInterceptor)
- func Transport(c config.Config) fx.Option
- func Validator() (grpc.UnaryServerInterceptor, grpc.StreamServerInterceptor)
- type AuthInterceptor
- type GrpcServerParams
- type JwtAuthOpts
- type MuxIn
- type MuxListenerOut
- type PrometheusOpts
- type ServerOptsParams
Constants ¶
This section is empty.
Variables ¶
View Source
var JwtAuth = fx.Options( fx.Provide(JwtAuthOptions), )
View Source
var Module = func(c config.Config) fx.Option { return fx.Options( Transport(c), Middleware(c), Client(c), fx.Provide(OptsAggregator), fx.Provide(New), ) }
View Source
var Prometheus = fx.Options( fx.Provide(Metrics), fx.Provide(MetricsOpts), fx.Invoke(MetricsRegister), )
Functions ¶
func JaegerTracerOptions ¶
func JaegerTracerOptions(tracer opentracing.Tracer) grpc.UnaryServerInterceptor
func Metrics ¶
func Metrics() *grpc_prometheus.ServerMetrics
func MetricsRegister ¶
func MetricsRegister(reg *prometheus.Registry, s *grpc.Server, metrics *grpc_prometheus.ServerMetrics)
func NewMuxedListener ¶
func NewMuxedListener( ctx context.Context, lc fx.Lifecycle, in MuxIn, tm *taskmanager.TaskManager, ) (*grpcmux.Mux, error)
func OptsAggregator ¶
func OptsAggregator(params ServerOptsParams) (outOpts []grpc.ServerOption)
func Recovery ¶
func Recovery() (grpc.UnaryServerInterceptor, grpc.StreamServerInterceptor)
func Validator ¶
func Validator() (grpc.UnaryServerInterceptor, grpc.StreamServerInterceptor)
Types ¶
type AuthInterceptor ¶
type AuthInterceptor struct {
// contains filtered or unexported fields
}
AuthInterceptor is a server interceptor for authentication and authorization
func NewAuthInterceptor ¶
func NewAuthInterceptor(jm auth.JWTManager, am auth.ACL) *AuthInterceptor
NewAuthInterceptor returns a new auth interceptor
func (*AuthInterceptor) Stream ¶
func (interceptor *AuthInterceptor) Stream() grpc.StreamServerInterceptor
Stream returns a server interceptor function to authenticate and authorize stream RPC
func (*AuthInterceptor) Unary ¶
func (interceptor *AuthInterceptor) Unary() grpc.UnaryServerInterceptor
Unary returns a server interceptor function to authenticate and authorize unary RPC
type GrpcServerParams ¶
type JwtAuthOpts ¶
type JwtAuthOpts struct { fx.Out UOut grpc.UnaryServerInterceptor `group:"unary_opts"` SOut grpc.StreamServerInterceptor `group:"stream_opts"` }
func JwtAuthOptions ¶
func JwtAuthOptions( jm auth.JWTManager, am auth.ACL, ) (params JwtAuthOpts, err error)
type MuxListenerOut ¶
type MuxListenerOut struct { fx.Out Listener grpcmux.MuxListener `group:"listener"` }
func NewP2PListener ¶
func NewP2PListener( h host.Host, ) (MuxListenerOut, error)
func NewTCPListener ¶
func NewTCPListener(conf config.Config) (MuxListenerOut, error)
func NewUDSListener ¶
func NewUDSListener(conf config.Config) (MuxListenerOut, error)
type PrometheusOpts ¶
type PrometheusOpts struct { fx.Out UOut grpc.UnaryServerInterceptor `group:"unary_opts"` SOut grpc.StreamServerInterceptor `group:"stream_opts"` }
func MetricsOpts ¶
func MetricsOpts(c config.Config, grpcMetrics *grpc_prometheus.ServerMetrics) (params PrometheusOpts, err error)
type ServerOptsParams ¶
type ServerOptsParams struct { fx.In UnaryOpts []grpc.UnaryServerInterceptor `group:"unary_opts"` StreamOpts []grpc.StreamServerInterceptor `group:"stream_opts"` }
Click to show internal directories.
Click to hide internal directories.