Documentation ¶
Index ¶
- func GetInterceptors(svc interface{}, config CommonConfig) grpc.UnaryServerInterceptor
- func GetInterceptorsWithMethodMiddlewares(svc interface{}, config CommonConfig, middlewares []string) grpc.UnaryServerInterceptor
- func GetMethodInterceptors(svc interface{}, config CommonConfig, middlewares []string) []grpc.UnaryServerInterceptor
- func GetStreamInterceptors(svc interface{}, config CommonConfig) grpc.StreamServerInterceptor
- type CommonConfig
- type Decodable
- type Decoder
- type Encodeable
- type Encoder
- type GRPCMethodHandler
- type HTTPHandler
- type HTTPInterceptor
- type Handler
- type Interceptor
- type MiddlewareMapping
- type Middlewareable
- type Optionable
- type StreamInterceptor
- type WhitelistedHeaders
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetInterceptors ¶
func GetInterceptors(svc interface{}, config CommonConfig) grpc.UnaryServerInterceptor
GetInterceptors fetches interceptors from a given GRPC service
func GetInterceptorsWithMethodMiddlewares ¶
func GetInterceptorsWithMethodMiddlewares(svc interface{}, config CommonConfig, middlewares []string) grpc.UnaryServerInterceptor
GetInterceptorsWithMethodMiddlewares fetchs all middleware including those provided by method middlewares
func GetMethodInterceptors ¶
func GetMethodInterceptors(svc interface{}, config CommonConfig, middlewares []string) []grpc.UnaryServerInterceptor
GetMethodInterceptors fetches all interceptors including method middlewares
func GetStreamInterceptors ¶
func GetStreamInterceptors(svc interface{}, config CommonConfig) grpc.StreamServerInterceptor
GetStreamInterceptors fetches stream interceptors from a given GRPC service
Types ¶
type CommonConfig ¶
type CommonConfig struct {
NoDefaultInterceptors bool
}
CommonConfig is the config that is common across both http and grpc handlers
type Decodable ¶
type Decodable interface { AddDecoder(serviceName, method string, decoder Decoder) AddDefaultDecoder(serviceName string, decoder Decoder) }
Decodable interface that is implemented by a handler that supports custom HTTP decoder
type Decoder ¶
type Decoder func(ctx context.Context, w http.ResponseWriter, encodeError, endpointError error, respObject interface{})
Decoder is the function type needed for response decoders
type Encodeable ¶
type Encodeable interface { AddEncoder(serviceName, method string, httpMethod []string, path string, encoder Encoder) AddDefaultEncoder(serviceName string, encoder Encoder) }
Encodeable interface that is implemented by a handler that supports custom HTTP encoder
type GRPCMethodHandler ¶
type GRPCMethodHandler func(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error)
GRPCMethodHandler is the method type as defined in grpc-go
type HTTPHandler ¶
type HTTPHandler func(http.ResponseWriter, *http.Request) bool
HTTPHandler is the function that handles HTTP request
type HTTPInterceptor ¶
type HTTPInterceptor interface {
AddHTTPHandler(serviceName, method string, path string, handler HTTPHandler)
}
HTTPInterceptor allows intercepting an HTTP connection
type Handler ¶
type Handler interface { Add(sd *grpc.ServiceDesc, ss interface{}) error Run(httpListener net.Listener) error Stop(timeout time.Duration) error }
Handler implements a service handler that is used by orion server
type Interceptor ¶
type Interceptor interface { // gets an array of Unary Server Interceptors GetInterceptors() []grpc.UnaryServerInterceptor }
Interceptor interface when implemented by a service allows that service to provide custom interceptors
type MiddlewareMapping ¶
type MiddlewareMapping struct {
// contains filtered or unexported fields
}
MiddlewareMapping stores mapping between service,method and middlewares
func NewMiddlewareMapping ¶
func NewMiddlewareMapping() *MiddlewareMapping
NewMiddlewareMapping returns a new MiddlewareMapping
func (*MiddlewareMapping) AddMiddleware ¶
func (m *MiddlewareMapping) AddMiddleware(service, method string, middlewares ...string)
AddMiddleware adds middleware to a service, method
func (*MiddlewareMapping) GetMiddlewares ¶
func (m *MiddlewareMapping) GetMiddlewares(service, method string) []string
GetMiddlewares fetches all middlewares for a specific service,method
func (*MiddlewareMapping) GetMiddlewaresFromURL ¶
func (m *MiddlewareMapping) GetMiddlewaresFromURL(url string) []string
GetMiddlewaresFromURL fetches all middleware for a specific URL
type Middlewareable ¶
Middlewareable implemets support for method specific middleware
type Optionable ¶
type Optionable interface {
AddOption(ServiceName, method, option string)
}
Optionable interface that is implemented by a handler that support custom Orion options
type StreamInterceptor ¶
type StreamInterceptor interface { // gets an array of Stream Server Interceptors GetStreamInterceptors() []grpc.StreamServerInterceptor }
StreamInterceptor interface when implemented by a service allows that service to provide custom stream interceptors
type WhitelistedHeaders ¶
type WhitelistedHeaders interface { //GetRequestHeaders returns a list of all whitelisted request headers GetRequestHeaders() []string //GetResponseHeaders returns a list of all whitelisted response headers GetResponseHeaders() []string }
WhitelistedHeaders is the interface that needs to be implemented by clients that need request/response headers to be passed in through the context