diff --git a/BUILD b/BUILD index 4a8bfc14..7bf42e6d 100644 --- a/BUILD +++ b/BUILD @@ -82,6 +82,7 @@ proto_library( "//contrib/envoy/extensions/filters/network/sip_proxy/router/v3alpha:pkg", "//contrib/envoy/extensions/filters/network/sip_proxy/tra/v3alpha:pkg", "//contrib/envoy/extensions/filters/network/sip_proxy/v3alpha:pkg", + "//contrib/envoy/extensions/matching/input_matchers/hyperscan/v3alpha:pkg", "//contrib/envoy/extensions/private_key_providers/cryptomb/v3alpha:pkg", "//contrib/envoy/extensions/vcl/v3alpha:pkg", "//envoy/admin/v3:pkg", diff --git a/contrib/envoy/extensions/matching/input_matchers/hyperscan/v3alpha/BUILD b/contrib/envoy/extensions/matching/input_matchers/hyperscan/v3alpha/BUILD new file mode 100644 index 00000000..ee92fb65 --- /dev/null +++ b/contrib/envoy/extensions/matching/input_matchers/hyperscan/v3alpha/BUILD @@ -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"], +) diff --git a/contrib/envoy/extensions/matching/input_matchers/hyperscan/v3alpha/hyperscan.proto b/contrib/envoy/extensions/matching/input_matchers/hyperscan/v3alpha/hyperscan.proto new file mode 100644 index 00000000..542a60b1 --- /dev/null +++ b/contrib/envoy/extensions/matching/input_matchers/hyperscan/v3alpha/hyperscan.proto @@ -0,0 +1,83 @@ +syntax = "proto3"; + +package envoy.extensions.matching.input_matchers.hyperscan.v3alpha; + +import "udpa/annotations/status.proto"; +import "validate/validate.proto"; + +option java_package = "io.envoyproxy.envoy.extensions.matching.input_matchers.hyperscan.v3alpha"; +option java_outer_classname = "HyperscanProto"; +option java_multiple_files = true; +option go_package = "github.com/envoyproxy/go-control-plane/envoy/extensions/matching/input_matchers/hyperscan/v3alpha"; +option (udpa.annotations.file_status).package_version_status = ACTIVE; + +// [#protodoc-title: Hyperscan matcher] +// [#extension: envoy.matching.input_matchers.hyperscan] + +// `Hyperscan `_ regex matcher. The engine of the matcher uses +// hybrid automata techniques to allow simultaneous matching of large numbers of regular +// expressions across streams of data. +// +// The matcher follows PCRE pattern syntax, and the regex string must adhere to the documented +// `pattern support `_. +// The syntax is not compatible with the default RE2 regex matcher. Depending on configured expressions, +// swapping regex matcher may cause match rules to no longer be valid. +message Hyperscan { + // [#next-free-field: 11] + message Regex { + // The regex expression. + // + // The expression must represent only the pattern to be matched, with no delimiters or flags. + string regex = 1 [(validate.rules).string = {min_len: 1}]; + + // The ID of the regex expression. + // + // This option is designed to be used on the sub-expressions in logical combinations. + uint32 id = 2; + + // Matching will be performed case-insensitively. + // + // The expression may still use PCRE tokens (notably `(?i)` and `(?-i)`) to switch + // case-insensitive matching on and off. + bool caseless = 3; + + // Matching a `.` will not exclude newlines. + bool dot_all = 4; + + // `^` and `$` anchors match any newlines in data. + bool multiline = 5; + + // Allow expressions which can match against an empty string. + // + // This option instructs the compiler to allow expressions that can match against empty buffers, + // such as `.?`, `.*`, `(a|)`. Since Hyperscan can return every possible match for an expression, + // such expressions generally execute very slowly. + bool allow_empty = 6; + + // Treat the pattern as a sequence of UTF-8 characters. + bool utf8 = 7; + + // Use Unicode properties for character classes. + // + // This option instructs Hyperscan to use Unicode properties, rather than the default ASCII + // interpretations, for character mnemonics like `\w` and `\s` as well as the POSIX character + // classes. It is only meaningful in conjunction with `utf8`. + bool ucp = 8; + + // Logical combination. + // + // This option instructs Hyperscan to parse this expression as logical combination syntax. + // Logical constraints consist of operands, operators and parentheses. The operands are + // expression indices, and operators can be `!`, `&` or `|`. + bool combination = 9; + + // Don’t do any match reporting. + // + // This option instructs Hyperscan to ignore match reporting for this expression. It is + // designed to be used on the sub-expressions in logical combinations. + bool quiet = 10; + } + + // Specifies a set of regex expressions that the input should match on. + repeated Regex regexes = 1 [(validate.rules).repeated = {min_items: 1}]; +} diff --git a/versioning/BUILD b/versioning/BUILD index 8da30302..02922aaf 100644 --- a/versioning/BUILD +++ b/versioning/BUILD @@ -19,6 +19,7 @@ proto_library( "//contrib/envoy/extensions/filters/network/sip_proxy/router/v3alpha:pkg", "//contrib/envoy/extensions/filters/network/sip_proxy/tra/v3alpha:pkg", "//contrib/envoy/extensions/filters/network/sip_proxy/v3alpha:pkg", + "//contrib/envoy/extensions/matching/input_matchers/hyperscan/v3alpha:pkg", "//contrib/envoy/extensions/private_key_providers/cryptomb/v3alpha:pkg", "//contrib/envoy/extensions/vcl/v3alpha:pkg", "//envoy/admin/v3:pkg",