Documentation
¶
Overview ¶
Package httpfilter contains interface definitions for xDS-based HTTP filters and a registry for filter builders.
Index ¶
- func ConvertStringMatchers(patterns []*v3matcherpb.StringMatcher) ([]matcher.StringMatcher, error)
- func Register(b Builder)
- func UnregisterForTesting(typeURL string)
- type Builder
- type ClientFilter
- type ClientFilterBuilder
- type ClientFilterOptions
- type ClientInterceptor
- type DisabledFilterConfig
- type FilterConfig
- type HeaderMutationRules
- type ServerFilter
- type ServerFilterBuilder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertStringMatchers ¶ added in v1.82.0
func ConvertStringMatchers(patterns []*v3matcherpb.StringMatcher) ([]matcher.StringMatcher, error)
ConvertStringMatchers converts a slice of protobuf StringMatcher messages to a slice of matcher.StringMatcher.
func Register ¶
func Register(b Builder)
Register registers the HTTP Filter Builder with the registry. b.TypeURLs() will be used as the types for this filter.
NOTE: this function must only be called during initialization time (i.e. in an init() function), and is not thread-safe. If multiple filters are registered with the same type URL, the one registered last will take effect.
func UnregisterForTesting ¶
func UnregisterForTesting(typeURL string)
UnregisterForTesting unregisters the HTTP Filter Builder for testing purposes.
Types ¶
type Builder ¶ added in v1.81.0
type Builder interface {
// TypeURLs are the proto message types supported by this filter. A filter
// will be registered by each of its supported message types.
TypeURLs() []string
// ParseFilterConfig parses the provided configuration proto.Message from
// the LDS configuration of this filter. This may be an anypb.Any, a
// udpa.type.v1.TypedStruct, or an xds.type.v3.TypedStruct for filters that
// do not accept a custom type. The resulting FilterConfig will later be
// passed to Build.
ParseFilterConfig(proto.Message) (FilterConfig, error)
// ParseFilterConfigOverride parses the provided override configuration
// proto.Message from the RDS override configuration of this filter. This
// may be an anypb.Any, a udpa.type.v1.TypedStruct, or an
// xds.type.v3.TypedStruct for filters that do not accept a custom type.
// The resulting FilterConfig will later be passed to Build.
ParseFilterConfigOverride(proto.Message) (FilterConfig, error)
// IsTerminal returns whether this Filter is terminal or not (i.e. it must
// be last filter in the filter chain).
IsTerminal() bool
}
Builder defines the parsing functionality of an HTTP filter. A Builder may optionally implement either ClientFilterBuilder or ServerFilterBuilder or both, indicating it is capable of working on the client side or server side or both, respectively.
type ClientFilter ¶ added in v1.81.0
type ClientFilter interface {
// BuildClientInterceptor uses the given FilterConfigs to produce an HTTP
// filter interceptor for clients. config will always be non-nil, but
// override may be nil if no override config exists for the filter.
//
// It is valid for this method to return a nil Interceptor and a nil error.
// In this case, the RPC will not be intercepted by this filter.
BuildClientInterceptor(config, override FilterConfig) (ClientInterceptor, error)
// Close is called when the filter is no longer needed.
Close()
}
ClientFilter represents the actual filter implementation on the client side. Implementations are free to maintain internal state when required, and share it across interceptors. Filter instances are retained by the resolver as long as they are present in the LDS configuration.
type ClientFilterBuilder ¶ added in v1.81.0
type ClientFilterBuilder interface {
// BuildClientFilter constructs a ClientFilter.
BuildClientFilter(opts ClientFilterOptions) ClientFilter
}
ClientFilterBuilder is an optional interface that a Builder can implement to indicate its capability to build client-side filters.
type ClientFilterOptions ¶ added in v1.83.0
type ClientFilterOptions struct {
FilterName string // FilterName is the filter name from the xDS configuration.
}
ClientFilterOptions contains options for building a client filter.
type ClientInterceptor ¶ added in v1.83.0
type ClientInterceptor interface {
// NewStream creates a ClientStream for an RPC.
//
// Implementations may delegate stream creation to the provided newStream
// function, passing the provided CallOption slice along with any new
// CallOption instances they wish to add. To intercept or override stream
// behavior, implementations may wrap the ClientStream returned by the
// delegate.
//
// Note: RPCInfo.Context is currently unused and will be nil.
NewStream(ctx context.Context, ri iresolver.RPCInfo, newStream func(ctx context.Context, opts ...grpc.CallOption) (grpc.ClientStream, error), opts ...grpc.CallOption) (grpc.ClientStream, error)
// Close closes the interceptor. Once called, no new calls to NewStream are
// accepted. Ongoing calls to NewStream are allowed to complete.
Close()
}
ClientInterceptor is an interceptor for gRPC client streams.
type DisabledFilterConfig ¶ added in v1.82.0
type DisabledFilterConfig struct{}
DisabledFilterConfig represents a disabled filter override. It implements the FilterConfig interface and can be returned by ParseFilterConfigOverride to indicate that the filter should be disabled. It is not used as a config for any filter, and is only used as a marker in the override configuration. For more information, see envoyproxy.io/docs/envoy/latest/intro/arch_overview/http/http_filters#route-based-filter-chain
type FilterConfig ¶
type FilterConfig interface {
// contains filtered or unexported methods
}
FilterConfig represents an opaque data structure holding configuration for a filter. Embed this interface to implement it.
type HeaderMutationRules ¶ added in v1.82.0
type HeaderMutationRules struct {
// AllowExpr specifies a regular expression that matches the headers that can
// be mutated.
AllowExpr *regexp.Regexp
// DisallowExpr specifies a regular expression that matches the headers that
// cannot be mutated. This overrides the above allowExpr if a header matches
// both.
DisallowExpr *regexp.Regexp
// DisallowAll specifies that no header mutations are allowed. This overrides
// all other settings.
DisallowAll bool
// DisallowIsError specifies whether to return an error if a header mutation
// is disallowed. If true, the data plane RPC will be failed with a grpc
// status code of Unknown.
DisallowIsError bool
}
HeaderMutationRules specifies the rules for what modifications an external processing server may make to headers sent on the data plane RPC.
func HeaderMutationRulesFromProto ¶ added in v1.82.0
func HeaderMutationRulesFromProto(mr *v3mutationpb.HeaderMutationRules) (HeaderMutationRules, error)
HeaderMutationRulesFromProto converts a protobuf HeaderMutationRules proto message to a HeaderMutationRules struct.
type ServerFilter ¶ added in v1.81.0
type ServerFilter interface {
// BuildServerInterceptor uses the given FilterConfigs to produce
// an HTTP filter interceptor for servers. config will always be non-nil,
// but override may be nil if no override config exists for the filter.
//
// It is valid for this method to return a nil Interceptor and a nil error.
// In this case, the RPC will not be intercepted by this filter.
BuildServerInterceptor(config, override FilterConfig) (iresolver.ServerInterceptor, error)
// Close is called when the filter is no longer needed.
Close()
}
ServerFilter represents the actual filter implementation on the server side. Implementations are free to maintain internal state when required, and share it across interceptors. Filter instances are retained by the server as long as they are present in any of the filter chains in the LDS configuration.
type ServerFilterBuilder ¶ added in v1.81.0
type ServerFilterBuilder interface {
// BuildServerFilter constructs a ServerFilter.
BuildServerFilter() ServerFilter
}
ServerFilterBuilder is an optional interface that a Builder can implement to indicate its capability to build server-side filters.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package extproc implements the Envoy external processing HTTP filter.
|
Package extproc implements the Envoy external processing HTTP filter. |
|
Package fault implements the Envoy Fault Injection HTTP filter.
|
Package fault implements the Envoy Fault Injection HTTP filter. |
|
Package gcpauthn implements the GCP Authentication HTTP filter.
|
Package gcpauthn implements the GCP Authentication HTTP filter. |
|
Package rbac implements the Envoy RBAC HTTP filter.
|
Package rbac implements the Envoy RBAC HTTP filter. |
|
Package router implements the Envoy Router HTTP filter.
|
Package router implements the Envoy Router HTTP filter. |