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 WithFieldExtractor(fieldExtractor grpc_ctxtags.RequestFieldExtractorFunc) Option
- func WithServerOptions(serverOptions ...grpc.ServerOption) Option
- func WithStreamInterceptors(interceptors ...grpc.StreamServerInterceptor) Option
- func WithUnaryInterceptors(interceptors ...grpc.UnaryServerInterceptor) Option
- type Registerer
- type Server
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 WithFieldExtractor ¶
func WithFieldExtractor(fieldExtractor grpc_ctxtags.RequestFieldExtractorFunc) Option
WithFieldExtractor sets a field extractor
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 WithUnaryInterceptors ¶
func WithUnaryInterceptors(interceptors ...grpc.UnaryServerInterceptor) Option
WithUnaryInterceptors adds gRPC unary interceptors
type Registerer ¶
type Registerer interface { Roles() []ttnpb.ClusterRole RegisterServices(s *grpc.Server) RegisterHandlers(s *runtime.ServeMux, conn *grpc.ClientConn) }
Registerer allows components to register their services to the gRPC server and the HTTP gateway
type Server ¶
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