grpcsvc

package
v0.0.0-...-b7c645d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 23, 2022 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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),
	)
}

Functions

func Client

func Client(c config.Config) fx.Option

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 Middleware

func Middleware(c config.Config) fx.Option

func New

func New(
	lc fx.Lifecycle,
	params GrpcServerParams,
) (*grpc.Server, error)

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 Transport

func Transport(c config.Config) fx.Option

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 GrpcServerParams struct {
	fx.In

	Opts      []grpc.ServerOption
	Listnr    *grpcmux.Mux
	StManager status.Manager
}

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 MuxIn

type MuxIn struct {
	fx.In

	Listeners []grpcmux.MuxListener `group:"listener"`
	StManager status.Manager        `optional:"true"`
}

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"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL