Documentation
¶
Overview ¶
Package custom provides custom functionality.
Index ¶
- func DispatchAlias(ctx *gin.Context) bool
- func RequestHandler(cfgProvider configfx.Provider, logger *slog.Logger, redis rediscli.Client, ...) gin.HandlerFunc
- func RequestHandlerWithNative(cfgProvider configfx.Provider, logger *slog.Logger, redis rediscli.Client, ...) gin.HandlerFunc
- type Handler
- type NativeHook
- type NativeHookCaller
- type NativeHookRequestBuilder
- type NativeHookRunner
- type Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DispatchAlias ¶
DispatchAlias executes a configured custom hook alias for requests that did not match a concrete route. It returns false when the request is not an alias.
func RequestHandler ¶
func RequestHandler(cfgProvider configfx.Provider, logger *slog.Logger, redis rediscli.Client, validator oidcbearer.TokenValidator) gin.HandlerFunc
RequestHandler mirrors the original logic for executing custom Lua hooks. The validator may be nil when OIDC authentication is not configured.
func RequestHandlerWithNative ¶
func RequestHandlerWithNative( cfgProvider configfx.Provider, logger *slog.Logger, redis rediscli.Client, validator oidcbearer.TokenValidator, nativeHooks *nativeHookIndex, ) gin.HandlerFunc
RequestHandlerWithNative executes native plugin hooks before falling back to the existing Lua custom hook implementation.
Types ¶
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler registers custom Lua hook endpoint(s).
type NativeHook ¶
type NativeHook struct {
Runner NativeHookRunner
BuildRequest NativeHookRequestBuilder
Descriptor pluginapi.HookDescriptor
QualifiedName string
ModuleName string
ComponentName string
}
NativeHook binds one registered plugin hook to the custom HTTP handler.
type NativeHookCaller ¶
NativeHookCaller contains authenticated caller metadata for request building.
type NativeHookRequestBuilder ¶
type NativeHookRequestBuilder func(*gin.Context, config.File, pluginapi.HookDescriptor, NativeHookCaller, []byte) (pluginapi.HookRequest, error)
NativeHookRequestBuilder builds the public hook request after host validation.
type NativeHookRunner ¶
type NativeHookRunner interface {
ServeHook(context.Context, string, pluginapi.HookRequest) (pluginapi.HookResponse, error)
}
NativeHookRunner invokes one native plugin hook through the runtime boundary.
type Option ¶
type Option func(*Handler)
Option customizes custom hook handler registration.
func WithNativeHooks ¶
func WithNativeHooks(hooks []NativeHook) Option
WithNativeHooks registers native plugin hook bindings in the custom handler.