Documentation
¶
Overview ¶
Package configmiddleware implements a configuration struct to name middleware extensions.
Index ¶
- type Config
- func (m Config) GetGRPCClientOptions(ctx context.Context, extensions map[component.ID]component.Component) ([]grpc.DialOption, error)
- func (m Config) GetGRPCServerOptions(ctx context.Context, extensions map[component.ID]component.Component) ([]grpc.ServerOption, error)
- func (m Config) GetHTTPClientRoundTripper(ctx context.Context, extensions map[component.ID]component.Component) (extensionmiddleware.WrapHTTPRoundTripperFunc, error)
- func (m Config) GetHTTPServerHandler(ctx context.Context, extensions map[component.ID]component.Component) (extensionmiddleware.WrapHTTPHandlerFunc, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// ID specifies the name of the extension to use.
ID component.ID `mapstructure:"id,omitempty"`
// contains filtered or unexported fields
}
Middleware defines the extension ID for a middleware component.
func (Config) GetGRPCClientOptions ¶
func (m Config) GetGRPCClientOptions(ctx context.Context, extensions map[component.ID]component.Component) ([]grpc.DialOption, error)
GetGRPCClientOptions attempts to select the appropriate extensionmiddleware.GRPCClient from the map of extensions, and returns the gRPC dial options. If a middleware is not found, an error is returned. This should only be used by gRPC clients.
func (Config) GetGRPCServerOptions ¶
func (m Config) GetGRPCServerOptions(ctx context.Context, extensions map[component.ID]component.Component) ([]grpc.ServerOption, error)
GetGRPCServerOptions attempts to select the appropriate extensionmiddleware.GRPCServer from the map of extensions, and returns the gRPC server options. If a middleware is not found, an error is returned. This should only be used by gRPC servers.
func (Config) GetHTTPClientRoundTripper ¶
func (m Config) GetHTTPClientRoundTripper(ctx context.Context, extensions map[component.ID]component.Component) (extensionmiddleware.WrapHTTPRoundTripperFunc, error)
GetHTTPClientRoundTripper attempts to select the appropriate extensionmiddleware.HTTPClient from the map of extensions, and returns the HTTP client wrapper function. If a middleware is not found, an error is returned. This should only be used by HTTP clients.
func (Config) GetHTTPServerHandler ¶
func (m Config) GetHTTPServerHandler(ctx context.Context, extensions map[component.ID]component.Component) (extensionmiddleware.WrapHTTPHandlerFunc, error)
GetHTTPServerHandler attempts to select the appropriate extensionmiddleware.HTTPServer from the map of extensions, and returns the http.Handler wrapper function. If a middleware is not found, an error is returned. This should only be used by HTTP servers.