Documentation ¶
Index ¶
- Variables
- type Config
- func (*Config) Descriptor() ([]byte, []int)deprecated
- func (x *Config) GetLibraryId() string
- func (x *Config) GetLibraryPath() string
- func (x *Config) GetMergePolicy() Config_MergePolicy
- func (x *Config) GetPluginConfig() *any1.Any
- func (x *Config) GetPluginName() string
- func (*Config) ProtoMessage()
- func (x *Config) ProtoReflect() protoreflect.Message
- func (x *Config) Reset()
- func (x *Config) String() string
- func (m *Config) Validate() error
- func (m *Config) ValidateAll() error
- type ConfigMultiError
- type ConfigValidationError
- type Config_MergePolicy
- func (Config_MergePolicy) Descriptor() protoreflect.EnumDescriptor
- func (x Config_MergePolicy) Enum() *Config_MergePolicy
- func (Config_MergePolicy) EnumDescriptor() ([]byte, []int)deprecated
- func (x Config_MergePolicy) Number() protoreflect.EnumNumber
- func (x Config_MergePolicy) String() string
- func (Config_MergePolicy) Type() protoreflect.EnumType
- type ConfigsPerRoute
- func (*ConfigsPerRoute) Descriptor() ([]byte, []int)deprecated
- func (x *ConfigsPerRoute) GetPluginsConfig() map[string]*RouterPlugin
- func (*ConfigsPerRoute) ProtoMessage()
- func (x *ConfigsPerRoute) ProtoReflect() protoreflect.Message
- func (x *ConfigsPerRoute) Reset()
- func (x *ConfigsPerRoute) String() string
- func (m *ConfigsPerRoute) Validate() error
- func (m *ConfigsPerRoute) ValidateAll() error
- type ConfigsPerRouteMultiError
- type ConfigsPerRouteValidationError
- func (e ConfigsPerRouteValidationError) Cause() error
- func (e ConfigsPerRouteValidationError) Error() string
- func (e ConfigsPerRouteValidationError) ErrorName() string
- func (e ConfigsPerRouteValidationError) Field() string
- func (e ConfigsPerRouteValidationError) Key() bool
- func (e ConfigsPerRouteValidationError) Reason() string
- type RouterPlugin
- func (*RouterPlugin) Descriptor() ([]byte, []int)deprecated
- func (x *RouterPlugin) GetConfig() *any1.Any
- func (x *RouterPlugin) GetDisabled() bool
- func (m *RouterPlugin) GetOverride() isRouterPlugin_Override
- func (*RouterPlugin) ProtoMessage()
- func (x *RouterPlugin) ProtoReflect() protoreflect.Message
- func (x *RouterPlugin) Reset()
- func (x *RouterPlugin) String() string
- func (m *RouterPlugin) Validate() error
- func (m *RouterPlugin) ValidateAll() error
- type RouterPluginMultiError
- type RouterPluginValidationError
- func (e RouterPluginValidationError) Cause() error
- func (e RouterPluginValidationError) Error() string
- func (e RouterPluginValidationError) ErrorName() string
- func (e RouterPluginValidationError) Field() string
- func (e RouterPluginValidationError) Key() bool
- func (e RouterPluginValidationError) Reason() string
- type RouterPlugin_Config
- type RouterPlugin_Disabled
Constants ¶
This section is empty.
Variables ¶
var ( Config_MergePolicy_name = map[int32]string{ 0: "MERGE_VIRTUALHOST_ROUTER_FILTER", 1: "MERGE_VIRTUALHOST_ROUTER", 3: "OVERRIDE", } Config_MergePolicy_value = map[string]int32{ "MERGE_VIRTUALHOST_ROUTER_FILTER": 0, "MERGE_VIRTUALHOST_ROUTER": 1, "OVERRIDE": 3, } )
Enum value maps for Config_MergePolicy.
var File_contrib_envoy_extensions_filters_http_golang_v3alpha_golang_proto protoreflect.FileDescriptor
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // library_id is a unique ID for a dynamic library file, must be unique globally. LibraryId string `protobuf:"bytes,1,opt,name=library_id,json=libraryId,proto3" json:"library_id,omitempty"` // Dynamic library implementing the interface of // “StreamFilter <contrib/golang/filters/http/source/go/pkg/api.StreamFilter>“. // [#comment:TODO(wangfakang): Support for downloading libraries from remote repositories.] LibraryPath string `protobuf:"bytes,2,opt,name=library_path,json=libraryPath,proto3" json:"library_path,omitempty"` // plugin_name is the name of the go plugin, which needs to be consistent with the name // registered in http::RegisterHttpFilterConfigFactory. PluginName string `protobuf:"bytes,3,opt,name=plugin_name,json=pluginName,proto3" json:"plugin_name,omitempty"` // plugin_config is the configuration of the go plugin, note that this configuration is // only parsed in the go plugin. PluginConfig *any1.Any `protobuf:"bytes,4,opt,name=plugin_config,json=pluginConfig,proto3" json:"plugin_config,omitempty"` // merge_policy is the merge policy configured by the go plugin. // go plugin configuration supports three dimensions: the virtual host’s typed_per_filter_config, // the route’s typed_per_filter_config or filter's config. // The meanings are as follows: // MERGE_VIRTUALHOST_ROUTER_FILTER: pass all configuration into go plugin. // MERGE_VIRTUALHOST_ROUTER: pass Virtual-Host and Router configuration into go plugin. // OVERRIDE: override according to Router > Virtual_host > Filter priority and pass the // configuration to the go plugin. MergePolicy Config_MergePolicy `` /* 164-byte string literal not displayed */ // contains filtered or unexported fields }
[#protodoc-title: golang extension filter] Golang :ref:`configuration overview <config_http_filters_golang>`. [#extension: envoy.filters.http.golang]
In the below example, we configured the go plugin 'auth' and 'limit' dynamic libraries into Envoy, which can avoid rebuilding Envoy.
* Develop go-plugin
We can implement the interface of “StreamFilter <contrib/golang/filters/http/source/go/pkg/api.StreamFilter>“ API by the GO language to achieve the effects of Envoy native filter.
The filter based on the APIs implementation “StreamFilter <contrib/golang/filters/http/source/go/pkg/api.StreamFilter>“ For details, take a look at the :repo:`/contrib/golang/filters/http/test/test_data/echo`.
Then put the GO plugin source code into the ${OUTPUT}/src/ directory with the name of the plugin for GO plugin builds. The following examples implement limit and auth GO plugins.
.. code-block:: bash
$ tree /home/admin/envoy/go-plugins/src/ |--auth | |--config.go | |--filter.go ---limit |--config.go |--filter.go
* Build go-plugin
Build the Go plugin so by `go_plugin_generate.sh` script, below example the `liblimit.so` and `libauth.so` will be generated in the `/home/admin/envoy/go-plugins/` directory.
.. code-block:: bash
#!/bin/bash if [ $# != 2 ]; then echo "need input the go plugin name" exit 1 fi PLUGINNAME=$1 OUTPUT=/home/admin/envoy/go-plugins/ PLUGINSRCDIR=${OUTPUT}/src/${PLUGINNAME} go build --buildmode=c-shared -v -o $OUTPUT/lib${PLUGINNAME}.so $PLUGINSRCDIR
.. code-block:: bash
$ go_plugin_generate.sh limit $ go_plugin_generate.sh auth
* Configure go-plugin
Use the http filter of :ref: `golang <envoy.filters.http.golang>` to specify :ref: `library` <envoy.filters.http.golang> in ingress and egress to enable the plugin.
Example:
.. code-block:: yaml
static_resources: listeners: - name: ingress address: socket_address: protocol: TCP address: 0.0.0.0 port_value: 8080 filter_chains: - filters: - name: envoy.filters.network.http_connection_manager ...... http_filters: - name: envoy.filters.http.golang typed_config: "@type": type.googleapis.com/envoy.extensions.filters.http.golang.v3alpha.Config library_id: limit-id library_path: "/home/admin/envoy/go-plugins/liblimit.so" plugine_name: limit plugin_config: "@type": type.googleapis.com/envoy.extensions.filters.http.golang.plugins.limit.v3.Config xxx1: xx1 xxx2: xx2 - name: envoy.filters.http.header_to_metadata - name: envoy.filters.http.golang typed_config: "@type": type.googleapis.com/envoy.extensions.filters.http.golang.v3alpha.Config library_id: auth-id library_path: "/home/admin/envoy/go-plugins/libauth.so" plugine_name: auth plugin_config: "@type": type.googleapis.com/envoy.extensions.filters.http.golang.plugins.auth.v3.Config xxx1: xx1 xxx2: xx2 - name: envoy.filters.http.router - name: egress address: socket_address: protocol: TCP address: 0.0.0.0 port_value: 8081 filter_chains: - filters: - name: envoy.filters.network.http_connection_manager ...... http_filters: - name: envoy.filters.http.golang typed_config: "@type": type.googleapis.com/envoy.extensions.filters.http.golang.v3alpha.Config library_id: auth-id library_path: "/home/admin/envoy/go-plugins/libauth.so" plugine_name: auth plugin_config: "@type": type.googleapis.com/envoy.extensions.filters.http.golang.plugins.auth.v3.Config xxx1: xx1 xxx2: xx2 - name: envoy.filters.http.router
[#next-free-field: 6]
func (*Config) Descriptor
deprecated
func (*Config) GetLibraryId ¶
func (*Config) GetLibraryPath ¶
func (*Config) GetMergePolicy ¶
func (x *Config) GetMergePolicy() Config_MergePolicy
func (*Config) GetPluginConfig ¶
func (*Config) GetPluginName ¶
func (*Config) ProtoMessage ¶
func (*Config) ProtoMessage()
func (*Config) ProtoReflect ¶
func (x *Config) ProtoReflect() protoreflect.Message
func (*Config) Validate ¶
Validate checks the field values on Config with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.
func (*Config) ValidateAll ¶
ValidateAll checks the field values on Config with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in ConfigMultiError, or nil if none found.
type ConfigMultiError ¶
type ConfigMultiError []error
ConfigMultiError is an error wrapping multiple validation errors returned by Config.ValidateAll() if the designated constraints aren't met.
func (ConfigMultiError) AllErrors ¶
func (m ConfigMultiError) AllErrors() []error
AllErrors returns a list of validation violation errors.
func (ConfigMultiError) Error ¶
func (m ConfigMultiError) Error() string
Error returns a concatenation of all the error messages it wraps.
type ConfigValidationError ¶
type ConfigValidationError struct {
// contains filtered or unexported fields
}
ConfigValidationError is the validation error returned by Config.Validate if the designated constraints aren't met.
func (ConfigValidationError) Cause ¶
func (e ConfigValidationError) Cause() error
Cause function returns cause value.
func (ConfigValidationError) Error ¶
func (e ConfigValidationError) Error() string
Error satisfies the builtin error interface
func (ConfigValidationError) ErrorName ¶
func (e ConfigValidationError) ErrorName() string
ErrorName returns error name.
func (ConfigValidationError) Field ¶
func (e ConfigValidationError) Field() string
Field function returns field value.
func (ConfigValidationError) Key ¶
func (e ConfigValidationError) Key() bool
Key function returns key value.
func (ConfigValidationError) Reason ¶
func (e ConfigValidationError) Reason() string
Reason function returns reason value.
type Config_MergePolicy ¶
type Config_MergePolicy int32
const ( Config_MERGE_VIRTUALHOST_ROUTER_FILTER Config_MergePolicy = 0 Config_MERGE_VIRTUALHOST_ROUTER Config_MergePolicy = 1 Config_OVERRIDE Config_MergePolicy = 3 )
func (Config_MergePolicy) Descriptor ¶
func (Config_MergePolicy) Descriptor() protoreflect.EnumDescriptor
func (Config_MergePolicy) Enum ¶
func (x Config_MergePolicy) Enum() *Config_MergePolicy
func (Config_MergePolicy) EnumDescriptor
deprecated
func (Config_MergePolicy) EnumDescriptor() ([]byte, []int)
Deprecated: Use Config_MergePolicy.Descriptor instead.
func (Config_MergePolicy) Number ¶
func (x Config_MergePolicy) Number() protoreflect.EnumNumber
func (Config_MergePolicy) String ¶
func (x Config_MergePolicy) String() string
func (Config_MergePolicy) Type ¶
func (Config_MergePolicy) Type() protoreflect.EnumType
type ConfigsPerRoute ¶
type ConfigsPerRoute struct { // plugins_config is the configuration of the go plugin at the per-router, and // key is the name of the go plugin. // Example // // .. code-block:: yaml // // typed_per_filter_config: // envoy.filters.http.golang: // "@type": type.googleapis.com/envoy.extensions.filters.http.golang.v3alpha.ConfigsPerRoute // plugins_config: // plugin1: // disabled: true // plugin2: // config: // "@type": type.googleapis.com/golang.http.plugin2 // xxx: xxx PluginsConfig map[string]*RouterPlugin `` /* 188-byte string literal not displayed */ // contains filtered or unexported fields }
func (*ConfigsPerRoute) Descriptor
deprecated
func (*ConfigsPerRoute) Descriptor() ([]byte, []int)
Deprecated: Use ConfigsPerRoute.ProtoReflect.Descriptor instead.
func (*ConfigsPerRoute) GetPluginsConfig ¶
func (x *ConfigsPerRoute) GetPluginsConfig() map[string]*RouterPlugin
func (*ConfigsPerRoute) ProtoMessage ¶
func (*ConfigsPerRoute) ProtoMessage()
func (*ConfigsPerRoute) ProtoReflect ¶
func (x *ConfigsPerRoute) ProtoReflect() protoreflect.Message
func (*ConfigsPerRoute) Reset ¶
func (x *ConfigsPerRoute) Reset()
func (*ConfigsPerRoute) String ¶
func (x *ConfigsPerRoute) String() string
func (*ConfigsPerRoute) Validate ¶
func (m *ConfigsPerRoute) Validate() error
Validate checks the field values on ConfigsPerRoute with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.
func (*ConfigsPerRoute) ValidateAll ¶
func (m *ConfigsPerRoute) ValidateAll() error
ValidateAll checks the field values on ConfigsPerRoute with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in ConfigsPerRouteMultiError, or nil if none found.
type ConfigsPerRouteMultiError ¶
type ConfigsPerRouteMultiError []error
ConfigsPerRouteMultiError is an error wrapping multiple validation errors returned by ConfigsPerRoute.ValidateAll() if the designated constraints aren't met.
func (ConfigsPerRouteMultiError) AllErrors ¶
func (m ConfigsPerRouteMultiError) AllErrors() []error
AllErrors returns a list of validation violation errors.
func (ConfigsPerRouteMultiError) Error ¶
func (m ConfigsPerRouteMultiError) Error() string
Error returns a concatenation of all the error messages it wraps.
type ConfigsPerRouteValidationError ¶
type ConfigsPerRouteValidationError struct {
// contains filtered or unexported fields
}
ConfigsPerRouteValidationError is the validation error returned by ConfigsPerRoute.Validate if the designated constraints aren't met.
func (ConfigsPerRouteValidationError) Cause ¶
func (e ConfigsPerRouteValidationError) Cause() error
Cause function returns cause value.
func (ConfigsPerRouteValidationError) Error ¶
func (e ConfigsPerRouteValidationError) Error() string
Error satisfies the builtin error interface
func (ConfigsPerRouteValidationError) ErrorName ¶
func (e ConfigsPerRouteValidationError) ErrorName() string
ErrorName returns error name.
func (ConfigsPerRouteValidationError) Field ¶
func (e ConfigsPerRouteValidationError) Field() string
Field function returns field value.
func (ConfigsPerRouteValidationError) Key ¶
func (e ConfigsPerRouteValidationError) Key() bool
Key function returns key value.
func (ConfigsPerRouteValidationError) Reason ¶
func (e ConfigsPerRouteValidationError) Reason() string
Reason function returns reason value.
type RouterPlugin ¶
type RouterPlugin struct { // Example // // .. code-block:: yaml // // typed_per_filter_config: // envoy.filters.http.golang: // "@type": type.googleapis.com/envoy.extensions.filters.http.golang.v3alpha.ConfigsPerRoute // plugins_config: // plugin1: // disabled: true // // Types that are assignable to Override: // *RouterPlugin_Disabled // *RouterPlugin_Config Override isRouterPlugin_Override `protobuf_oneof:"override"` // contains filtered or unexported fields }
func (*RouterPlugin) Descriptor
deprecated
func (*RouterPlugin) Descriptor() ([]byte, []int)
Deprecated: Use RouterPlugin.ProtoReflect.Descriptor instead.
func (*RouterPlugin) GetConfig ¶
func (x *RouterPlugin) GetConfig() *any1.Any
func (*RouterPlugin) GetDisabled ¶
func (x *RouterPlugin) GetDisabled() bool
func (*RouterPlugin) GetOverride ¶
func (m *RouterPlugin) GetOverride() isRouterPlugin_Override
func (*RouterPlugin) ProtoMessage ¶
func (*RouterPlugin) ProtoMessage()
func (*RouterPlugin) ProtoReflect ¶
func (x *RouterPlugin) ProtoReflect() protoreflect.Message
func (*RouterPlugin) Reset ¶
func (x *RouterPlugin) Reset()
func (*RouterPlugin) String ¶
func (x *RouterPlugin) String() string
func (*RouterPlugin) Validate ¶
func (m *RouterPlugin) Validate() error
Validate checks the field values on RouterPlugin with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.
func (*RouterPlugin) ValidateAll ¶
func (m *RouterPlugin) ValidateAll() error
ValidateAll checks the field values on RouterPlugin with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in RouterPluginMultiError, or nil if none found.
type RouterPluginMultiError ¶
type RouterPluginMultiError []error
RouterPluginMultiError is an error wrapping multiple validation errors returned by RouterPlugin.ValidateAll() if the designated constraints aren't met.
func (RouterPluginMultiError) AllErrors ¶
func (m RouterPluginMultiError) AllErrors() []error
AllErrors returns a list of validation violation errors.
func (RouterPluginMultiError) Error ¶
func (m RouterPluginMultiError) Error() string
Error returns a concatenation of all the error messages it wraps.
type RouterPluginValidationError ¶
type RouterPluginValidationError struct {
// contains filtered or unexported fields
}
RouterPluginValidationError is the validation error returned by RouterPlugin.Validate if the designated constraints aren't met.
func (RouterPluginValidationError) Cause ¶
func (e RouterPluginValidationError) Cause() error
Cause function returns cause value.
func (RouterPluginValidationError) Error ¶
func (e RouterPluginValidationError) Error() string
Error satisfies the builtin error interface
func (RouterPluginValidationError) ErrorName ¶
func (e RouterPluginValidationError) ErrorName() string
ErrorName returns error name.
func (RouterPluginValidationError) Field ¶
func (e RouterPluginValidationError) Field() string
Field function returns field value.
func (RouterPluginValidationError) Key ¶
func (e RouterPluginValidationError) Key() bool
Key function returns key value.
func (RouterPluginValidationError) Reason ¶
func (e RouterPluginValidationError) Reason() string
Reason function returns reason value.
type RouterPlugin_Config ¶
type RouterPlugin_Disabled ¶
type RouterPlugin_Disabled struct { // [#not-implemented-hide:] // Disable the filter for this particular vhost or route. // If disabled is specified in multiple per-filter-configs, the most specific one will be used. Disabled bool `protobuf:"varint,1,opt,name=disabled,proto3,oneof"` }