regex: add regex engine factory and config option (#21633)
Add support for injecting regex engine with its options on startup in a bootstrap option. These are some API, runtime and implementation changes. * google_re2 in safe_regex will be deprecated and no longer be required. Regex::parseRegex will choose the registered regex engine to parse expressions into matchers. * A new bootstrap option default_regex_engine will be introduced for regex engine selection. * For compatibility, GoogleRE2 will be chosen as default regex engine if no regex engine is designated. Signed-off-by: Xie Zhihao <zhihao.xie@intel.com> Mirrored from https://github.com/envoyproxy/envoy @ 0a92cc86e7f8b88d5af0eb2e27b5c7ef64719e56pull/626/head
parent
73fdc08d54
commit
ab3d7b06a2
6 changed files with 44 additions and 4 deletions
@ -0,0 +1,9 @@ |
|||||||
|
# DO NOT EDIT. This file is generated by tools/proto_format/proto_sync.py. |
||||||
|
|
||||||
|
load("@envoy_api//bazel:api_build_system.bzl", "api_proto_package") |
||||||
|
|
||||||
|
licenses(["notice"]) # Apache 2 |
||||||
|
|
||||||
|
api_proto_package( |
||||||
|
deps = ["@com_github_cncf_udpa//udpa/annotations:pkg"], |
||||||
|
) |
@ -0,0 +1,23 @@ |
|||||||
|
syntax = "proto3"; |
||||||
|
|
||||||
|
package envoy.extensions.regex_engines.v3; |
||||||
|
|
||||||
|
import "udpa/annotations/status.proto"; |
||||||
|
|
||||||
|
option java_package = "io.envoyproxy.envoy.extensions.regex_engines.v3"; |
||||||
|
option java_outer_classname = "GoogleRe2Proto"; |
||||||
|
option java_multiple_files = true; |
||||||
|
option go_package = "github.com/envoyproxy/go-control-plane/envoy/extensions/regex_engines/v3;regex_enginesv3"; |
||||||
|
option (udpa.annotations.file_status).package_version_status = ACTIVE; |
||||||
|
|
||||||
|
// [#protodoc-title: Google RE2] |
||||||
|
|
||||||
|
// Google's `RE2 <https://github.com/google/re2>`_ regex engine. The regex string must adhere to |
||||||
|
// the documented `syntax <https://github.com/google/re2/wiki/Syntax>`_. The engine is designed |
||||||
|
// to complete execution in linear time as well as limit the amount of memory used. |
||||||
|
// |
||||||
|
// Envoy emits two stats for tracking the program size of regexes: the histogram `re2.program_size`, |
||||||
|
// which records the program size, and the counter `re2.exceeded_warn_level`, which is incremented |
||||||
|
// each time the program size exceeds the warn level threshold. |
||||||
|
message GoogleRE2 { |
||||||
|
} |
Loading…
Reference in new issue