Documentation
¶
Index ¶
- func BuildPluginChain(plugins ...Plugin) alice.Chain
- func MaterializePluginSecrets(p Plugin) error
- type BaseCommit
- type Binding
- type BufferedResponseExecutor
- func (e *BufferedResponseExecutor) PostResolutionHook(r *http.Request, effective EffectiveBindingSet) (*http.Request, error)
- func (e *BufferedResponseExecutor) WithFinalResponseCommitter(committer FinalResponseCommitter) *BufferedResponseExecutor
- func (e *BufferedResponseExecutor) WithStreamingResponseExecutor(streaming *StreamingResponseExecutor) *BufferedResponseExecutor
- type Capability
- type CapabilitySpec
- type CompressionOfferPlugin
- type CompressionSet
- type ConsumerBindingResolver
- type ConsumerCacheKey
- type ConsumerIdentity
- type ConsumerResolution
- type EffectiveBindingSet
- type EnabledSet
- type Executor
- type FinalResponseCommitter
- type FinalizerKind
- type GenerationOwnerKind
- type LogBinding
- type LogExecutor
- func (e LogExecutor) Bindings() []LogBinding
- func (e LogExecutor) Prepare(r *http.Request) (*http.Request, error)
- func (e LogExecutor) RegisterComposite(r *http.Request) bool
- func (e LogExecutor) SealAndRegister(r *http.Request) error
- func (e LogExecutor) SealFinalRequest(r *http.Request) error
- func (e LogExecutor) WithBindings(bindings []LogBinding) (LogExecutor, error)
- type LogRequestState
- type Plugin
- type PostResolutionHook
- type ProtocolKind
- type RequestOwnerKind
- type RequestPipeline
- func (p RequestPipeline) Then(terminal http.Handler) http.Handler
- func (p RequestPipeline) ThenWithPostResolutionHook(terminal http.Handler, hook PostResolutionHook) http.Handler
- func (p RequestPipeline) WithBufferedResponseExecutor(executor *BufferedResponseExecutor) RequestPipeline
- func (p RequestPipeline) WithLogExecutor(executor *LogExecutor) RequestPipeline
- func (p RequestPipeline) WithStreamingResponseExecutor(executor *StreamingResponseExecutor) RequestPipeline
- type RequestStage
- type RequestStageSpec
- type ResolvedResponsePhases
- type ResourceKind
- type ResourceProvenance
- type ResponseBinding
- type ResponseCapability
- type ResponseCapabilityDescriber
- type ResponseCapabilityPlugin
- type ResponseOwnerKind
- type ResponsePhaseMask
- type ResponsePlan
- func (p ResponsePlan) BufferedBindings() []ResponseBinding
- func (p ResponsePlan) BufferedConfig() base.BufferedResponseConfig
- func (p ResponsePlan) Install(pipeline RequestPipeline, terminal http.Handler) http.Handler
- func (p ResponsePlan) Materialize(effective EffectiveBindingSet) (ResponsePlan, error)
- func (p ResponsePlan) PostResolutionHook(r *http.Request, effective EffectiveBindingSet) (*http.Request, error)
- func (p ResponsePlan) RouteTerminals() []RouteTerminalCandidate
- func (p ResponsePlan) StaticBindings() []Binding
- func (p ResponsePlan) StreamingBindings() []Binding
- type ResponsePlanInput
- type RouteTerminalCandidate
- type Scope
- type SecretMaterializer
- type StreamingResponseExecutor
- func (e *StreamingResponseExecutor) Bindings() []Binding
- func (e *StreamingResponseExecutor) CommitResponse(w http.ResponseWriter, r *http.Request, state *base.ResponseState, ...) error
- func (e *StreamingResponseExecutor) PostResolutionHook(r *http.Request, effective EffectiveBindingSet) (*http.Request, error)
- func (e *StreamingResponseExecutor) RunExclusiveProtocol(w http.ResponseWriter, r *http.Request, next http.Handler) (*http.Request, base.ProtocolDisposition, error)
- func (e *StreamingResponseExecutor) Then(next http.Handler) http.Handler
- func (e *StreamingResponseExecutor) WithRouteTerminals(terminals []RouteTerminalCandidate) (*StreamingResponseExecutor, error)
- type TerminalDescriptor
- type TerminalOwner
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildPluginChain ¶
func MaterializePluginSecrets ¶
MaterializePluginSecrets rejects unresolved references from plugins that do not declare SecretMaterializer ownership before PostInit.
Types ¶
type BaseCommit ¶
type BaseCommit func(http.ResponseWriter, *base.ResponseState)
type Binding ¶
type Binding struct {
Plugin Plugin
Scope Scope
Stage RequestStage
Provenance ResourceProvenance
// contains filtered or unexported fields
}
Binding is the immutable executor input for one materialized plugin. factoryName is intentionally private: callers must provide the exact registry/config key through BindPlugin rather than deriving it from GetName.
func BindPlugin ¶
func BindPlugin( factoryName string, p Plugin, scope Scope, provenance ResourceProvenance, ) Binding
BindPlugin records the exact factory name and resolves its audited request stage. Unknown names remain in the legacy remainder for compatibility.
func BindPluginChecked ¶
func BindPluginChecked( factoryName string, p Plugin, scope Scope, provenance ResourceProvenance, ) (Binding, error)
BindPluginChecked is the strict production constructor. It records the exact factory key and writes any config-derived request stage into the immutable Binding before it can enter a pipeline.
type BufferedResponseExecutor ¶
type BufferedResponseExecutor struct {
// contains filtered or unexported fields
}
func NewBufferedResponseExecutor ¶
func NewBufferedResponseExecutor( static []Binding, terminal TerminalDescriptor, config base.BufferedResponseConfig, ) (*BufferedResponseExecutor, error)
func (*BufferedResponseExecutor) PostResolutionHook ¶
func (e *BufferedResponseExecutor) PostResolutionHook( r *http.Request, effective EffectiveBindingSet, ) (*http.Request, error)
func (*BufferedResponseExecutor) WithFinalResponseCommitter ¶
func (e *BufferedResponseExecutor) WithFinalResponseCommitter( committer FinalResponseCommitter, ) *BufferedResponseExecutor
func (*BufferedResponseExecutor) WithStreamingResponseExecutor ¶
func (e *BufferedResponseExecutor) WithStreamingResponseExecutor( streaming *StreamingResponseExecutor, ) *BufferedResponseExecutor
type Capability ¶
type Capability uint32
const ( CapabilitySystem Capability = 1 << iota CapabilityRequestRewrite CapabilityConsumerRewrite CapabilityRequestAccess CapabilityBeforeProxy CapabilityConditionalTerminal CapabilityHeaderFilter CapabilityBufferedBodyFilter CapabilityFinalResponseStore CapabilityStreamingBodyFilter CapabilityCompressionOffer CapabilityStreamingResponseOwner CapabilityExclusiveProtocolOwner CapabilityProtocolOwner CapabilityLog CapabilityFinalizer CapabilityGenerationOwner CapabilitySeparateSubsystem CapabilityLogSanitizer )
type CapabilitySpec ¶
type CapabilitySpec struct {
Identity string
ImplementationName string
Capabilities Capability
RequestOwners []RequestOwnerKind
ResponseOwners []ResponseOwnerKind
Finalizer FinalizerKind
GenerationOwner GenerationOwnerKind
PrimaryPlan string
}
func CapabilitySpecForFactory ¶
func CapabilitySpecForFactory(factory string) (CapabilitySpec, bool)
func CapabilitySpecForIdentity ¶
func CapabilitySpecForIdentity(identity string) (CapabilitySpec, bool)
type CompressionOfferPlugin ¶
type CompressionOfferPlugin interface {
RegisterCompressionOffers(*http.Request, *compression.State) []compression.Offer
WrapCompression(
http.ResponseWriter,
*http.Request,
*compression.State,
compression.Decision,
) (http.ResponseWriter, error)
}
CompressionOfferPlugin is the root-owned structural contract. It keeps the complete Offer/State/Decision values from shared negotiation.
type CompressionSet ¶
type CompressionSet uint8
CompressionSet records structural content-coding offers without coupling the capability registry to a request-local compression.State.
const ( CompressionOfferGzip CompressionSet = 1 << iota CompressionOfferDeflate CompressionOfferBrotli )
type ConsumerBindingResolver ¶
type ConsumerBindingResolver func(*http.Request) (ConsumerResolution, error)
type ConsumerCacheKey ¶
type ConsumerIdentity ¶
type ConsumerResolution ¶
type ConsumerResolution struct {
Bindings []Binding
Request *http.Request
CacheKey ConsumerCacheKey
Identity ConsumerIdentity
Resolved bool
}
type EffectiveBindingSet ¶
type EffectiveBindingSet struct {
// contains filtered or unexported fields
}
EffectiveBindingSet keeps the two Plan 14 partitions separate so response materialization can execute global/system winners before route/consumer winners without reconstructing them after the terminal returns.
type EnabledSet ¶
type EnabledSet struct {
// contains filtered or unexported fields
}
EnabledSet is the immutable membership snapshot used by a route build.
func NewEnabledSet ¶
func NewEnabledSet(names []string) EnabledSet
NewEnabledSet clones names into a membership set.
func (EnabledSet) Contains ¶
func (s EnabledSet) Contains(name string) bool
Contains reports whether name is enabled in the set.
type Executor ¶
type Executor struct {
// contains filtered or unexported fields
}
Executor owns an immutable snapshot of either a legacy plugin list or scoped bindings, plus the response transform count captured at build time.
func NewExecutor ¶
func NewScopedExecutor ¶
NewScopedExecutor clones the supplied bindings and executes only system and global audited rewrite stages by scope while retaining route rewrites and every other plugin in the legacy priority chain until the auth/consumer boundary is migrated.
type FinalResponseCommitter ¶
type FinalResponseCommitter interface {
CommitFinalResponse(http.ResponseWriter, *http.Request, *base.ResponseState, BaseCommit)
}
type FinalizerKind ¶
type FinalizerKind uint8
const ( FinalizerNone FinalizerKind = iota FinalizerSnapshot FinalizerDynamic )
type GenerationOwnerKind ¶
type GenerationOwnerKind uint8
const ( GenerationOwnerNone GenerationOwnerKind = iota GenerationOwnerProcess GenerationOwnerRoute )
type LogBinding ¶
type LogBinding struct {
Plugin Plugin
Scope Scope
Provenance ResourceProvenance
Policy base.LogCapturePolicy
}
type LogExecutor ¶
type LogExecutor struct {
// contains filtered or unexported fields
}
func NewLogExecutor ¶
func NewLogExecutor(bindings []LogBinding) (LogExecutor, error)
func NewLogExecutorFromBindings ¶
func NewLogExecutorFromBindings(bindings []Binding) (LogExecutor, error)
NewLogExecutorFromBindings selects explicit sanitizer, log, and snapshot- finalizer owners from one materialized binding set. Dynamic finalizers register their own lifecycle callbacks and never enter this executor.
func (LogExecutor) Bindings ¶
func (e LogExecutor) Bindings() []LogBinding
func (LogExecutor) RegisterComposite ¶
func (e LogExecutor) RegisterComposite(r *http.Request) bool
func (LogExecutor) SealAndRegister ¶
func (e LogExecutor) SealAndRegister(r *http.Request) error
func (LogExecutor) SealFinalRequest ¶
func (e LogExecutor) SealFinalRequest(r *http.Request) error
func (LogExecutor) WithBindings ¶
func (e LogExecutor) WithBindings(bindings []LogBinding) (LogExecutor, error)
WithBindings returns a value copy with per-request materialized bindings. Route integration can construct the static executor before authentication, then replace this binding set after consumer/group resolution without mutating the published generation executor.
type LogRequestState ¶
type LogRequestState struct {
// contains filtered or unexported fields
}
type Plugin ¶
type PostResolutionHook ¶
type ProtocolKind ¶
type ProtocolKind string
const ( ProtocolNone ProtocolKind = "" ProtocolAI ProtocolKind = "ai" ProtocolGRPCWeb ProtocolKind = "grpc-web" ProtocolKafka ProtocolKind = "kafka" ProtocolDubbo ProtocolKind = "dubbo" ProtocolHTTPDubbo ProtocolKind = "http-dubbo" ProtocolMQTT ProtocolKind = "mqtt" )
type RequestOwnerKind ¶
type RequestOwnerKind uint8
const ( RequestOwnerNone RequestOwnerKind = iota RequestOwnerInheritedStage RequestOwnerBeforeProxyConsumer RequestOwnerBeforeProxyHookRegistration RequestOwnerRouteOwned RequestOwnerSeparateSubsystem RequestOwnerLegacyAdapter )
func ResolveBeforeProxyOwner ¶
func ResolveBeforeProxyOwner(factory string, config any) (RequestOwnerKind, bool, error)
type RequestPipeline ¶
type RequestPipeline struct {
// contains filtered or unexported fields
}
RequestPipeline owns the explicit Plan 14 request order. Static bindings are cloned at construction; resolution data is merged per request so no mutable request, auth, or override state can leak between requests.
func NewRequestPipeline ¶
func NewRequestPipeline(bindings []Binding, resolve ConsumerBindingResolver) RequestPipeline
func (RequestPipeline) ThenWithPostResolutionHook ¶
func (p RequestPipeline) ThenWithPostResolutionHook( terminal http.Handler, hook PostResolutionHook, ) http.Handler
ThenWithPostResolutionHook inserts one hook after consumer/group winners are merged and before any later request stage or terminal runs.
func (RequestPipeline) WithBufferedResponseExecutor ¶
func (p RequestPipeline) WithBufferedResponseExecutor( executor *BufferedResponseExecutor, ) RequestPipeline
WithBufferedResponseExecutor returns a value copy that owns one immutable response executor reference. Request-local capture state is created by Then, never stored on the pipeline itself.
func (RequestPipeline) WithLogExecutor ¶
func (p RequestPipeline) WithLogExecutor(executor *LogExecutor) RequestPipeline
func (RequestPipeline) WithStreamingResponseExecutor ¶
func (p RequestPipeline) WithStreamingResponseExecutor( executor *StreamingResponseExecutor, ) RequestPipeline
type RequestStage ¶
type RequestStage uint8
RequestStage identifies the request-stage owner for a plugin binding.
const ( RequestStageLegacy RequestStage = iota RequestStageRewrite RequestStageConsumerRewrite RequestStageAccess RequestStageBeforeProxy RequestStageNone )
type RequestStageSpec ¶
type RequestStageSpec struct {
Stage RequestStage
AuthenticatesConsumer bool
ConsumerConfigOnly bool
AdaptLegacyHandler bool
ConfigAware bool
}
RequestStageSpec describes the audited request-stage owner for one exact plugin factory key. AdaptLegacyHandler is set only for handlers audited for request-stage adaptation with no post-next work, response-writer wrapper, flush/hijack, logging, or deferred cleanup behavior.
func RequestStageFor ¶
func RequestStageFor(name string) (RequestStageSpec, bool)
RequestStageFor resolves only the exact factory/config name.
func ResolveRequestStage ¶
func ResolveRequestStage(factoryKey string, config any) (RequestStageSpec, bool, error)
ResolveRequestStage resolves the exact factory key and, for config-aware factories, validates the initialized config descriptor before returning the request-stage owner. Unknown factory keys are intentionally not inferred.
type ResolvedResponsePhases ¶
type ResolvedResponsePhases struct {
Owners []ResponseOwnerKind
CompressionOffers CompressionSet
ExclusiveProtocol ProtocolKind
}
func ResolveResponsePhases ¶
func ResolveResponsePhases(factory string, config any) (ResolvedResponsePhases, error)
type ResourceKind ¶
type ResourceKind string
ResourceKind identifies the source resource that materialized a binding.
const ( ResourceSystem ResourceKind = "system" ResourceGlobalRule ResourceKind = "global_rule" ResourceRoute ResourceKind = "route" ResourceService ResourceKind = "service" ResourcePluginConfig ResourceKind = "plugin_config" ResourceConsumer ResourceKind = "consumer" ResourceConsumerGroup ResourceKind = "consumer_group" )
const ResourceUpstream ResourceKind = "upstream"
type ResourceProvenance ¶
type ResourceProvenance struct {
Kind ResourceKind
ID string
}
ResourceProvenance is kept by value so diagnostics cannot lose the source identity while route/plugin configuration maps are merged.
type ResponseBinding ¶
type ResponseBinding struct {
Plugin Plugin
Scope Scope
Provenance ResourceProvenance
Phases ResponsePhaseMask
// contains filtered or unexported fields
}
func MaterializeResponseBindings ¶
func MaterializeResponseBindings(effective EffectiveBindingSet) ([]ResponseBinding, error)
type ResponseCapability ¶
type ResponseCapability struct {
HeaderFilter bool
BufferedBodyFilter bool
StreamingBodyFilter bool
StreamingResponseOwner bool
CompressionOffer bool
ExclusiveProtocol ProtocolKind
SeparateSubsystem bool
}
ResponseCapability is the build-time declaration for response ownership. Request-stage ownership remains in RequestStageSpec; keeping these tables separate prevents a Handler type assertion from accidentally becoming a response phase declaration.
func ResponseCapabilityFor ¶
func ResponseCapabilityFor(factory string) (ResponseCapability, bool)
type ResponseCapabilityDescriber ¶
type ResponseCapabilityDescriber interface {
DescribeResponseCapability() (ResponseCapability, error)
}
type ResponseCapabilityPlugin ¶
type ResponseCapabilityPlugin interface {
ResponseCapability() ResponseCapability
}
type ResponseOwnerKind ¶
type ResponseOwnerKind uint8
const ( ResponseOwnerNone ResponseOwnerKind = iota ResponseOwnerHeaderFilter ResponseOwnerBufferedBodyFilter ResponseOwnerFinalStore ResponseOwnerStreamingHeaderFilter ResponseOwnerStreamingBodyFilter ResponseOwnerCompressionOffer ResponseOwnerStreamingProducer ResponseOwnerExclusiveProtocol ResponseOwnerSeparateSubsystemProtocol )
type ResponsePhaseMask ¶
type ResponsePhaseMask uint8
const ( ResponsePhaseHeader ResponsePhaseMask = 1 << iota ResponsePhaseBufferedBody ResponsePhaseFinalStore )
type ResponsePlan ¶
type ResponsePlan struct {
// contains filtered or unexported fields
}
ResponsePlan is an immutable generation recipe. Slices are private and every accessor returns a copy; request-local dynamic materialization never mutates the published generation.
func BuildResponsePlan ¶
func BuildResponsePlan(input any) (ResponsePlan, error)
BuildResponsePlan validates and freezes the response ownership recipe. The any input accepts the original []Binding prototype as well as the explicit Plan 16 input, allowing existing callers to migrate without a second plan constructor.
func (ResponsePlan) BufferedBindings ¶
func (p ResponsePlan) BufferedBindings() []ResponseBinding
func (ResponsePlan) BufferedConfig ¶
func (p ResponsePlan) BufferedConfig() base.BufferedResponseConfig
func (ResponsePlan) Install ¶
func (p ResponsePlan) Install(pipeline RequestPipeline, terminal http.Handler) http.Handler
func (ResponsePlan) Materialize ¶
func (p ResponsePlan) Materialize(effective EffectiveBindingSet) (ResponsePlan, error)
Materialize resolves a request-local effective binding set while retaining the generation's route-owned streaming and terminal declarations.
func (ResponsePlan) PostResolutionHook ¶
func (p ResponsePlan) PostResolutionHook(r *http.Request, effective EffectiveBindingSet) (*http.Request, error)
PostResolutionHook performs the immutable per-request compatibility check. The request itself is returned unchanged; execution state remains owned by RequestPipeline/BufferedResponseExecutor.
func (ResponsePlan) RouteTerminals ¶
func (p ResponsePlan) RouteTerminals() []RouteTerminalCandidate
func (ResponsePlan) StaticBindings ¶
func (p ResponsePlan) StaticBindings() []Binding
func (ResponsePlan) StreamingBindings ¶
func (p ResponsePlan) StreamingBindings() []Binding
type ResponsePlanInput ¶
type ResponsePlanInput struct {
StaticBindings []Binding
RouteTerminals []RouteTerminalCandidate
BufferedConfig base.BufferedResponseConfig
}
type RouteTerminalCandidate ¶
type RouteTerminalCandidate struct {
Identity string
Scope Scope
Priority int
Provenance ResourceProvenance
Protocol ProtocolKind
Terminal base.ExclusiveProtocolTerminal
}
type SecretMaterializer ¶
type SecretMaterializer = base.SecretMaterializer
SecretMaterializer resolves generation-owned credentials after schema decoding and before PostInit. Implementations must retain only redacted descriptors in their public config.
type StreamingResponseExecutor ¶
type StreamingResponseExecutor struct {
// contains filtered or unexported fields
}
StreamingResponseExecutor owns streaming header filters, body wrappers and the optional exclusive protocol owner for one generation. It is immutable; all per-request state lives in the returned handler/writer chain.
func NewStreamingResponseExecutor ¶
func NewStreamingResponseExecutor(bindings []Binding) (*StreamingResponseExecutor, error)
func (*StreamingResponseExecutor) Bindings ¶
func (e *StreamingResponseExecutor) Bindings() []Binding
func (*StreamingResponseExecutor) CommitResponse ¶
func (e *StreamingResponseExecutor) CommitResponse( w http.ResponseWriter, r *http.Request, state *base.ResponseState, commit BaseCommit, ) error
CommitResponse composes Plan 16 header/body adapters after bounded Plan 15 transformations and stores have produced the final canonical state.
func (*StreamingResponseExecutor) PostResolutionHook ¶
func (e *StreamingResponseExecutor) PostResolutionHook( r *http.Request, effective EffectiveBindingSet, ) (*http.Request, error)
func (*StreamingResponseExecutor) RunExclusiveProtocol ¶
func (e *StreamingResponseExecutor) RunExclusiveProtocol( w http.ResponseWriter, r *http.Request, next http.Handler, ) (*http.Request, base.ProtocolDisposition, error)
func (*StreamingResponseExecutor) Then ¶
func (e *StreamingResponseExecutor) Then(next http.Handler) http.Handler
Then installs streaming wrappers around the normal upstream continuation. Exclusive protocol owners run exactly once before that continuation.
func (*StreamingResponseExecutor) WithRouteTerminals ¶
func (e *StreamingResponseExecutor) WithRouteTerminals( terminals []RouteTerminalCandidate, ) (*StreamingResponseExecutor, error)
type TerminalDescriptor ¶
type TerminalDescriptor struct {
Owner TerminalOwner
Provenance ResourceProvenance
}
type TerminalOwner ¶
type TerminalOwner uint8
const ( TerminalOwnerOrdinaryProxy TerminalOwner = iota TerminalOwnerGlobalNotFound TerminalOwnerAIRuntime TerminalOwnerKafka TerminalOwnerDubbo TerminalOwnerHTTPDubbo )
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package ai_common holds stateless helpers shared by the AI proxy plugins.
|
Package ai_common holds stateless helpers shared by the AI proxy plugins. |
|
Package chash implements the consistent-hash ring used by APISIX HTTP upstream owners.
|
Package chash implements the consistent-hash ring used by APISIX HTTP upstream owners. |
|
Package compression coordinates content-coding selection for response compression plugins.
|
Package compression coordinates content-coding selection for response compression plugins. |
|
Package dubbo shares the Dubbo transport skeleton used by the dubbo-proxy and http-dubbo plugins.
|
Package dubbo shares the Dubbo transport skeleton used by the dubbo-proxy and http-dubbo plugins. |
|
Package limitbase provides shared helpers for the rate-limit plugin family: limit-req, limit-conn, limit-count, and graphql-limit-count.
|
Package limitbase provides shared helpers for the rate-limit plugin family: limit-req, limit-conn, limit-count, and graphql-limit-count. |
|
Package luautil provides shared conversions between Lua values and Go values for the serverless and exit-transformer plugins.
|
Package luautil provides shared conversions between Lua values and Go values for the serverless and exit-transformer plugins. |