Line data Source code
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 : Envoy::Http::OriginalIPDetectionSharedPtr 17 : CustomHeaderIPDetectionFactory::createExtension(const Protobuf::Message& message, 18 0 : Server::Configuration::FactoryContext& context) { 19 0 : auto mptr = Envoy::Config::Utility::translateAnyToFactoryConfig( 20 0 : dynamic_cast<const ProtobufWkt::Any&>(message), context.messageValidationVisitor(), *this); 21 0 : const auto& proto_config = MessageUtil::downcastAndValidate< 22 0 : const envoy::extensions::http::original_ip_detection::custom_header::v3::CustomHeaderConfig&>( 23 0 : *mptr, context.messageValidationVisitor()); 24 0 : return std::make_shared<CustomHeaderIPDetection>(proto_config); 25 0 : } 26 : 27 : REGISTER_FACTORY(CustomHeaderIPDetectionFactory, Envoy::Http::OriginalIPDetectionFactory); 28 : 29 : } // namespace CustomHeader 30 : } // namespace OriginalIPDetection 31 : } // namespace Http 32 : } // namespace Extensions 33 : } // namespace Envoy