LCOV - code coverage report
Current view: top level - source/common/config - well_known_names.h (source / functions) Hit Total Coverage
Test: coverage.dat Lines: 4 4 100.0 %
Date: 2024-01-05 06:35:25 Functions: 2 2 100.0 %

          Line data    Source code
       1             : #pragma once
       2             : 
       3             : #include <string>
       4             : #include <vector>
       5             : 
       6             : #include "envoy/common/exception.h"
       7             : 
       8             : #include "source/common/common/assert.h"
       9             : #include "source/common/common/regex.h"
      10             : #include "source/common/singleton/const_singleton.h"
      11             : 
      12             : namespace Envoy {
      13             : namespace Config {
      14             : 
      15             : bool doesTagNameValueMatchInvalidCharRegex(absl::string_view name);
      16             : 
      17             : /**
      18             :  * Well-known address resolver names.
      19             :  */
      20             : class AddressResolverNameValues {
      21             : public:
      22             :   // Basic IP resolver
      23             :   const std::string IP = "envoy.ip";
      24             : };
      25             : 
      26             : using AddressResolverNames = ConstSingleton<AddressResolverNameValues>;
      27             : 
      28             : /**
      29             :  * Well-known metadata filter namespaces.
      30             :  */
      31             : class MetadataFilterValues {
      32             : public:
      33             :   // Filter namespace for built-in load balancer.
      34             :   const std::string ENVOY_LB = "envoy.lb";
      35             :   // Filter namespace for built-in transport socket match in cluster.
      36             :   const std::string ENVOY_TRANSPORT_SOCKET_MATCH = "envoy.transport_socket_match";
      37             : };
      38             : 
      39             : using MetadataFilters = ConstSingleton<MetadataFilterValues>;
      40             : 
      41             : /**
      42             :  * Keys for MetadataFilterValues::ENVOY_LB metadata.
      43             :  */
      44             : class MetadataEnvoyLbKeyValues {
      45             : public:
      46             :   // Key in envoy.lb filter namespace for endpoint canary bool value.
      47             :   const std::string CANARY = "canary";
      48             :   // Key in envoy.lb filter namespace for the key to use to hash an endpoint.
      49             :   const std::string HASH_KEY = "hash_key";
      50             :   // Key in envoy.lb filter namespace for providing fallback metadata
      51             :   const std::string FALLBACK_LIST = "fallback_list";
      52             : };
      53             : 
      54             : using MetadataEnvoyLbKeys = ConstSingleton<MetadataEnvoyLbKeyValues>;
      55             : 
      56             : /**
      57             :  * Well known tags values and a mapping from these names to the regexes they
      58             :  * represent. Note: when names are added to the list, they also must be added to
      59             :  * the regex map by adding an entry in the getRegexMapping function.
      60             :  */
      61             : class TagNameValues {
      62             : public:
      63             :   TagNameValues();
      64             : 
      65             :   /**
      66             :    * Represents a tag extraction. This structure may be extended to
      67             :    * allow for an faster pattern-matching engine to be used as an
      68             :    * alternative to regexes, on an individual tag basis. Some of the
      69             :    * tags, such as "_rq_(\\d)xx$", will probably stay as regexes.
      70             :    */
      71             :   struct Descriptor {
      72             :     const std::string name_;
      73             :     const std::string regex_;
      74             :     const std::string substr_;
      75             :     const std::string negative_match_; // A value that will not match as the extracted tag value.
      76             :     const Regex::Type re_type_;
      77             :   };
      78             : 
      79             :   struct TokenizedDescriptor {
      80             :     const std::string name_;
      81             :     const std::string pattern_;
      82             :   };
      83             : 
      84             :   // Cluster name tag
      85             :   const std::string CLUSTER_NAME = "envoy.cluster_name";
      86             :   // Listener port tag
      87             :   const std::string LISTENER_ADDRESS = "envoy.listener_address";
      88             :   // Stats prefix for HttpConnectionManager
      89             :   const std::string HTTP_CONN_MANAGER_PREFIX = "envoy.http_conn_manager_prefix";
      90             :   // User agent for a connection
      91             :   const std::string HTTP_USER_AGENT = "envoy.http_user_agent";
      92             :   // SSL cipher for a connection
      93             :   const std::string SSL_CIPHER = "envoy.ssl_cipher";
      94             :   // SSL curve for a connection
      95             :   const std::string SSL_CURVE = "envoy.ssl_curve";
      96             :   // SSL signature algorithm for a connection
      97             :   const std::string SSL_SIGALG = "envoy.ssl_sigalg";
      98             :   // SSL version for a connection
      99             :   const std::string SSL_VERSION = "envoy.ssl_version";
     100             :   // SSL cipher suite
     101             :   const std::string SSL_CIPHER_SUITE = "cipher_suite";
     102             :   // Stats prefix for the Client SSL Auth network filter
     103             :   const std::string CLIENTSSL_PREFIX = "envoy.clientssl_prefix";
     104             :   // Stats prefix for the Mongo Proxy network filter
     105             :   const std::string MONGO_PREFIX = "envoy.mongo_prefix";
     106             :   // Request command for the Mongo Proxy network filter
     107             :   const std::string MONGO_CMD = "envoy.mongo_cmd";
     108             :   // Request collection for the Mongo Proxy network filter
     109             :   const std::string MONGO_COLLECTION = "envoy.mongo_collection";
     110             :   // Request callsite for the Mongo Proxy network filter
     111             :   const std::string MONGO_CALLSITE = "envoy.mongo_callsite";
     112             :   // Stats prefix for the Ratelimit network filter
     113             :   const std::string RATELIMIT_PREFIX = "envoy.ratelimit_prefix";
     114             :   // Stats prefix for the Local Ratelimit network filter
     115             :   const std::string LOCAL_HTTP_RATELIMIT_PREFIX = "envoy.local_http_ratelimit_prefix";
     116             :   // Stats prefix for the Local Ratelimit network filter
     117             :   const std::string LOCAL_NETWORK_RATELIMIT_PREFIX = "envoy.local_network_ratelimit_prefix";
     118             :   // Stats prefix for the Local Ratelimit listener filter
     119             :   const std::string LOCAL_LISTENER_RATELIMIT_PREFIX = "envoy.local_listener_ratelimit_prefix";
     120             :   // Stats prefix for the dns filter
     121             :   const std::string DNS_FILTER_PREFIX = "envoy.dns_filter_prefix";
     122             :   // Stats prefix for the Connection limit filter
     123             :   const std::string CONNECTION_LIMIT_PREFIX = "envoy.connection_limit_prefix";
     124             :   // Stats prefix for the RBAC network filter
     125             :   const std::string RBAC_PREFIX = "envoy.rbac_prefix";
     126             :   // Stats prefix for the TCP Proxy network filter
     127             :   const std::string TCP_PREFIX = "envoy.tcp_prefix";
     128             :   // Stats prefix for the UDP Proxy network filter
     129             :   const std::string UDP_PREFIX = "envoy.udp_prefix";
     130             :   // Downstream cluster for the Fault http filter
     131             :   const std::string FAULT_DOWNSTREAM_CLUSTER = "envoy.fault_downstream_cluster";
     132             :   // Operation name for the Dynamo http filter
     133             :   const std::string DYNAMO_OPERATION = "envoy.dynamo_operation";
     134             :   // Table name for the Dynamo http filter
     135             :   const std::string DYNAMO_TABLE = "envoy.dynamo_table";
     136             :   // Partition ID for the Dynamo http filter
     137             :   const std::string DYNAMO_PARTITION_ID = "envoy.dynamo_partition_id";
     138             :   // Request service name GRPC Bridge http filter
     139             :   const std::string GRPC_BRIDGE_SERVICE = "envoy.grpc_bridge_service";
     140             :   // Request method name for the GRPC Bridge http filter
     141             :   const std::string GRPC_BRIDGE_METHOD = "envoy.grpc_bridge_method";
     142             :   // Request virtual host given by the Router http filter
     143             :   const std::string VIRTUAL_HOST = "envoy.virtual_host";
     144             :   // Request virtual cluster given by the Router http filter
     145             :   const std::string VIRTUAL_CLUSTER = "envoy.virtual_cluster";
     146             :   // Request response code
     147             :   const std::string RESPONSE_CODE = "envoy.response_code";
     148             :   // Request response code class
     149             :   const std::string RESPONSE_CODE_CLASS = "envoy.response_code_class";
     150             :   // Route config name for RDS updates
     151             :   const std::string RDS_ROUTE_CONFIG = "envoy.rds_route_config";
     152             :   // Request route given by the Router http filter
     153             :   const std::string ROUTE = "envoy.route";
     154             :   // Stats prefix for the ext_authz HTTP filter
     155             :   const std::string EXT_AUTHZ_PREFIX = "envoy.ext_authz_prefix";
     156             :   // Listener manager worker id
     157             :   const std::string WORKER_ID = "envoy.worker_id";
     158             :   // Stats prefix for the Thrift Proxy network filter
     159             :   const std::string THRIFT_PREFIX = "envoy.thrift_prefix";
     160             :   // Stats prefix for the Redis Proxy network filter
     161             :   const std::string REDIS_PREFIX = "envoy.redis_prefix";
     162             : 
     163             :   // Mapping from the names above to their respective regex strings.
     164             :   const std::vector<std::pair<std::string, std::string>> name_regex_pairs_;
     165             : 
     166             :   // Returns the list of descriptors.
     167         346 :   const std::vector<Descriptor>& descriptorVec() const { return descriptor_vec_; }
     168             : 
     169             :   // Returns the list of tokenized descriptors.
     170         248 :   const std::vector<TokenizedDescriptor>& tokenizedDescriptorVec() const {
     171         248 :     return tokenized_descriptor_vec_;
     172         248 :   }
     173             : 
     174             : private:
     175             :   void addRe2(const std::string& name, const std::string& regex, const std::string& substr = "",
     176             :               const std::string& negative_matching_value = "");
     177             : 
     178             :   // See class doc for TagExtractorTokensImpl in
     179             :   // source/common/stats/tag_extractor_impl.h for details on the format of
     180             :   // tokens.
     181             :   void addTokenized(const std::string& name, const std::string& tokens);
     182             : 
     183             :   // Collection of tag descriptors.
     184             :   std::vector<Descriptor> descriptor_vec_;
     185             : 
     186             :   // Collection of tokenized tag descriptors.
     187             :   std::vector<TokenizedDescriptor> tokenized_descriptor_vec_;
     188             : };
     189             : 
     190             : using TagNames = ConstSingleton<TagNameValues>;
     191             : 
     192             : // This class holds extension points which will always be built into Envoy in
     193             : // server mode, but may be excluded from Envoy Mobile.
     194             : class ServerBuiltInExtensionValues {
     195             : public:
     196             :   // Extension point for the default listener.
     197             :   const std::string DEFAULT_LISTENER = "envoy.listener_manager_impl.default";
     198             :   // Extension point for the validation listener
     199             :   const std::string VALIDATION_LISTENER = "envoy.listener_manager_impl.validation";
     200             : };
     201             : 
     202             : using ServerExtensionValues = ConstSingleton<ServerBuiltInExtensionValues>;
     203             : 
     204             : } // namespace Config
     205             : } // namespace Envoy

Generated by: LCOV version 1.15