Skip to content

Commit b6f4106

Browse files
dynamic_modules: add dynamic modules support for Network filters (#42605)
## Description This PR adds support for a new Network filter for Dynamic Modules. With this it should be possible to write new Network Filters similar to HTTP Filters in Go, RUST, etc. --- **Commit Message:** dynamic_modules: add dynamic modules support for Network filters **Additional Description:** Adds support for a new Network filter for Dynamic Modules. **Risk Level:** Low **Testing:** Added Unit + Integration Tests **Docs Changes:** Added **Release Notes:** Added --------- Signed-off-by: Rohit Agrawal <[email protected]> Mirrored from https://github.com/envoyproxy/envoy @ 19131921066a599c3477cb320e2715bd4ea0d231
1 parent ca21a21 commit b6f4106

File tree

4 files changed

+85
-0
lines changed

4 files changed

+85
-0
lines changed

BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,7 @@ proto_library(
242242
"//envoy/extensions/filters/network/direct_response/v3:pkg",
243243
"//envoy/extensions/filters/network/dubbo_proxy/router/v3:pkg",
244244
"//envoy/extensions/filters/network/dubbo_proxy/v3:pkg",
245+
"//envoy/extensions/filters/network/dynamic_modules/v3:pkg",
245246
"//envoy/extensions/filters/network/echo/v3:pkg",
246247
"//envoy/extensions/filters/network/ext_authz/v3:pkg",
247248
"//envoy/extensions/filters/network/ext_proc/v3:pkg",
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# DO NOT EDIT. This file is generated by tools/proto_format/proto_sync.py.
2+
3+
load("@envoy_api//bazel:api_build_system.bzl", "api_proto_package")
4+
5+
licenses(["notice"]) # Apache 2
6+
7+
api_proto_package(
8+
deps = [
9+
"//envoy/extensions/dynamic_modules/v3:pkg",
10+
"@com_github_cncf_xds//udpa/annotations:pkg",
11+
],
12+
)
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
syntax = "proto3";
2+
3+
package envoy.extensions.filters.network.dynamic_modules.v3;
4+
5+
import "envoy/extensions/dynamic_modules/v3/dynamic_modules.proto";
6+
7+
import "google/protobuf/any.proto";
8+
9+
import "udpa/annotations/status.proto";
10+
11+
option java_package = "io.envoyproxy.envoy.extensions.filters.network.dynamic_modules.v3";
12+
option java_outer_classname = "DynamicModulesProto";
13+
option java_multiple_files = true;
14+
option go_package = "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/network/dynamic_modules/v3;dynamic_modulesv3";
15+
option (udpa.annotations.file_status).package_version_status = ACTIVE;
16+
17+
// [#protodoc-title: Network filter for dynamic modules]
18+
// [#extension: envoy.filters.network.dynamic_modules]
19+
20+
// Configuration of the network filter for dynamic modules. This filter allows loading shared object
21+
// files that can be loaded via dlopen by the network filter.
22+
//
23+
// A module can be loaded by multiple network filters, hence the program can be structured in a way
24+
// that the module is loaded only once and shared across multiple filters providing multiple
25+
// functionalities.
26+
//
27+
// Unlike HTTP filters which operate on structured headers, body, and trailers, network filters
28+
// work with raw TCP byte streams. The filter can:
29+
//
30+
// * Inspect, modify, or inject data into the downstream connection.
31+
// * Access connection-level information such as addresses and TLS status.
32+
// * Control connection lifecycle (e.g., close the connection).
33+
//
34+
message DynamicModuleNetworkFilter {
35+
// Specifies the shared-object level configuration.
36+
envoy.extensions.dynamic_modules.v3.DynamicModuleConfig dynamic_module_config = 1;
37+
38+
// The name for this filter configuration. This can be used to distinguish between different
39+
// filter implementations inside a dynamic module. For example, a module can have completely
40+
// different filter implementations. When Envoy receives this configuration, it passes the
41+
// ``filter_name`` to the dynamic module's network filter config init function together with
42+
// the ``filter_config``. That way a module can decide which in-module filter implementation
43+
// to use based on the name at load time.
44+
string filter_name = 2;
45+
46+
// The configuration for the filter chosen by ``filter_name``. This is passed to the module's
47+
// network filter initialization function. Together with the ``filter_name``, the module can
48+
// decide which in-module filter implementation to use and fine-tune the behavior of the filter.
49+
//
50+
// For example, if a module has two filter implementations, one for echo and one for rate
51+
// limiting, ``filter_name`` is used to choose either echo or rate limiting. The ``filter_config``
52+
// can be used to configure the echo behavior or the rate limiting parameters.
53+
//
54+
// ``google.protobuf.Struct`` is serialized as JSON before passing it to the module.
55+
// ``google.protobuf.BytesValue`` and ``google.protobuf.StringValue`` are passed directly
56+
// without the wrapper.
57+
//
58+
// .. code-block:: yaml
59+
//
60+
// # Passing a string value
61+
// filter_config:
62+
// "@type": "type.googleapis.com/google.protobuf.StringValue"
63+
// value: hello
64+
//
65+
// # Passing raw bytes
66+
// filter_config:
67+
// "@type": "type.googleapis.com/google.protobuf.BytesValue"
68+
// value: aGVsbG8= # echo -n "hello" | base64
69+
//
70+
google.protobuf.Any filter_config = 3;
71+
}

versioning/BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ proto_library(
181181
"//envoy/extensions/filters/network/direct_response/v3:pkg",
182182
"//envoy/extensions/filters/network/dubbo_proxy/router/v3:pkg",
183183
"//envoy/extensions/filters/network/dubbo_proxy/v3:pkg",
184+
"//envoy/extensions/filters/network/dynamic_modules/v3:pkg",
184185
"//envoy/extensions/filters/network/echo/v3:pkg",
185186
"//envoy/extensions/filters/network/ext_authz/v3:pkg",
186187
"//envoy/extensions/filters/network/ext_proc/v3:pkg",

0 commit comments

Comments
 (0)