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

            
3
#include "envoy/extensions/http/original_ip_detection/xff/v3/xff.pb.h"
4
#include "envoy/extensions/http/original_ip_detection/xff/v3/xff.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/xff/xff.h"
9

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

            
16
absl::StatusOr<Envoy::Http::OriginalIPDetectionSharedPtr>
17
XffIPDetectionFactory::createExtension(const Protobuf::Message& message,
18
9956
                                       Server::Configuration::FactoryContext& context) {
19
9956
  auto mptr = Envoy::Config::Utility::translateAnyToFactoryConfig(
20
9956
      dynamic_cast<const Protobuf::Any&>(message), context.messageValidationVisitor(), *this);
21
9956
  const auto& proto_config = MessageUtil::downcastAndValidate<
22
9956
      const envoy::extensions::http::original_ip_detection::xff::v3::XffConfig&>(
23
9956
      *mptr, context.messageValidationVisitor());
24
9956
  return XffIPDetection::create(proto_config);
25
9956
}
26

            
27
REGISTER_FACTORY(XffIPDetectionFactory, Envoy::Http::OriginalIPDetectionFactory);
28

            
29
} // namespace Xff
30
} // namespace OriginalIPDetection
31
} // namespace Http
32
} // namespace Extensions
33
} // namespace Envoy