Documentation
¶
Index ¶
- type Config
- type Option
- func WithAuthUnaryMiddleware(fn func(ctx context.Context) (context.Context, error)) Option
- func WithChannelz() Option
- func WithConnTimeout(t time.Duration) Option
- func WithCreds(creds credentials.TransportCredentials) Option
- func WithDefaultMiddlewares() Option
- func WithDefaultPlugins() Option
- func WithHealthz() Option
- func WithMaxConcurrentStreams(num uint32) Option
- func WithPlugins(svrs ...driver.Plugin) Option
- func WithReflection() Option
- func WithStatsHandler(h stats.Handler) Option
- func WithStreamInterceptors(interceptors ...grpc.StreamServerInterceptor) Option
- func WithStreamLoggingMiddleware() Option
- func WithStreamRateLimitMiddleware(waitDur time.Duration) Option
- func WithStreamRecoveryMiddleware() Option
- func WithStreamTraceMiddleware() Option
- func WithUnaryInterceptors(interceptors ...grpc.UnaryServerInterceptor) Option
- func WithUnaryLoggingMiddleware() Option
- func WithUnaryRateLimitMiddleware(waitDur time.Duration) Option
- func WithUnaryRecoveryMiddleware() Option
- func WithUnaryTraceMiddleware() Option
- func WithUnaryUUIDMiddleware() Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { Network string `json:"network" validate:"required"` Address string `json:"address" validate:"required"` Plugins []driver.Plugin UnaryInterceptors []grpc.UnaryServerInterceptor StreamInterceptors []grpc.StreamServerInterceptor Option []grpc.ServerOption }
Config contains configurations of gRPC and Gateway server. A new instance of Config is created from your config.yaml|config.json file in your current working directory Network, Address, and Paths can be set in your config file to set the Config instance. Otherwise, defaults are set.
func New ¶
New creates a config from your config file. If no config file is present, the resulting Config will have the following defaults: netowork: "tcp" address: ":3000" use the With method to continue to modify the resulting Config object
func (*Config) CreateListener ¶
CreateListener creates a network listener from the network and address config
func (*Config) ServerOptions ¶
func (c *Config) ServerOptions() []grpc.ServerOption
type Option ¶
type Option func(*Config)
Option configures a gRPC and a gateway server.
func WithAuthUnaryMiddleware ¶
func WithChannelz ¶
func WithChannelz() Option
WithChannelz adds grpc server channelz to the list of plugins ref: https://godoc.org/google.golang.org/grpc/channelz/grpc_channelz_v1
func WithConnTimeout ¶
WithStatsHandler ConnectionTimeout returns a ServerOption that sets the timeout for connection establishment (up to and including HTTP/2 handshaking) for all new connections. If this is not set, the default is 120 seconds.
func WithCreds ¶
func WithCreds(creds credentials.TransportCredentials) Option
WithCreds returns a ServerOption that sets credentials for server connections.
func WithDefaultMiddlewares ¶
func WithDefaultMiddlewares() Option
func WithDefaultPlugins ¶
func WithDefaultPlugins() Option
func WithHealthz ¶
func WithHealthz() Option
WithHealthz exposes server's health and it must be imported to enable support for client-side health checks and adds it to plugins. ref: https://godoc.org/google.golang.org/grpc/health
func WithMaxConcurrentStreams ¶
WithMaxConcurrentStreams returns a ServerOption that will apply a limit on the number of concurrent streams to each ServerTransport.
func WithPlugins ¶
WithGoPlugins returns an Option that adds hard-coded Plugins(golang) to the engine runtime as opposed to go/plugins. See driver.Plugin for the interface definition.
func WithReflection ¶
func WithReflection() Option
WithReflection adds grpc server reflection to the list of plugins ref: https://godoc.org/google.golang.org/grpc/reflection
func WithStatsHandler ¶
WithStatsHandler returns a ServerOption that sets the stats handler for the server.
func WithStreamInterceptors ¶
func WithStreamInterceptors(interceptors ...grpc.StreamServerInterceptor) Option
WithGrpcServerStreamInterceptors returns an Option that sets stream interceptor(s) for a gRPC server.
func WithStreamLoggingMiddleware ¶
func WithStreamLoggingMiddleware() Option
func WithStreamRecoveryMiddleware ¶
func WithStreamRecoveryMiddleware() Option
func WithStreamTraceMiddleware ¶
func WithStreamTraceMiddleware() Option
func WithUnaryInterceptors ¶
func WithUnaryInterceptors(interceptors ...grpc.UnaryServerInterceptor) Option
WithUnaryInterceptors returns an Option that sets unary interceptor(s) for a gRPC server.
func WithUnaryLoggingMiddleware ¶
func WithUnaryLoggingMiddleware() Option
func WithUnaryRecoveryMiddleware ¶
func WithUnaryRecoveryMiddleware() Option
func WithUnaryTraceMiddleware ¶
func WithUnaryTraceMiddleware() Option
func WithUnaryUUIDMiddleware ¶
func WithUnaryUUIDMiddleware() Option