Lines
100 %
Functions
#pragma once
#include <string>
#include <vector>
#include "envoy/common/exception.h"
#include "source/common/common/assert.h"
#include "source/common/common/regex.h"
#include "source/common/singleton/const_singleton.h"
namespace Envoy {
namespace Config {
bool doesTagNameValueMatchInvalidCharRegex(absl::string_view name);
/**
* Well-known address resolver names.
*/
class AddressResolverNameValues {
public:
// Basic IP resolver
const std::string IP = "envoy.ip";
};
using AddressResolverNames = ConstSingleton<AddressResolverNameValues>;
* Well-known metadata filter namespaces.
class MetadataFilterValues {
// Filter namespace for built-in load balancer.
const std::string ENVOY_LB = "envoy.lb";
// Filter namespace for built-in transport socket match in cluster.
const std::string ENVOY_TRANSPORT_SOCKET_MATCH = "envoy.transport_socket_match";
// Filter namespace for storing custom upstream PP TLVs in metadata.
const std::string ENVOY_TRANSPORT_SOCKETS_PROXY_PROTOCOL =
"envoy.transport_sockets.proxy_protocol";
// Proxy address configuration namespace for HTTP/1.1 proxy transport sockets.
const std::string ENVOY_HTTP11_PROXY_TRANSPORT_SOCKET_ADDR =
"envoy.http11_proxy_transport_socket.proxy_address";
using MetadataFilters = ConstSingleton<MetadataFilterValues>;
* Keys for MetadataFilterValues::ENVOY_LB metadata.
class MetadataEnvoyLbKeyValues {
// Key in envoy.lb filter namespace for endpoint canary bool value.
const std::string CANARY = "canary";
// Key in envoy.lb filter namespace for the key to use to hash an endpoint.
const std::string HASH_KEY = "hash_key";
// Key in envoy.lb filter namespace for providing fallback metadata
const std::string FALLBACK_LIST = "fallback_list";
using MetadataEnvoyLbKeys = ConstSingleton<MetadataEnvoyLbKeyValues>;
* Well known tags values and a mapping from these names to the regexes they
* represent. Note: when names are added to the list, they also must be added to
* the regex map by adding an entry in the getRegexMapping function.
class TagNameValues {
TagNameValues();
* Represents a tag extraction. This structure may be extended to
* allow for an faster pattern-matching engine to be used as an
* alternative to regexes, on an individual tag basis. Some of the
* tags, such as "_rq_(\\d)xx$", will probably stay as regexes.
struct Descriptor {
const std::string name_;
const std::string regex_;
const std::string substr_;
const std::string negative_match_; // A value that will not match as the extracted tag value.
const Regex::Type re_type_;
struct TokenizedDescriptor {
const std::string pattern_;
// Cluster name tag
const std::string CLUSTER_NAME = "envoy.cluster_name";
// Listener port tag
const std::string LISTENER_ADDRESS = "envoy.listener_address";
// Stats prefix for HttpConnectionManager
const std::string HTTP_CONN_MANAGER_PREFIX = "envoy.http_conn_manager_prefix";
// User agent for a connection
const std::string HTTP_USER_AGENT = "envoy.http_user_agent";
// SSL cipher for a connection
const std::string SSL_CIPHER = "envoy.ssl_cipher";
// SSL curve for a connection
const std::string SSL_CURVE = "envoy.ssl_curve";
// SSL signature algorithm for a connection
const std::string SSL_SIGALG = "envoy.ssl_sigalg";
// SSL version for a connection
const std::string SSL_VERSION = "envoy.ssl_version";
// SSL cipher suite
const std::string SSL_CIPHER_SUITE = "cipher_suite";
// Stats prefix for the Client SSL Auth network filter
const std::string CLIENTSSL_PREFIX = "envoy.clientssl_prefix";
// Stats prefix for the Mongo Proxy network filter
const std::string MONGO_PREFIX = "envoy.mongo_prefix";
// Request command for the Mongo Proxy network filter
const std::string MONGO_CMD = "envoy.mongo_cmd";
// Request collection for the Mongo Proxy network filter
const std::string MONGO_COLLECTION = "envoy.mongo_collection";
// Request callsite for the Mongo Proxy network filter
const std::string MONGO_CALLSITE = "envoy.mongo_callsite";
// Stats prefix for the Ratelimit network filter
const std::string RATELIMIT_PREFIX = "envoy.ratelimit_prefix";
// Stats prefix for the Local Ratelimit network filter
const std::string LOCAL_HTTP_RATELIMIT_PREFIX = "envoy.local_http_ratelimit_prefix";
const std::string LOCAL_NETWORK_RATELIMIT_PREFIX = "envoy.local_network_ratelimit_prefix";
// Stats prefix for the Local Ratelimit listener filter
const std::string LOCAL_LISTENER_RATELIMIT_PREFIX = "envoy.local_listener_ratelimit_prefix";
// Stats prefix for the dns filter
const std::string DNS_FILTER_PREFIX = "envoy.dns_filter_prefix";
// Stats prefix for the Connection limit filter
const std::string CONNECTION_LIMIT_PREFIX = "envoy.connection_limit_prefix";
// Stats prefix for the RBAC network filter
const std::string RBAC_PREFIX = "envoy.rbac_prefix";
// Stats prefix for the RBAC http filter
const std::string RBAC_HTTP_PREFIX = "envoy.rbac_http_prefix";
// Policy name for the RBAC http filter
const std::string RBAC_POLICY_NAME = "envoy.rbac_policy_name";
// Stats prefix for the TCP Proxy network filter
const std::string TCP_PREFIX = "envoy.tcp_prefix";
// Stats prefix for the UDP Proxy network filter
const std::string UDP_PREFIX = "envoy.udp_prefix";
// Downstream cluster for the Fault http filter
const std::string FAULT_DOWNSTREAM_CLUSTER = "envoy.fault_downstream_cluster";
// Operation name for the Dynamo http filter
const std::string DYNAMO_OPERATION = "envoy.dynamo_operation";
// Table name for the Dynamo http filter
const std::string DYNAMO_TABLE = "envoy.dynamo_table";
// Partition ID for the Dynamo http filter
const std::string DYNAMO_PARTITION_ID = "envoy.dynamo_partition_id";
// Request service name GRPC Bridge http filter
const std::string GRPC_BRIDGE_SERVICE = "envoy.grpc_bridge_service";
// Request method name for the GRPC Bridge http filter
const std::string GRPC_BRIDGE_METHOD = "envoy.grpc_bridge_method";
// Request virtual host given by the Router http filter
const std::string VIRTUAL_HOST = "envoy.virtual_host";
// Request virtual cluster given by the Router http filter
const std::string VIRTUAL_CLUSTER = "envoy.virtual_cluster";
// Request response code
const std::string RESPONSE_CODE = "envoy.response_code";
// Request response code class
const std::string RESPONSE_CODE_CLASS = "envoy.response_code_class";
// Route config name for RDS updates
const std::string RDS_ROUTE_CONFIG = "envoy.rds_route_config";
// Scoped route config name for RDS updates
const std::string SCOPED_RDS_CONFIG = "envoy.scoped_rds_config";
// Request route given by the Router http filter
const std::string ROUTE = "envoy.route";
// Stats prefix for the ext_authz HTTP filter
const std::string EXT_AUTHZ_PREFIX = "envoy.ext_authz_prefix";
// Listener manager worker id
const std::string WORKER_ID = "envoy.worker_id";
// Stats prefix for the Thrift Proxy network filter
const std::string THRIFT_PREFIX = "envoy.thrift_prefix";
// Stats prefix for the Redis Proxy network filter
const std::string REDIS_PREFIX = "envoy.redis_prefix";
// Proxy Protocol version for a connection (Proxy Protocol listener filter).
const std::string PROXY_PROTOCOL_VERSION = "envoy.proxy_protocol_version";
// Stats prefix for the proxy protocol listener filter.
const std::string PROXY_PROTOCOL_PREFIX = "envoy.proxy_protocol_prefix";
// Stats prefix for Google GRPC client connections (used by ADS).
const std::string GOOGLE_GRPC_CLIENT_PREFIX = "envoy.google_grpc_client_prefix";
// TLS certificate.
const std::string TLS_CERTIFICATE = "envoy.tls_certificate";
// XDS resource name
const std::string XDS_RESOURCE_NAME = "envoy.xds_resource_name";
// Mapping from the names above to their respective regex strings.
const std::vector<std::pair<std::string, std::string>> name_regex_pairs_;
// Returns the list of descriptors.
const std::vector<Descriptor>& descriptorVec() const { return descriptor_vec_; }
// Returns the list of tokenized descriptors.
const std::vector<TokenizedDescriptor>& tokenizedDescriptorVec() const {
return tokenized_descriptor_vec_;
}
private:
void addRe2(const std::string& name, const std::string& regex, const std::string& substr = "",
const std::string& negative_matching_value = "");
// See class doc for TagExtractorTokensImpl in
// source/common/stats/tag_extractor_impl.h for details on the format of
// tokens.
void addTokenized(const std::string& name, const std::string& tokens);
// Collection of tag descriptors.
std::vector<Descriptor> descriptor_vec_;
// Collection of tokenized tag descriptors.
std::vector<TokenizedDescriptor> tokenized_descriptor_vec_;
using TagNames = ConstSingleton<TagNameValues>;
// This class holds extension points which will always be built into Envoy in
// server mode, but may be excluded from Envoy Mobile.
class ServerBuiltInExtensionValues {
// Extension point for the default listener.
const std::string DEFAULT_LISTENER = "envoy.listener_manager_impl.default";
// Extension point for the validation listener
const std::string VALIDATION_LISTENER = "envoy.listener_manager_impl.validation";
using ServerExtensionValues = ConstSingleton<ServerBuiltInExtensionValues>;
} // namespace Config
} // namespace Envoy