1
#pragma once
2

            
3
#include "envoy/stream_info/filter_state.h"
4

            
5
#include "absl/strings/string_view.h"
6

            
7
namespace Envoy {
8
namespace Network {
9

            
10
/**
11
 * Server name to set in the upstream connection. The filters like tcp_proxy should use this
12
 * value to override the server name specified in the upstream cluster, for example to override
13
 * the SNI value in the upstream TLS context.
14
 */
15
class UpstreamServerName : public StreamInfo::FilterState::Object {
16
public:
17
2291
  UpstreamServerName(absl::string_view server_name) : server_name_(server_name) {}
18
2300
  const std::string& value() const { return server_name_; }
19
  absl::optional<std::string> serializeAsString() const override { return server_name_; }
20
  static const std::string& key();
21

            
22
private:
23
  const std::string server_name_;
24
};
25

            
26
} // namespace Network
27
} // namespace Envoy