1
#include "source/extensions/http/original_ip_detection/custom_header/config.h"
2

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

            
7
#include "source/common/config/utility.h"
8
#include "source/extensions/http/original_ip_detection/custom_header/custom_header.h"
9

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

            
16
absl::StatusOr<Envoy::Http::OriginalIPDetectionSharedPtr>
17
CustomHeaderIPDetectionFactory::createExtension(const Protobuf::Message& message,
18
5
                                                Server::Configuration::FactoryContext& context) {
19
5
  auto mptr = Envoy::Config::Utility::translateAnyToFactoryConfig(
20
5
      *Envoy::Protobuf::DynamicCastMessage<const Protobuf::Any>(&message),
21
5
      context.messageValidationVisitor(), *this);
22
5
  const auto& proto_config = MessageUtil::downcastAndValidate<
23
5
      const envoy::extensions::http::original_ip_detection::custom_header::v3::CustomHeaderConfig&>(
24
5
      *mptr, context.messageValidationVisitor());
25
5
  return std::make_shared<CustomHeaderIPDetection>(proto_config);
26
5
}
27

            
28
REGISTER_FACTORY(CustomHeaderIPDetectionFactory, Envoy::Http::OriginalIPDetectionFactory);
29

            
30
} // namespace CustomHeader
31
} // namespace OriginalIPDetection
32
} // namespace Http
33
} // namespace Extensions
34
} // namespace Envoy