grpc

package
v1.122.9 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2023 License: Unlicense Imports: 23 Imported by: 12

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewClient

func NewClient(ctx context.Context, host string, opts ...ClientOption) (*grpc.ClientConn, error)

NewClient to host for gRPC.

func NewDialOptions added in v1.105.0

func NewDialOptions(opts ...ClientOption) ([]grpc.DialOption, error)

NewDialOptions for gRPC.

func StreamServerInterceptor

func StreamServerInterceptor() []grpc.StreamServerInterceptor

StreamServerInterceptor for gRPC.

func UnaryServerInterceptor

func UnaryServerInterceptor() []grpc.UnaryServerInterceptor

UnaryServerInterceptor for gRPC.

Types

type ClientOption added in v1.50.0

type ClientOption interface {
	// contains filtered or unexported methods
}

ClientOption for HTTP.

func WithClientBreaker added in v1.50.0

func WithClientBreaker() ClientOption

WithClientBreaker for gRPC.

func WithClientDialOption added in v1.50.0

func WithClientDialOption(opts ...grpc.DialOption) ClientOption

WithClientDialOption for gRPC.

func WithClientLogger added in v1.52.0

func WithClientLogger(logger *zap.Logger) ClientOption

WithClientLogger for gRPC.

func WithClientMetrics added in v1.65.0

func WithClientMetrics(meter metric.Meter) ClientOption

WithClientMetrics for gRPC.

func WithClientRetry added in v1.50.0

func WithClientRetry(cfg *retry.Config) ClientOption

WithClientRetry for gRPC.

func WithClientSecure added in v1.50.0

func WithClientSecure(sec security.Config) (ClientOption, error)

WithClientSecure for gRPC.

func WithClientStreamInterceptors added in v1.50.0

func WithClientStreamInterceptors(stream ...grpc.StreamClientInterceptor) ClientOption

WithClientUnaryInterceptors for gRPC.

func WithClientTracer added in v1.52.0

func WithClientTracer(tracer gtracer.Tracer) ClientOption

WithClientTracer for gRPC.

func WithClientUnaryInterceptors added in v1.50.0

func WithClientUnaryInterceptors(unary ...grpc.UnaryClientInterceptor) ClientOption

WithClientUnaryInterceptors for gRPC.

func WithClientUserAgent added in v1.121.0

func WithClientUserAgent(userAgent string) ClientOption

WithUserAgent for gRPC.

type Config

type Config struct {
	Enabled   bool            `yaml:"enabled" json:"enabled" toml:"enabled"`
	Security  security.Config `yaml:"security" json:"security" toml:"security"`
	Port      string          `yaml:"port" json:"port" toml:"port"`
	Retry     retry.Config    `yaml:"retry" json:"retry" toml:"retry"`
	UserAgent string          `yaml:"user_agent" json:"user_agent" toml:"user_agent"`
}

Config for gRPC.

type Server added in v1.70.0

type Server struct {
	Server *grpc.Server
	// contains filtered or unexported fields
}

Server for gRPC.

func NewServer

func NewServer(params ServerParams) (*Server, error)

NewServer for gRPC.

func (*Server) Start added in v1.70.0

func (s *Server) Start(listener net.Listener)

Start the server.

func (*Server) Stop added in v1.70.0

func (s *Server) Stop(_ context.Context)

Stop the server.

type ServerParams

type ServerParams struct {
	fx.In

	Shutdowner fx.Shutdowner
	Config     *Config
	Logger     *zap.Logger
	Tracer     tracer.Tracer
	Meter      metric.Meter
	Unary      []grpc.UnaryServerInterceptor
	Stream     []grpc.StreamServerInterceptor
}

ServerParams for gRPC.

Directories

Path Synopsis
security
telemetry

Jump to

Keyboard shortcuts

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