Documentation ¶
Index ¶
- func LoadPlugins(folder, pattern string, logger logging.Logger)
- func NewBackendFactory(logger logging.Logger, metricCollector *metrics.Metrics) proxy.BackendFactory
- func NewBackendFactoryWithContext(ctx context.Context, logger logging.Logger, metricCollector *metrics.Metrics) proxy.BackendFactory
- func NewEngine(cfg config.ServiceConfig, opt luragin.EngineOptions) *gin.Engine
- func NewExecutor(ctx context.Context) cmd.Executor
- func NewHandlerFactory(logger logging.Logger, metricCollector *metrics.Metrics, ...) router.HandlerFactory
- func NewProxyFactory(logger logging.Logger, backendFactory proxy.BackendFactory, ...) proxy.Factory
- func RegisterEncoders()
- func RegisterSubscriberFactories(ctx context.Context, cfg config.ServiceConfig, logger logging.Logger) func(n string, p int)
- type AgentStarter
- type BackendFactory
- type BloomFilterJWT
- type DefaultRunServerFactory
- type EngineFactory
- type ExecutorBuilder
- type HandlerFactory
- type LoggerBuilder
- type LoggerFactory
- type MetricsAndTraces
- type MetricsAndTracesRegister
- type PluginLoader
- type ProxyFactory
- type RunServer
- type RunServerFactory
- type SubscriberFactoriesRegister
- type TokenRejecterFactory
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LoadPlugins ¶
LoadPlugins loads and registers the plugins so they can be used if enabled at the configuration
func NewBackendFactory ¶
func NewBackendFactory(logger logging.Logger, metricCollector *metrics.Metrics) proxy.BackendFactory
NewBackendFactory creates a BackendFactory by stacking all the available middlewares: - oauth2 client credentials - http cache - martian - pubsub - amqp - cel - lua - rate-limit - circuit breaker - metrics collector - opencensus collector
func NewBackendFactoryWithContext ¶
func NewBackendFactoryWithContext(ctx context.Context, logger logging.Logger, metricCollector *metrics.Metrics) proxy.BackendFactory
NewBackendFactory creates a BackendFactory by stacking all the available middlewares and injecting the received context
func NewEngine ¶
func NewEngine(cfg config.ServiceConfig, opt luragin.EngineOptions) *gin.Engine
NewEngine creates a new gin engine with some default values and a secure middleware
func NewExecutor ¶
NewExecutor returns an executor for the cmd package. The executor initalizes the entire gateway by registering the components and composing a RouterFactory wrapping all the middlewares.
func NewHandlerFactory ¶
func NewHandlerFactory(logger logging.Logger, metricCollector *metrics.Metrics, rejecter jose.RejecterFactory) router.HandlerFactory
NewHandlerFactory returns a HandlerFactory with a rate-limit and a metrics collector middleware injected
func NewProxyFactory ¶
func NewProxyFactory(logger logging.Logger, backendFactory proxy.BackendFactory, metricCollector *metrics.Metrics) proxy.Factory
NewProxyFactory returns a new ProxyFactory wrapping the injected BackendFactory with the default proxy stack and a metrics collector
func RegisterEncoders ¶
func RegisterEncoders()
RegisterEncoders registers all the available encoders
func RegisterSubscriberFactories ¶
func RegisterSubscriberFactories(ctx context.Context, cfg config.ServiceConfig, logger logging.Logger) func(n string, p int)
RegisterSubscriberFactories registers all the available sd adaptors
Types ¶
type AgentStarter ¶
type AgentStarter interface { Start( context.Context, []*config.AsyncAgent, logging.Logger, chan<- string, proxy.Factory, ) func() error }
AgentStarter defines a type that starts a set of agents
type BackendFactory ¶
type BackendFactory interface {
NewBackendFactory(context.Context, logging.Logger, *metrics.Metrics) proxy.BackendFactory
}
BackendFactory returns a KrakenD backend factory, ready to be passed to the KrakenD proxy factory
type BloomFilterJWT ¶
type BloomFilterJWT struct{}
BloomFilterJWT is the default TokenRejecterFactory implementation.
func (BloomFilterJWT) NewTokenRejecter ¶
func (t BloomFilterJWT) NewTokenRejecter(ctx context.Context, cfg config.ServiceConfig, l logging.Logger, reg func(n string, p int)) (jose.ChainedRejecterFactory, error)
NewTokenRejecter registers the bloomfilter component and links it to a token rejecter. Then it returns a chained rejecter factory with the created token rejecter and other based on the CEL component.
type DefaultRunServerFactory ¶
type DefaultRunServerFactory struct{}
DefaultRunServerFactory creates the default RunServer by wrapping the injected RunServer with the plugin loader and the CORS module
func (*DefaultRunServerFactory) NewRunServer ¶
func (d *DefaultRunServerFactory) NewRunServer(l logging.Logger, next router.RunServerFunc) RunServer
type EngineFactory ¶
type EngineFactory interface {
NewEngine(config.ServiceConfig, router.EngineOptions) *gin.Engine
}
EngineFactory returns a gin engine, ready to be passed to the KrakenD RouterFactory
type ExecutorBuilder ¶
type ExecutorBuilder struct { LoggerFactory LoggerFactory PluginLoader PluginLoader SubscriberFactoriesRegister SubscriberFactoriesRegister TokenRejecterFactory TokenRejecterFactory MetricsAndTracesRegister MetricsAndTracesRegister EngineFactory EngineFactory ProxyFactory ProxyFactory BackendFactory BackendFactory HandlerFactory HandlerFactory RunServerFactory RunServerFactory AgentStarterFactory AgentStarter Middlewares []gin.HandlerFunc }
ExecutorBuilder is a composable builder. Every injected property is used by the NewCmdExecutor method.
func (*ExecutorBuilder) NewCmdExecutor ¶
func (e *ExecutorBuilder) NewCmdExecutor(ctx context.Context) cmd.Executor
NewCmdExecutor returns an executor for the cmd package. The executor initializes the entire gateway by delegating most of the tasks to the injected collaborators. They register the components and compose a RouterFactory wrapping all the middlewares. Every nil collaborator is replaced by the default one offered by this package.
type HandlerFactory ¶
type HandlerFactory interface {
NewHandlerFactory(logging.Logger, *metrics.Metrics, jose.RejecterFactory) router.HandlerFactory
}
HandlerFactory returns a KrakenD router handler factory, ready to be passed to the KrakenD RouterFactory
type LoggerBuilder ¶
type LoggerBuilder struct{}
LoggerBuilder is the default BuilderFactory implementation.
func (LoggerBuilder) NewLogger ¶
func (LoggerBuilder) NewLogger(cfg config.ServiceConfig) (logging.Logger, io.Writer, error)
NewLogger sets up the logging components as defined at the configuration.
type LoggerFactory ¶
LoggerFactory returns a KrakenD Logger factory, ready to be passed to the KrakenD RouterFactory
type MetricsAndTraces ¶
type MetricsAndTraces struct{}
MetricsAndTraces is the default implementation of the MetricsAndTracesRegister interface.
type MetricsAndTracesRegister ¶
type MetricsAndTracesRegister interface {
Register(context.Context, config.ServiceConfig, logging.Logger) *metrics.Metrics
}
MetricsAndTracesRegister registers the defined observability components and returns a metrics collector, if required.
type PluginLoader ¶
PluginLoader defines the interface for the collaborator responsible of starting the plugin loaders
type ProxyFactory ¶
type ProxyFactory interface {
NewProxyFactory(logging.Logger, proxy.BackendFactory, *metrics.Metrics) proxy.Factory
}
ProxyFactory returns a KrakenD proxy factory, ready to be passed to the KrakenD RouterFactory
type RunServer ¶
RunServer defines the interface of a function used by the KrakenD router to start the service
type RunServerFactory ¶
type RunServerFactory interface {
NewRunServer(logging.Logger, router.RunServerFunc) RunServer
}
RunServerFactory returns a RunServer with several wraps around the injected one
type SubscriberFactoriesRegister ¶
type SubscriberFactoriesRegister interface {
Register(context.Context, config.ServiceConfig, logging.Logger) func(string, int)
}
SubscriberFactoriesRegister registers all the required subscriber factories from the available service discover components and adapters and returns a service register function. The service register function will register the service by the given name and port to all the available service discover clients
type TokenRejecterFactory ¶
type TokenRejecterFactory interface {
NewTokenRejecter(context.Context, config.ServiceConfig, logging.Logger, func(string, int)) (jose.ChainedRejecterFactory, error)
}
TokenRejecterFactory returns a jose.ChainedRejecterFactory containing all the required jose.RejecterFactory. It also should setup and manage any service related to the management of the revocation process, if required.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
cmd
|
|
Package tests implements utility functions to help with API Gateway testing.
|
Package tests implements utility functions to help with API Gateway testing. |