1
#pragma once
2

            
3
#include "envoy/extensions/http/original_ip_detection/custom_header/v3/custom_header.pb.h"
4
#include "envoy/http/original_ip_detection.h"
5
#include "envoy/registry/registry.h"
6

            
7
#include "source/common/protobuf/protobuf.h"
8

            
9
namespace Envoy {
10
namespace Extensions {
11
namespace Http {
12
namespace OriginalIPDetection {
13
namespace CustomHeader {
14

            
15
/**
16
 * Config registration for the custom header IP detection extension.
17
 * @see OriginalIPDetectionFactory.
18
 */
19
class CustomHeaderIPDetectionFactory : public Envoy::Http::OriginalIPDetectionFactory {
20
public:
21
  absl::StatusOr<Envoy::Http::OriginalIPDetectionSharedPtr>
22
  createExtension(const Protobuf::Message& message,
23
                  Server::Configuration::FactoryContext& context) override;
24

            
25
11
  ProtobufTypes::MessagePtr createEmptyConfigProto() override {
26
11
    return std::make_unique<
27
11
        envoy::extensions::http::original_ip_detection::custom_header::v3::CustomHeaderConfig>();
28
11
  }
29

            
30
9
  std::string name() const override { return "envoy.http.original_ip_detection.custom_header"; }
31
};
32

            
33
DECLARE_FACTORY(CustomHeaderIPDetectionFactory);
34

            
35
} // namespace CustomHeader
36
} // namespace OriginalIPDetection
37
} // namespace Http
38
} // namespace Extensions
39
} // namespace Envoy