forked from envoyproxy/envoy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
HCM: add support for IP detection extensions
This is a follow-up to: envoyproxy#14432 (comment) After that PR, it's no longer possible (unless you do a dynamic_cast) to set the remote address from a filter. This is something that we need to do because we have specialized logic for this (XFF doesn't work for us). So this adds an extension point which will allow us to push that logic down to ConnectionManagerUtility::mutateRequestHeaders() where it belongs. Signed-off-by: Raul Gutierrez Segales <[email protected]>
- Loading branch information
Raul Gutierrez Segales
committed
Jan 28, 2021
1 parent
268b94b
commit 2be9bdd
Showing
15 changed files
with
183 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 14 additions & 1 deletion
15
.../extensions/filters/network/http_connection_manager/v4alpha/http_connection_manager.proto
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 11 additions & 1 deletion
12
...envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.proto
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
15 changes: 14 additions & 1 deletion
15
.../extensions/filters/network/http_connection_manager/v4alpha/http_connection_manager.proto
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#pragma once | ||
|
||
#include <memory> | ||
#include <string> | ||
|
||
#include "envoy/common/pure.h" | ||
#include "envoy/http/header_map.h" | ||
|
||
namespace Envoy { | ||
namespace Http { | ||
|
||
/** | ||
* Interface class for IP detection extensions. | ||
*/ | ||
class IPDetectionExtension { | ||
public: | ||
virtual ~IPDetectionExtension() = default; | ||
|
||
/** | ||
* Detect the final remote address if any. | ||
* | ||
* @param request_headers supplies the incoming request headers. | ||
*/ | ||
virtual Network::Address::InstanceConstSharedPtr | ||
detect(Http::RequestHeaderMap& request_headers) PURE; | ||
}; | ||
|
||
using IPDetectionExtensionSharedPtr = std::shared_ptr<IPDetectionExtension>; | ||
|
||
/* | ||
* A factory for creating IP detection extensions. | ||
*/ | ||
class IPDetectionExtensionFactory : public Envoy::Config::TypedFactory { | ||
public: | ||
~IPDetectionExtensionFactory() override = default; | ||
|
||
/** | ||
* Creates a particular Extension implementation. | ||
* | ||
* @param config supplies the configuration for the IP detection extension. | ||
* @return IPDetectionExtensionSharedPtr the extension instance. | ||
*/ | ||
virtual IPDetectionExtensionSharedPtr createExtension(const Protobuf::Message& config) const PURE; | ||
}; | ||
|
||
using IPDetectionExtensionFactoryPtr = std::unique_ptr<IPDetectionExtensionFactory>; | ||
|
||
} // namespace Http | ||
} // namespace Envoy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters