/proc/self/cwd/source/server/admin/admin.h
Line | Count | Source (jump to first uncovered line) |
1 | | #pragma once |
2 | | |
3 | | #include <chrono> |
4 | | #include <functional> |
5 | | #include <list> |
6 | | #include <string> |
7 | | #include <utility> |
8 | | #include <vector> |
9 | | |
10 | | #include "envoy/http/filter.h" |
11 | | #include "envoy/http/request_id_extension.h" |
12 | | #include "envoy/network/filter.h" |
13 | | #include "envoy/network/listen_socket.h" |
14 | | #include "envoy/server/admin.h" |
15 | | #include "envoy/server/instance.h" |
16 | | #include "envoy/server/listener_manager.h" |
17 | | #include "envoy/upstream/outlier_detection.h" |
18 | | #include "envoy/upstream/resource_manager.h" |
19 | | |
20 | | #include "source/common/common/assert.h" |
21 | | #include "source/common/common/basic_resource_impl.h" |
22 | | #include "source/common/common/empty_string.h" |
23 | | #include "source/common/common/logger.h" |
24 | | #include "source/common/common/macros.h" |
25 | | #include "source/common/http/conn_manager_config.h" |
26 | | #include "source/common/http/conn_manager_impl.h" |
27 | | #include "source/common/http/date_provider_impl.h" |
28 | | #include "source/common/http/default_server_string.h" |
29 | | #include "source/common/http/http1/codec_stats.h" |
30 | | #include "source/common/http/http2/codec_stats.h" |
31 | | #include "source/common/http/request_id_extension_impl.h" |
32 | | #include "source/common/http/utility.h" |
33 | | #include "source/common/network/connection_balancer_impl.h" |
34 | | #include "source/common/network/raw_buffer_socket.h" |
35 | | #include "source/common/router/scoped_config_impl.h" |
36 | | #include "source/common/stats/isolated_store_impl.h" |
37 | | #include "source/extensions/filters/http/common/pass_through_filter.h" |
38 | | #include "source/server/admin/admin_factory_context.h" |
39 | | #include "source/server/admin/admin_filter.h" |
40 | | #include "source/server/admin/clusters_handler.h" |
41 | | #include "source/server/admin/config_dump_handler.h" |
42 | | #include "source/server/admin/config_tracker_impl.h" |
43 | | #include "source/server/admin/init_dump_handler.h" |
44 | | #include "source/server/admin/listeners_handler.h" |
45 | | #include "source/server/admin/logs_handler.h" |
46 | | #include "source/server/admin/profiling_handler.h" |
47 | | #include "source/server/admin/runtime_handler.h" |
48 | | #include "source/server/admin/server_cmd_handler.h" |
49 | | #include "source/server/admin/server_info_handler.h" |
50 | | #include "source/server/admin/stats_handler.h" |
51 | | #include "source/server/null_overload_manager.h" |
52 | | |
53 | | #include "absl/strings/string_view.h" |
54 | | |
55 | | namespace Envoy { |
56 | | namespace Server { |
57 | | |
58 | | class AdminInternalAddressConfig : public Http::InternalAddressConfig { |
59 | 0 | bool isInternalAddress(const Network::Address::Instance&) const override { return false; } |
60 | | }; |
61 | | |
62 | | /** |
63 | | * Implementation of Server::Admin. |
64 | | */ |
65 | | class AdminImpl : public Admin, |
66 | | public Network::FilterChainManager, |
67 | | public Network::FilterChainFactory, |
68 | | public Http::FilterChainFactory, |
69 | | public Http::ConnectionManagerConfig, |
70 | | public std::enable_shared_from_this<AdminImpl>, |
71 | | Logger::Loggable<Logger::Id::admin> { |
72 | | public: |
73 | | AdminImpl(const std::string& profile_path, Server::Instance& server, |
74 | | bool ignore_global_conn_limit); |
75 | | |
76 | | Http::Code runCallback(Http::ResponseHeaderMap& response_headers, Buffer::Instance& response, |
77 | | AdminStream& admin_stream); |
78 | 3.93k | const Network::Socket& socket() override { return *socket_; } |
79 | 0 | Network::Socket& mutableSocket() { return *socket_; } |
80 | | |
81 | 1.97k | Configuration::FactoryContext& factoryContext() { return factory_context_; } |
82 | | |
83 | | // Server::Admin |
84 | | // TODO(jsedgwick) These can be managed with a generic version of ConfigTracker. |
85 | | // Wins would be no manual removeHandler() and code reuse. |
86 | | // |
87 | | // The prefix must start with "/" and contain at least one additional character. |
88 | | bool addHandler(const std::string& prefix, const std::string& help_text, HandlerCb callback, |
89 | | bool removable, bool mutates_server_state, |
90 | | const ParamDescriptorVec& params = {}) override; |
91 | | bool addStreamingHandler(const std::string& prefix, const std::string& help_text, |
92 | | GenRequestFn callback, bool removable, bool mutates_server_state, |
93 | | const ParamDescriptorVec& params = {}) override; |
94 | | bool removeHandler(const std::string& prefix) override; |
95 | | ConfigTracker& getConfigTracker() override; |
96 | | |
97 | | void startHttpListener(std::list<AccessLog::InstanceSharedPtr> access_logs, |
98 | | Network::Address::InstanceConstSharedPtr address, |
99 | | Network::Socket::OptionsSharedPtr socket_options) override; |
100 | 0 | uint32_t concurrency() const override { return server_.options().concurrency(); } |
101 | | |
102 | | // Network::FilterChainManager |
103 | | const Network::FilterChain* findFilterChain(const Network::ConnectionSocket&, |
104 | 0 | const StreamInfo::StreamInfo&) const override { |
105 | 0 | return admin_filter_chain_.get(); |
106 | 0 | } |
107 | | |
108 | | // Network::FilterChainFactory |
109 | | bool |
110 | | createNetworkFilterChain(Network::Connection& connection, |
111 | | const Filter::NetworkFilterFactoriesList& filter_factories) override; |
112 | 0 | bool createListenerFilterChain(Network::ListenerFilterManager&) override { return true; } |
113 | | void createUdpListenerFilterChain(Network::UdpListenerFilterManager&, |
114 | 0 | Network::UdpReadFilterCallbacks&) override {} |
115 | 0 | bool createQuicListenerFilterChain(Network::QuicListenerFilterManager&) override { return true; } |
116 | | |
117 | | // Http::FilterChainFactory |
118 | | bool createFilterChain(Http::FilterChainManager& manager, bool, |
119 | | const Http::FilterChainOptions&) const override; |
120 | | bool createUpgradeFilterChain(absl::string_view, const Http::FilterChainFactory::UpgradeMap*, |
121 | | Http::FilterChainManager&, |
122 | 0 | const Http::FilterChainOptions&) const override { |
123 | 0 | return false; |
124 | 0 | } |
125 | | |
126 | | // Http::ConnectionManagerConfig |
127 | 0 | const Http::RequestIDExtensionSharedPtr& requestIDExtension() override { |
128 | 0 | return request_id_extension_; |
129 | 0 | } |
130 | 0 | const std::list<AccessLog::InstanceSharedPtr>& accessLogs() override { return access_logs_; } |
131 | 0 | bool flushAccessLogOnNewRequest() override { return flush_access_log_on_new_request_; } |
132 | 0 | bool flushAccessLogOnTunnelSuccessfullyEstablished() const override { return false; } |
133 | 0 | const absl::optional<std::chrono::milliseconds>& accessLogFlushInterval() override { |
134 | 0 | return null_access_log_flush_interval_; |
135 | 0 | } |
136 | | Http::ServerConnectionPtr createCodec(Network::Connection& connection, |
137 | | const Buffer::Instance& data, |
138 | | Http::ServerConnectionCallbacks& callbacks, |
139 | | Server::OverloadManager& overload_manager) override; |
140 | 0 | Http::DateProvider& dateProvider() override { return date_provider_; } |
141 | 0 | std::chrono::milliseconds drainTimeout() const override { return std::chrono::milliseconds(100); } |
142 | 0 | Http::FilterChainFactory& filterFactory() override { return *this; } |
143 | 0 | bool generateRequestId() const override { return false; } |
144 | 0 | bool preserveExternalRequestId() const override { return false; } |
145 | 0 | bool alwaysSetRequestIdInResponse() const override { return false; } |
146 | 0 | absl::optional<std::chrono::milliseconds> idleTimeout() const override { return idle_timeout_; } |
147 | 0 | bool isRoutable() const override { return false; } |
148 | 0 | absl::optional<std::chrono::milliseconds> maxConnectionDuration() const override { |
149 | 0 | return max_connection_duration_; |
150 | 0 | } |
151 | 0 | bool http1SafeMaxConnectionDuration() const override { return false; } |
152 | 0 | uint32_t maxRequestHeadersKb() const override { return max_request_headers_kb_; } |
153 | 0 | uint32_t maxRequestHeadersCount() const override { return max_request_headers_count_; } |
154 | 0 | std::chrono::milliseconds streamIdleTimeout() const override { return {}; } |
155 | 0 | std::chrono::milliseconds requestTimeout() const override { return {}; } |
156 | 0 | std::chrono::milliseconds requestHeadersTimeout() const override { return {}; } |
157 | 0 | std::chrono::milliseconds delayedCloseTimeout() const override { return {}; } |
158 | 0 | absl::optional<std::chrono::milliseconds> maxStreamDuration() const override { |
159 | 0 | return max_stream_duration_; |
160 | 0 | } |
161 | 0 | Router::RouteConfigProvider* routeConfigProvider() override { return &route_config_provider_; } |
162 | 0 | Config::ConfigProvider* scopedRouteConfigProvider() override { |
163 | 0 | return &scoped_route_config_provider_; |
164 | 0 | } |
165 | 0 | OptRef<const Router::ScopeKeyBuilder> scopeKeyBuilder() override { return scope_key_builder_; } |
166 | 0 | const std::string& serverName() const override { return Http::DefaultServerString::get(); } |
167 | 0 | const absl::optional<std::string>& schemeToSet() const override { return scheme_; } |
168 | 0 | bool shouldSchemeMatchUpstream() const override { return scheme_match_upstream_; } |
169 | | HttpConnectionManagerProto::ServerHeaderTransformation |
170 | 0 | serverHeaderTransformation() const override { |
171 | 0 | return HttpConnectionManagerProto::OVERWRITE; |
172 | 0 | } |
173 | 0 | Http::ConnectionManagerStats& stats() override { return stats_; } |
174 | 0 | Http::ConnectionManagerTracingStats& tracingStats() override { return tracing_stats_; } |
175 | 0 | bool useRemoteAddress() const override { return true; } |
176 | 0 | const Http::InternalAddressConfig& internalAddressConfig() const override { |
177 | 0 | return internal_address_config_; |
178 | 0 | } |
179 | 0 | uint32_t xffNumTrustedHops() const override { return 0; } |
180 | 0 | bool skipXffAppend() const override { return false; } |
181 | 0 | const std::string& via() const override { return EMPTY_STRING; } |
182 | 0 | Http::ForwardClientCertType forwardClientCert() const override { |
183 | 0 | return Http::ForwardClientCertType::Sanitize; |
184 | 0 | } |
185 | 0 | const std::vector<Http::ClientCertDetailsType>& setCurrentClientCertDetails() const override { |
186 | 0 | return set_current_client_cert_details_; |
187 | 0 | } |
188 | | const Network::Address::Instance& localAddress() override; |
189 | 0 | const absl::optional<std::string>& userAgent() override { return user_agent_; } |
190 | 0 | Tracing::TracerSharedPtr tracer() override { return nullptr; } |
191 | 0 | const Http::TracingConnectionManagerConfig* tracingConfig() override { return nullptr; } |
192 | 0 | Http::ConnectionManagerListenerStats& listenerStats() override { return listener_->stats_; } |
193 | 0 | bool proxy100Continue() const override { return false; } |
194 | 0 | bool streamErrorOnInvalidHttpMessaging() const override { return false; } |
195 | 0 | const Http::Http1Settings& http1Settings() const override { return http1_settings_; } |
196 | 0 | bool shouldNormalizePath() const override { return true; } |
197 | 0 | bool shouldMergeSlashes() const override { return true; } |
198 | 0 | bool shouldStripTrailingHostDot() const override { return false; } |
199 | 0 | Http::StripPortType stripPortType() const override { return Http::StripPortType::None; } |
200 | | envoy::config::core::v3::HttpProtocolOptions::HeadersWithUnderscoresAction |
201 | 0 | headersWithUnderscoresAction() const override { |
202 | 0 | return envoy::config::core::v3::HttpProtocolOptions::ALLOW; |
203 | 0 | } |
204 | 0 | const LocalReply::LocalReply& localReply() const override { return *local_reply_; } |
205 | | envoy::extensions::filters::network::http_connection_manager::v3::HttpConnectionManager:: |
206 | | PathWithEscapedSlashesAction |
207 | 0 | pathWithEscapedSlashesAction() const override { |
208 | 0 | return envoy::extensions::filters::network::http_connection_manager::v3::HttpConnectionManager:: |
209 | 0 | KEEP_UNCHANGED; |
210 | 0 | } |
211 | | const std::vector<Http::OriginalIPDetectionSharedPtr>& |
212 | 0 | originalIpDetectionExtensions() const override { |
213 | 0 | return detection_extensions_; |
214 | 0 | } |
215 | 0 | const std::vector<Http::EarlyHeaderMutationPtr>& earlyHeaderMutationExtensions() const override { |
216 | 0 | return early_header_mutations_; |
217 | 0 | } |
218 | | Http::Code request(absl::string_view path_and_query, absl::string_view method, |
219 | | Http::ResponseHeaderMap& response_headers, std::string& body) override; |
220 | | void closeSocket() override; |
221 | | void addListenerToHandler(Network::ConnectionHandler* handler) override; |
222 | | |
223 | 0 | uint64_t maxRequestsPerConnection() const override { return 0; } |
224 | 0 | const HttpConnectionManagerProto::ProxyStatusConfig* proxyStatusConfig() const override { |
225 | 0 | return proxy_status_config_.get(); |
226 | 0 | } |
227 | | Http::ServerHeaderValidatorPtr |
228 | 0 | makeHeaderValidator([[maybe_unused]] Http::Protocol protocol) override { |
229 | | #ifdef ENVOY_ENABLE_UHV |
230 | | ENVOY_BUG(header_validator_factory_ != nullptr, |
231 | | "Admin HCM config can not have null UHV factory."); |
232 | | return header_validator_factory_ ? header_validator_factory_->createServerHeaderValidator( |
233 | | protocol, getHeaderValidatorStats(protocol)) |
234 | | : nullptr; |
235 | | #else |
236 | 0 | return nullptr; |
237 | 0 | #endif |
238 | 0 | } |
239 | 0 | bool appendLocalOverload() const override { return false; } |
240 | 0 | bool appendXForwardedPort() const override { return false; } |
241 | 0 | bool addProxyProtocolConnectionState() const override { return true; } |
242 | | |
243 | | private: |
244 | | friend class AdminTestingPeer; |
245 | | |
246 | | #ifdef ENVOY_ENABLE_UHV |
247 | | ::Envoy::Http::HeaderValidatorStats& getHeaderValidatorStats(Http::Protocol protocol); |
248 | | #endif |
249 | | |
250 | | RequestPtr makeRequest(AdminStream& admin_stream) const override; |
251 | | |
252 | | /** |
253 | | * Creates a UrlHandler structure from a non-chunked callback. |
254 | | */ |
255 | | UrlHandler makeHandler(const std::string& prefix, const std::string& help_text, |
256 | | HandlerCb callback, bool removable, bool mutates_state, |
257 | | const ParamDescriptorVec& params = {}); |
258 | | |
259 | | /** |
260 | | * Creates a URL prefix bound to chunked handler. Handler is expected to |
261 | | * supply a method makeRequest(AdminStream&). |
262 | | * |
263 | | * @param prefix the prefix to register |
264 | | * @param help_text a help text ot display in a table in the admin home page |
265 | | * @param handler the Handler object for the admin subsystem, supplying makeContext(). |
266 | | * @param removeable indicates whether the handler can be removed after being added |
267 | | * @param mutates_state indicates whether the handler will mutate state and therefore |
268 | | * must be accessed via HTTP POST rather than GET. |
269 | | * @return the UrlHandler. |
270 | | */ |
271 | | template <class Handler> |
272 | | UrlHandler makeStreamingHandler(const std::string& prefix, const std::string& help_text, |
273 | | Handler& handler, bool removable, bool mutates_state) { |
274 | | return {prefix, help_text, |
275 | | [&handler](AdminStream& admin_stream) -> Admin::RequestPtr { |
276 | | return handler.makeRequest(admin_stream); |
277 | | }, |
278 | | removable, mutates_state}; |
279 | | } |
280 | | |
281 | | /** |
282 | | * Implementation of RouteConfigProvider that returns a static null route config. |
283 | | */ |
284 | | struct NullRouteConfigProvider : public Router::RouteConfigProvider { |
285 | | NullRouteConfigProvider(TimeSource& time_source); |
286 | | |
287 | | // Router::RouteConfigProvider |
288 | 0 | Rds::ConfigConstSharedPtr config() const override { return config_; } |
289 | 0 | const absl::optional<ConfigInfo>& configInfo() const override { return config_info_; } |
290 | 0 | SystemTime lastUpdated() const override { return time_source_.systemTime(); } |
291 | 0 | absl::Status onConfigUpdate() override { return absl::OkStatus(); } |
292 | 0 | Router::ConfigConstSharedPtr configCast() const override { return config_; } |
293 | | void requestVirtualHostsUpdate(const std::string&, Event::Dispatcher&, |
294 | 0 | std::weak_ptr<Http::RouteConfigUpdatedCallback>) override {} |
295 | | |
296 | | Router::ConfigConstSharedPtr config_; |
297 | | absl::optional<ConfigInfo> config_info_; |
298 | | TimeSource& time_source_; |
299 | | }; |
300 | | |
301 | | /** |
302 | | * Implementation of ScopedRouteConfigProvider that returns a null scoped route config. |
303 | | */ |
304 | | struct NullScopedRouteConfigProvider : public Config::ConfigProvider { |
305 | | NullScopedRouteConfigProvider(TimeSource& time_source) |
306 | | : config_(std::make_shared<const Router::NullScopedConfigImpl>()), |
307 | 4.47k | time_source_(time_source) {} |
308 | | |
309 | 4.47k | ~NullScopedRouteConfigProvider() override = default; |
310 | | |
311 | | // Config::ConfigProvider |
312 | 0 | SystemTime lastUpdated() const override { return time_source_.systemTime(); } |
313 | 0 | ConfigConstSharedPtr getConfig() const override { return config_; } |
314 | 0 | ApiType apiType() const override { return ApiType::Full; } |
315 | 0 | ConfigProtoVector getConfigProtos() const override { return {}; } |
316 | | |
317 | | Router::ScopedConfigConstSharedPtr config_; |
318 | | TimeSource& time_source_; |
319 | | }; |
320 | | |
321 | | /** |
322 | | * Implementation of ScopeKeyBuilder that returns a null scope key. |
323 | | */ |
324 | | struct NullScopeKeyBuilder : public Router::ScopeKeyBuilder { |
325 | 4.47k | NullScopeKeyBuilder() = default; |
326 | | ~NullScopeKeyBuilder() override = default; |
327 | | |
328 | 0 | Router::ScopeKeyPtr computeScopeKey(const Http::HeaderMap&) const override { return nullptr; }; |
329 | | }; |
330 | | |
331 | | std::vector<const UrlHandler*> sortedHandlers() const; |
332 | | envoy::admin::v3::ServerInfo::State serverState(); |
333 | | |
334 | | /** |
335 | | * URL handlers. |
336 | | */ |
337 | | Http::Code handlerAdminHome(Http::ResponseHeaderMap& response_headers, Buffer::Instance& response, |
338 | | AdminStream&); |
339 | | |
340 | | Http::Code handlerHelp(Http::ResponseHeaderMap& response_headers, Buffer::Instance& response, |
341 | | AdminStream&); |
342 | | void getHelp(Buffer::Instance& response) const; |
343 | | |
344 | | class AdminListenSocketFactory : public Network::ListenSocketFactory { |
345 | | public: |
346 | 1.97k | AdminListenSocketFactory(Network::SocketSharedPtr socket) : socket_(socket) {} |
347 | | |
348 | | // Network::ListenSocketFactory |
349 | 1.97k | Network::Socket::Type socketType() const override { return socket_->socketType(); } |
350 | 1.97k | const Network::Address::InstanceConstSharedPtr& localAddress() const override { |
351 | 1.97k | return socket_->connectionInfoProvider().localAddress(); |
352 | 1.97k | } |
353 | 1.97k | Network::SocketSharedPtr getListenSocket(uint32_t) override { |
354 | | // This is only supposed to be called once. |
355 | 1.97k | RELEASE_ASSERT(!socket_create_, "AdminListener's socket shouldn't be shared."); |
356 | 1.97k | socket_create_ = true; |
357 | 1.97k | return socket_; |
358 | 1.97k | } |
359 | 0 | Network::ListenSocketFactoryPtr clone() const override { return nullptr; } |
360 | 0 | void closeAllSockets() override {} |
361 | 0 | absl::Status doFinalPreWorkerInit() override { return absl::OkStatus(); } |
362 | | |
363 | | private: |
364 | | Network::SocketSharedPtr socket_; |
365 | | bool socket_create_{false}; |
366 | | }; |
367 | | |
368 | | class AdminListener : public Network::ListenerConfig { |
369 | | public: |
370 | | AdminListener(AdminImpl& parent, Stats::Scope& listener_scope) |
371 | | : parent_(parent), name_("admin"), scope_(listener_scope), |
372 | | stats_(Http::ConnectionManagerImpl::generateListenerStats("http.admin.", scope_)), |
373 | 1.97k | init_manager_(nullptr), ignore_global_conn_limit_(parent.ignore_global_conn_limit_) {} |
374 | | |
375 | | // Network::ListenerConfig |
376 | 0 | Network::FilterChainManager& filterChainManager() override { return parent_; } |
377 | 0 | Network::FilterChainFactory& filterChainFactory() override { return parent_; } |
378 | 3.95k | std::vector<Network::ListenSocketFactoryPtr>& listenSocketFactories() override { |
379 | 3.95k | return parent_.socket_factories_; |
380 | 3.95k | } |
381 | 1.97k | bool bindToPort() const override { return true; } |
382 | 0 | bool handOffRestoredDestinationConnections() const override { return false; } |
383 | 0 | uint32_t perConnectionBufferLimitBytes() const override { return 0; } |
384 | 1.97k | std::chrono::milliseconds listenerFiltersTimeout() const override { return {}; } |
385 | 1.97k | bool continueOnListenerFiltersTimeout() const override { return false; } |
386 | 31.6k | Stats::Scope& listenerScope() override { return scope_; } |
387 | 5.92k | uint64_t listenerTag() const override { return 0; } |
388 | 0 | const std::string& name() const override { return name_; } |
389 | 0 | const Network::ListenerInfoConstSharedPtr& listenerInfo() const override { |
390 | 0 | return parent_.listener_info_; |
391 | 0 | } |
392 | 0 | Network::UdpListenerConfigOptRef udpListenerConfig() override { return {}; } |
393 | 1.97k | Network::InternalListenerConfigOptRef internalListenerConfig() override { return {}; } |
394 | 1.97k | Network::ConnectionBalancer& connectionBalancer(const Network::Address::Instance&) override { |
395 | 1.97k | return connection_balancer_; |
396 | 1.97k | } |
397 | 0 | ResourceLimit& openConnections() override { return open_connections_; } |
398 | 0 | const std::vector<AccessLog::InstanceSharedPtr>& accessLogs() const override { |
399 | 0 | return empty_access_logs_; |
400 | 0 | } |
401 | 0 | uint32_t tcpBacklogSize() const override { return ENVOY_TCP_BACKLOG_SIZE; } |
402 | 1.97k | uint32_t maxConnectionsToAcceptPerSocketEvent() const override { |
403 | 1.97k | return Network::DefaultMaxConnectionsToAcceptPerSocketEvent; |
404 | 1.97k | } |
405 | 0 | Init::Manager& initManager() override { return *init_manager_; } |
406 | 1.97k | bool ignoreGlobalConnLimit() const override { return ignore_global_conn_limit_; } |
407 | 5.92k | bool shouldBypassOverloadManager() const override { return true; } |
408 | | |
409 | | AdminImpl& parent_; |
410 | | const std::string name_; |
411 | | Stats::Scope& scope_; |
412 | | Http::ConnectionManagerListenerStats stats_; |
413 | | Network::NopConnectionBalancerImpl connection_balancer_; |
414 | | BasicResourceLimitImpl open_connections_; |
415 | | |
416 | | private: |
417 | | const std::vector<AccessLog::InstanceSharedPtr> empty_access_logs_; |
418 | | std::unique_ptr<Init::Manager> init_manager_; |
419 | | const bool ignore_global_conn_limit_; |
420 | | }; |
421 | | using AdminListenerPtr = std::unique_ptr<AdminListener>; |
422 | | |
423 | | class AdminFilterChain : public Network::FilterChain { |
424 | | public: |
425 | | // We can't use the default constructor because transport_socket_factory_ doesn't have a |
426 | | // default constructor. |
427 | 4.47k | AdminFilterChain() {} // NOLINT(modernize-use-equals-default) |
428 | | |
429 | | // Network::FilterChain |
430 | 0 | const Network::DownstreamTransportSocketFactory& transportSocketFactory() const override { |
431 | 0 | return transport_socket_factory_; |
432 | 0 | } |
433 | | |
434 | 0 | std::chrono::milliseconds transportSocketConnectTimeout() const override { |
435 | 0 | return std::chrono::milliseconds::zero(); |
436 | 0 | } |
437 | | |
438 | 0 | const Filter::NetworkFilterFactoriesList& networkFilterFactories() const override { |
439 | 0 | return empty_network_filter_factory_; |
440 | 0 | } |
441 | | |
442 | 0 | absl::string_view name() const override { return "admin"; } |
443 | | |
444 | | private: |
445 | | const Network::RawBufferSocketFactory transport_socket_factory_; |
446 | | const Filter::NetworkFilterFactoriesList empty_network_filter_factory_; |
447 | | }; |
448 | | |
449 | | Server::Instance& server_; |
450 | | const Network::ListenerInfoConstSharedPtr listener_info_; |
451 | | AdminFactoryContext factory_context_; |
452 | | Http::RequestIDExtensionSharedPtr request_id_extension_; |
453 | | std::list<AccessLog::InstanceSharedPtr> access_logs_; |
454 | | const bool flush_access_log_on_new_request_ = false; |
455 | | const absl::optional<std::chrono::milliseconds> null_access_log_flush_interval_; |
456 | | const std::string profile_path_; |
457 | | Http::ConnectionManagerStats stats_; |
458 | | NullOverloadManager null_overload_manager_; |
459 | | // Note: this is here to essentially blackhole the tracing stats since they aren't used in the |
460 | | // Admin case. |
461 | | Stats::IsolatedStoreImpl no_op_store_; |
462 | | Http::ConnectionManagerTracingStats tracing_stats_; |
463 | | NullRouteConfigProvider route_config_provider_; |
464 | | NullScopedRouteConfigProvider scoped_route_config_provider_; |
465 | | NullScopeKeyBuilder scope_key_builder_; |
466 | | Server::ClustersHandler clusters_handler_; |
467 | | Server::ConfigDumpHandler config_dump_handler_; |
468 | | Server::InitDumpHandler init_dump_handler_; |
469 | | Server::StatsHandler stats_handler_; |
470 | | Server::LogsHandler logs_handler_; |
471 | | Server::ProfilingHandler profiling_handler_; |
472 | | Server::TcmallocProfilingHandler tcmalloc_profiling_handler_; |
473 | | Server::RuntimeHandler runtime_handler_; |
474 | | Server::ListenersHandler listeners_handler_; |
475 | | Server::ServerCmdHandler server_cmd_handler_; |
476 | | Server::ServerInfoHandler server_info_handler_; |
477 | | std::list<UrlHandler> handlers_; |
478 | | const uint32_t max_request_headers_kb_{Http::DEFAULT_MAX_REQUEST_HEADERS_KB}; |
479 | | const uint32_t max_request_headers_count_{Http::DEFAULT_MAX_HEADERS_COUNT}; |
480 | | absl::optional<std::chrono::milliseconds> idle_timeout_; |
481 | | absl::optional<std::chrono::milliseconds> max_connection_duration_; |
482 | | absl::optional<std::chrono::milliseconds> max_stream_duration_; |
483 | | absl::optional<std::string> user_agent_; |
484 | | Http::SlowDateProviderImpl date_provider_; |
485 | | std::vector<Http::ClientCertDetailsType> set_current_client_cert_details_; |
486 | | Http::Http1Settings http1_settings_; |
487 | | Http::Http1::CodecStats::AtomicPtr http1_codec_stats_; |
488 | | Http::Http2::CodecStats::AtomicPtr http2_codec_stats_; |
489 | | ConfigTrackerImpl config_tracker_; |
490 | | const Network::FilterChainSharedPtr admin_filter_chain_; |
491 | | Network::SocketSharedPtr socket_; |
492 | | std::vector<Network::ListenSocketFactoryPtr> socket_factories_; |
493 | | AdminListenerPtr listener_; |
494 | | const AdminInternalAddressConfig internal_address_config_; |
495 | | const LocalReply::LocalReplyPtr local_reply_; |
496 | | const std::vector<Http::OriginalIPDetectionSharedPtr> detection_extensions_{}; |
497 | | const std::vector<Http::EarlyHeaderMutationPtr> early_header_mutations_{}; |
498 | | const absl::optional<std::string> scheme_{}; |
499 | | const bool scheme_match_upstream_ = false; |
500 | | const bool ignore_global_conn_limit_; |
501 | | std::unique_ptr<HttpConnectionManagerProto::ProxyStatusConfig> proxy_status_config_; |
502 | | const Http::HeaderValidatorFactoryPtr header_validator_factory_; |
503 | | }; |
504 | | |
505 | | } // namespace Server |
506 | | } // namespace Envoy |