Documentation
ΒΆ
Index ΒΆ
- func AddCheck(f func(context.Context, *cobra.Command, string, string) bool)
- func LoadPlugins(folder, pattern string, logger logging.Logger)
- func LoadPluginsWithContext(ctx context.Context, 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 NewTestPluginCmd() cmd.Command
- func NewTestPluginCmdWithArgs(flags ...cmd.FlagBuilder) cmd.Command
- func RegisterEncoders()
- func RegisterSubscriberFactories(_ context.Context, _ config.ServiceConfig, _ 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 PluginLoaderWithContext
- 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 LoadPluginsWithContext ΒΆ
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
NewBackendFactoryWithContext 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 NewTestPluginCmd ΒΆ
func NewTestPluginCmdWithArgs ΒΆ
func NewTestPluginCmdWithArgs(flags ...cmd.FlagBuilder) cmd.Command
func RegisterEncoders ΒΆ
func RegisterEncoders()
RegisterEncoders registers all the available encoders
func RegisterSubscriberFactories ΒΆ
func RegisterSubscriberFactories(_ context.Context, _ config.ServiceConfig, _ 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 (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 (*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 {
PluginLoaderWithContext PluginLoaderWithContext
LoggerFactory LoggerFactory
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 {
// contains filtered or unexported fields
}
MetricsAndTraces is the default implementation of the MetricsAndTracesRegister interface.
func (*MetricsAndTraces) Close ΒΆ
func (m *MetricsAndTraces) Close()
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 Deprecated: Use PluginLoaderWithContext
type PluginLoaderWithContext ΒΆ
type PluginLoaderWithContext interface {
LoadWithContext(ctx context.Context, folder, pattern string, logger logging.Logger)
}
PluginLoaderWithContext 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
|
|
|
krakend-ce
command
|
|
|
krakend-integration
command
|
|
|
pkg
|
|
|
headers
module
|
|
|
paths
module
|
|
|
pluginlogger
module
|
|
|
session
module
|
|
|
Package tests implements utility functions to help with API Gateway testing.
|
Package tests implements utility functions to help with API Gateway testing. |