Documentation ¶
Overview ¶
Package rpcserver initializes The Things Network's base gRPC server
Index ¶
- Variables
- func StartLoopback(ctx context.Context, s *grpc.Server, opts ...grpc.DialOption) (*grpc.ClientConn, error)
- type Option
- func WithContextFiller(contextFillers ...fillcontext.Filler) Option
- func WithCorrelationIDsIgnoreMethods(methods []string) Option
- func WithLogIgnoreMethods(methods []string) Option
- func WithRateLimiter(limiter ratelimit.Interface) Option
- func WithServerOptions(serverOptions ...grpc.ServerOption) Option
- func WithStreamInterceptors(interceptors ...grpc.StreamServerInterceptor) Option
- func WithTrustedProxies(cidrs ...string) Option
- func WithUnaryInterceptors(interceptors ...grpc.UnaryServerInterceptor) Option
- type Registerer
- type Server
- type ServiceRegisterer
Constants ¶
This section is empty.
Variables ¶
var ErrRPCRecovered = errors.DefineInternal("rpc_recovered", "Internal Server Error")
ErrRPCRecovered is returned when a panic is caught from an RPC.
Functions ¶
func StartLoopback ¶
func StartLoopback(ctx context.Context, s *grpc.Server, opts ...grpc.DialOption) (*grpc.ClientConn, error)
StartLoopback starts the server on a local address and returns a connection to that address. This function does not add the default DialOptions.
Types ¶
type Option ¶
type Option func(*options)
Option for the gRPC server
func WithContextFiller ¶
func WithContextFiller(contextFillers ...fillcontext.Filler) Option
WithContextFiller sets a context filler
func WithCorrelationIDsIgnoreMethods ¶ added in v3.28.0
WithCorrelationIDsIgnoreMethods sets a list of methods for which no correlation IDs are injected.
func WithLogIgnoreMethods ¶ added in v3.9.0
WithLogIgnoreMethods sets a list of methods for which no log messages are printed on success.
func WithRateLimiter ¶ added in v3.12.0
WithRateLimiter configures a rate limiter on the server.
func WithServerOptions ¶
func WithServerOptions(serverOptions ...grpc.ServerOption) Option
WithServerOptions adds gRPC ServerOptions
func WithStreamInterceptors ¶
func WithStreamInterceptors(interceptors ...grpc.StreamServerInterceptor) Option
WithStreamInterceptors adds gRPC stream interceptors
func WithTrustedProxies ¶ added in v3.10.2
WithTrustedProxies adds trusted proxies from which proxy headers are trusted.
func WithUnaryInterceptors ¶
func WithUnaryInterceptors(interceptors ...grpc.UnaryServerInterceptor) Option
WithUnaryInterceptors adds gRPC unary interceptors
type Registerer ¶
type Registerer interface { Roles() []ttnpb.ClusterRole ServiceRegisterer }
Registerer extends ServiceRegisterer with the cluster roles fulfilled by the component.
type Server ¶
type Server struct { *grpc.Server *hooks.Hooks *runtime.ServeMux // contains filtered or unexported fields }
Server wraps the gRPC server
func New ¶
New returns a new RPC server with a set of middlewares. The given context is used in some of the middlewares, the given server options are passed to gRPC
Currently the following middlewares are included: tag extraction, metrics, logging, sending errors to Sentry, validation, errors, panic recovery
type ServiceRegisterer ¶ added in v3.17.2
type ServiceRegisterer interface { RegisterServices(s *grpc.Server) RegisterHandlers(s *runtime.ServeMux, conn *grpc.ClientConn) }
ServiceRegisterer allows components to register their services to the gRPC server and the HTTP gateway.