1
#pragma once
2

            
3
#include "envoy/extensions/http/original_ip_detection/xff/v3/xff.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 Xff {
14

            
15
/**
16
 * Config registration for the x-forwarded-for IP detection extension.
17
 * @see OriginalIPDetectionFactory.
18
 */
19
class XffIPDetectionFactory : 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
10389
  ProtobufTypes::MessagePtr createEmptyConfigProto() override {
26
10389
    return std::make_unique<envoy::extensions::http::original_ip_detection::xff::v3::XffConfig>();
27
10389
  }
28

            
29
10448
  std::string name() const override { return "envoy.http.original_ip_detection.xff"; }
30
};
31

            
32
DECLARE_FACTORY(XffIPDetectionFactory);
33

            
34
} // namespace Xff
35
} // namespace OriginalIPDetection
36
} // namespace Http
37
} // namespace Extensions
38
} // namespace Envoy