Documentation ¶
Index ¶
- func CodeGenRequestFieldExtractor(fullMethod string, req interface{}) map[string]interface{}
- func DefaultCodeToLevel(code codes.Code) zapcore.Level
- func MakeDefaultMessageProducer(logger *zap.Logger) ...
- func MakeDefaultOptions(auth kitNetGrpc.AuthInterceptors, logger log.Logger, ...) ([]grpc.ServerOption, error)
- func NewAuth(validator kitNetGrpc.Validator, opts ...Option) kitNetGrpc.AuthInterceptors
- type AuthorizationConfig
- type Config
- type EnforcementPolicyConfig
- type GetDeviceIDPb
- type KeepAliveConfig
- type Option
- type Server
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CodeGenRequestFieldExtractor ¶ added in v2.2.4
CodeGenRequestFieldExtractor is a function that relies on code-generated functions that export log fields from requests. These are usually coming from a protoc-plugin that generates additional information based on custom field options.
func DefaultCodeToLevel ¶ added in v2.2.4
DefaultCodeToLevel is the default implementation of gRPC return codes and interceptor log level for server side.
func MakeDefaultMessageProducer ¶ added in v2.2.4
func MakeDefaultOptions ¶
func MakeDefaultOptions(auth kitNetGrpc.AuthInterceptors, logger log.Logger, tracerProvider trace.TracerProvider) ([]grpc.ServerOption, error)
func NewAuth ¶
func NewAuth(validator kitNetGrpc.Validator, opts ...Option) kitNetGrpc.AuthInterceptors
Types ¶
type AuthorizationConfig ¶
type AuthorizationConfig struct { OwnerClaim string `yaml:"ownerClaim" json:"ownerClaim"` validator.Config `yaml:",inline" json:",inline"` }
func (*AuthorizationConfig) Validate ¶
func (c *AuthorizationConfig) Validate() error
type Config ¶
type Config struct { Addr string `yaml:"address" json:"address"` EnforcementPolicy EnforcementPolicyConfig `yaml:"enforcementPolicy" json:"enforcementPolicy"` KeepAlive KeepAliveConfig `yaml:"keepAlive" json:"keepAlive"` TLS server.Config `yaml:"tls" json:"tls"` Authorization AuthorizationConfig `yaml:"authorization" json:"authorization"` }
type EnforcementPolicyConfig ¶
type EnforcementPolicyConfig struct { // MinTime is the minimum amount of time a client should wait before sending // a keepalive ping. MinTime time.Duration `yaml:"minTime" json:"minTime"` // The current default value is 5 minutes. // If true, server allows keepalive pings even when there are no active // streams(RPCs). If false, and client sends ping when there are no active // streams, server will send GOAWAY and close the connection. PermitWithoutStream bool `yaml:"permitWithoutStream" json:"permitWithoutStream"` // false by default. }
EnforcementPolicyConfig is used to set keepalive enforcement policy on the server-side. Server will close connection with a client that violates this policy.
func (EnforcementPolicyConfig) ToGrpc ¶
func (c EnforcementPolicyConfig) ToGrpc() keepalive.EnforcementPolicy
type GetDeviceIDPb ¶ added in v2.2.4
type GetDeviceIDPb interface {
GetDeviceId() string
}
type KeepAliveConfig ¶
type KeepAliveConfig struct { // MaxConnectionIdle is a duration for the amount of time after which an // idle connection would be closed by sending a GoAway. Idleness duration is // defined since the most recent time the number of outstanding RPCs became // zero or the connection establishment. MaxConnectionIdle time.Duration `yaml:"maxConnectionIdle" json:"maxConnectionIdle"` // The current default value is infinity. // MaxConnectionAge is a duration for the maximum amount of time a // connection may exist before it will be closed by sending a GoAway. A // random jitter of +/-10% will be added to MaxConnectionAge to spread out // connection storms. MaxConnectionAge time.Duration `yaml:"maxConnectionAge" json:"maxConnectionAge"` // The current default value is infinity. // MaxConnectionAgeGrace is an additive period after MaxConnectionAge after // which the connection will be forcibly closed. MaxConnectionAgeGrace time.Duration `yaml:"maxConnectionAgeGrace" json:"maxConnectionAgeGrace"` // The current default value is infinity. // After a duration of this time if the server doesn't see any activity it // pings the client to see if the transport is still alive. // If set below 1s, a minimum value of 1s will be used instead. Time time.Duration `yaml:"time" json:"time"` // The current default value is 2 hours. // After having pinged for keepalive check, the server waits for a duration // of Timeout and if no activity is seen even after that the connection is // closed. Timeout time.Duration `yaml:"timeout" json:"timeout"` // The current default value is 20 seconds. }
func (KeepAliveConfig) ToGrpc ¶
func (c KeepAliveConfig) ToGrpc() keepalive.ServerParameters
type Option ¶
type Option func(*cfg)
func WithDisabledTokenForwarding ¶
func WithDisabledTokenForwarding() Option
func WithWhiteListedMethods ¶
type Server ¶
Server handles gRPC requests to the service.
func NewServer ¶
func NewServer(addr string, opts ...grpc.ServerOption) (*Server, error)
NewServer instantiates a gRPC server. When passing addr with an unspecified port or ":", use Addr().
func (*Server) AddCloseFunc ¶
func (s *Server) AddCloseFunc(f func())
AddCloseFunc adds a function to be called by the Close method. This eliminates the need for wrapping the Server.