-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Listener: Add listener filters. #2346
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 9 commits
2fb53f1
11766c4
ee60ccf
6874568
bc51bf8
0a8fd6f
da0c39b
044a089
d97257a
efdf2f1
31ea8a0
c6f4fb2
a7845db
f9c5650
d42ce02
aa81333
add8512
c32fcaa
818858a
228ac19
0703ecc
84854b2
ad6f413
d4b2140
597d05a
1ad7886
8bd512f
dca40d8
ab098f3
d0ad3d5
7f77eb0
4d72b93
07629cb
de46c3b
f047852
13cba72
7d82bbe
61da63f
3503579
b7e16d3
e75f50d
9a2c62a
94751c0
1021213
a390886
ae07e0f
393e2bc
f5c19a9
6b3e81d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -38,6 +38,16 @@ class Dispatcher { | |
| */ | ||
| virtual void clearDeferredDeleteList() PURE; | ||
|
|
||
| /** | ||
| * Create a server connection. | ||
| * @param accept_socket supplies a socket with an open file descriptor and connection metadata | ||
| * to use for the connection. Takes ownership of the accept_socket. | ||
| * @param ssl_ctx supplies the SSL context to use, if not nullptr. | ||
| * @return Network::ConnectionPtr a client connection that is owned by the caller. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "a server connection"
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed! |
||
| */ | ||
| virtual Network::ConnectionPtr createConnection(Network::AcceptSocketPtr&& accept_socket, | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would probably call this
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will change.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is no ServerConnection class, ClientConnection inherits from Connection, so from that viewpoint createConnection() is correct. Hosts also have a createConnection method, so createServerConnection makes grepping the source easier. |
||
| Ssl::Context* ssl_ctx) PURE; | ||
|
|
||
| /** | ||
| * Create a client connection. | ||
| * @param address supplies the address to connect to. | ||
|
|
@@ -85,25 +95,9 @@ class Dispatcher { | |
| * @param listener_options listener configuration options. | ||
| * @return Network::ListenerPtr a new listener that is owned by the caller. | ||
| */ | ||
| virtual Network::ListenerPtr | ||
| createListener(Network::ConnectionHandler& conn_handler, Network::ListenSocket& socket, | ||
| Network::ListenerCallbacks& cb, Stats::Scope& scope, | ||
| const Network::ListenerOptions& listener_options) PURE; | ||
|
|
||
| /** | ||
| * Create a listener on a specific port. | ||
| * @param conn_handler supplies the handler for connections received by the listener | ||
| * @param ssl_ctx supplies the SSL context to use. | ||
| * @param socket supplies the socket to listen on. | ||
| * @param cb supplies the callbacks to invoke for listener events. | ||
| * @param scope supplies the Stats::Scope to use. | ||
| * @param listener_options listener configuration options. | ||
| * @return Network::ListenerPtr a new listener that is owned by the caller. | ||
| */ | ||
| virtual Network::ListenerPtr | ||
| createSslListener(Network::ConnectionHandler& conn_handler, Ssl::ServerContext& ssl_ctx, | ||
| Network::ListenSocket& socket, Network::ListenerCallbacks& cb, | ||
| Stats::Scope& scope, const Network::ListenerOptions& listener_options) PURE; | ||
| virtual Network::ListenerPtr createListener(Network::ListenSocket& socket, | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please fix doc comments above
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK, sorry for the sloppiness... |
||
| Network::ListenerCallbacks& cb, | ||
| bool bind_to_port) PURE; | ||
|
|
||
| /** | ||
| * Allocate a timer. @see Event::Timer for docs on how to use the timer. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,6 +10,11 @@ | |
| #include "envoy/ssl/context.h" | ||
|
|
||
| namespace Envoy { | ||
|
|
||
| namespace Server { | ||
| class Listener; | ||
| } | ||
| // XXX: Move to Server namespace? | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah, from an abstraction level in general we try to make server code depend on common code, but not the other way around. Why was this necessary?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Listener config is defined in the Server namespace (Server::Listener), and the ConnectionHandler's addListener() now takes it as an argument. I did not want to include server headers from here, so I used a bare class declaration (in the correct namespace) to circumvent the need for the include. Could also see if the Listener config class could be moved to the common code.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, let's just move Server::Listener (that interface only) into the Network namespace. That interface doesn't depend on anything else in Server. Please do that in a dedicated PR since it will be just code movement. We can review/merge that quickly and then rebase this.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Network namespace already has a Listener (the abstract base class, so something needs to be renamed. How about renaming the Server::Listener as Network::ListenerConfig, as it is just that, "A configuration for an individual listener", as the comment says?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. +1
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will do this and the filter directory split tomorrow, hopefully. In the meanwhile I updated this PR so that you may continue the review as you please :-) |
||
| namespace Network { | ||
|
|
||
| /** | ||
|
|
@@ -26,28 +31,9 @@ class ConnectionHandler { | |
|
|
||
| /** | ||
| * Adds listener to the handler. | ||
| * @param factory supplies the configuration factory for new connections. | ||
| * @param socket supplies the already bound socket to listen on. | ||
| * @param scope supplies the stats scope to use for listener specific stats. | ||
| * @param listener_tag supplies an opaque tag that can be used to stop or remove the listener. | ||
| * @param listener_options listener configuration options. | ||
| */ | ||
| virtual void addListener(Network::FilterChainFactory& factory, Network::ListenSocket& socket, | ||
| Stats::Scope& scope, uint64_t listener_tag, | ||
| const Network::ListenerOptions& listener_options) PURE; | ||
|
|
||
| /** | ||
| * Adds listener to the handler. | ||
| * @param factory supplies the configuration factory for new connections. | ||
| * @param socket supplies the already bound socket to listen on. | ||
| * @param scope supplies the stats scope to use for listener specific stats. | ||
| * @param listener_tag supplies an opaque tag that can be used to stop or remove the listener. | ||
| * @param listener_options listener configuration options. | ||
| * @param config listener configuration options. | ||
| */ | ||
| virtual void addSslListener(Network::FilterChainFactory& factory, Ssl::ServerContext& ssl_ctx, | ||
| Network::ListenSocket& socket, Stats::Scope& scope, | ||
| uint64_t listener_tag, | ||
| const Network::ListenerOptions& listener_options) PURE; | ||
| virtual void addListener(Server::Listener& config) PURE; | ||
|
|
||
| /** | ||
| * Find a listener based on the provided listener address value. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,6 +9,7 @@ namespace Envoy { | |
| namespace Network { | ||
|
|
||
| class Connection; | ||
| class AcceptSocket; | ||
|
|
||
| /** | ||
| * Status codes returned by filters that can cause future filters to not get iterated to. | ||
|
|
@@ -147,6 +148,67 @@ class FilterManager { | |
| virtual bool initializeReadFilters() PURE; | ||
| }; | ||
|
|
||
| /** | ||
| * Callbacks used by individual listener filter instances to communicate with the listener filter | ||
| * manager. | ||
| */ | ||
| class ListenerFilterCallbacks { | ||
| public: | ||
| virtual ~ListenerFilterCallbacks() {} | ||
|
|
||
| /** | ||
| * @return the AcceptSocket that owns this manager and the managed filters. | ||
| */ | ||
| virtual AcceptSocket& socket() PURE; | ||
|
|
||
| /** | ||
| * @return the Dispatcher for this manager. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "for this manager" doesn't really apply in filter context. I would reword.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This better: "@return the Dispatcher for issuing events."? |
||
| */ | ||
| virtual Event::Dispatcher& dispatcher() PURE; | ||
|
|
||
| /** | ||
| * If an filter stopped filter iteration by returning FilterStatus::StopIteration, | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "a filter"
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks. |
||
| * the filter should call continueFilterChain(true) when complete to continue the filter chain, | ||
| * or continueFilterChain(false) if the filter execution failed and the connection musrt be | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. typo "musrt"
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed. |
||
| * closed. | ||
| * @param success boolean telling whether the filter execution was successful or not. | ||
| */ | ||
| virtual void continueFilterChain(bool success) PURE; | ||
| }; | ||
|
|
||
| /** | ||
| * Listener Filter | ||
| */ | ||
| class ListenerFilter { | ||
| public: | ||
| virtual ~ListenerFilter() {} | ||
|
|
||
| /** | ||
| * Called when a new connection is accepted, but before a Connection is created. | ||
| * Filter chain iteration can be stopped if needed. | ||
| * @param cb the callbacks the filter instance can use to communicate with the filter chain. | ||
| * @return status used by the filter manager to manage further filter iteration. | ||
| */ | ||
| virtual FilterStatus onAccept(ListenerFilterCallbacks& cb) PURE; | ||
| }; | ||
|
|
||
| typedef std::shared_ptr<ListenerFilter> ListenerFilterSharedPtr; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this can probably be unique_ptr. The reason the other filters are shared_ptr is because of read/write/both semantics. That doesn't apply here.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will try this out.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was complicated a bit due to google mock not working with lvalue references. Worked around it by passing a raw pointer to addAcceptFilter() method. |
||
|
|
||
| /** | ||
| * Interface for filter callbacks and adding listener filters to a manager. | ||
| */ | ||
| class ListenerFilterManager { | ||
| public: | ||
| virtual ~ListenerFilterManager() {} | ||
|
|
||
| /** | ||
| * Add a filter to the listener. Filters are invoked in FIFO order (the filter added | ||
| * first is called first). | ||
| * @param filter supplies the filter being added. | ||
| */ | ||
| virtual void addAcceptFilter(ListenerFilterSharedPtr filter) PURE; | ||
| }; | ||
|
|
||
| /** | ||
| * Creates a chain of network filters for a new connection. | ||
| */ | ||
|
|
@@ -161,6 +223,14 @@ class FilterChainFactory { | |
| * false, e.g. filter chain is empty. | ||
| */ | ||
| virtual bool createFilterChain(Connection& connection) PURE; | ||
|
|
||
| /** | ||
| * Called to create the listener filter chain. | ||
| * @param listener supplies the listener to create the chain on. | ||
| * @return true if filter chain was created successfully. Otherwise | ||
| * false. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: reflow comment
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not exactly sure what you mean here, but I moved the last word to the end of the previous line. |
||
| */ | ||
| virtual bool createFilterChain(ListenerFilterManager& listener) PURE; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK. |
||
| }; | ||
|
|
||
| } // namespace Network | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,5 +34,65 @@ class ListenSocket { | |
| typedef std::unique_ptr<ListenSocket> ListenSocketPtr; | ||
| typedef std::shared_ptr<ListenSocket> ListenSocketSharedPtr; | ||
|
|
||
| /** | ||
| * An abstract accept socket. | ||
| */ | ||
| class AcceptSocket { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think I would call this
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||
| public: | ||
| virtual ~AcceptSocket() {} | ||
|
|
||
| /** | ||
| * @return the address that the socket was received at, or an original destination address if | ||
| * applicable. | ||
| */ | ||
| virtual Address::InstanceConstSharedPtr localAddress() const PURE; | ||
|
|
||
| /** | ||
| * Reset the original destination address of the socket to a different address than the one | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: remove "original".
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK, doing the same for resetRemoteAddress(), too. |
||
| * the socket was accepted at. | ||
| */ | ||
| virtual void resetLocalAddress(Address::InstanceConstSharedPtr& local_address) PURE; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
|
|
||
| /** | ||
| * @return true if the local address has been reset. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: I still really don't know what "reset" means in this context (as a casual reader). Can you add an example? WDYT about my previous suggestion of
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. +1
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I must have missed that suggestion. The real semantics is that the original destination cluster needs to know if the local address was "restored to it's original value, as it was before redirection". The significance of this is that missing that distinction will cause the upstream connection be opened to the same local address the Listener was listening at leading to recursion of open connections until Envoy reaches the max number of open connections and dies. This also explains the difference between the resetLocalAddress() and setLocalAddress(). The latter is used for client connections, where the local address is fully known only after the socket is connected. So, initially the local address is the one the listener received the new connection at, but it can be restored to the original destination address by the original dst listener filter. Maybe it would be clearer to add a separate flag to the address change method to mark as the address as 'restored'? This way the semantics would be more explicit and likely easier to understand. I'll try this out. |
||
| */ | ||
| virtual bool localAddressReset() const PURE; | ||
|
|
||
| /** | ||
| * @return the address that the socket was received from, or an original source address if | ||
| * applicable. | ||
| */ | ||
| virtual Address::InstanceConstSharedPtr remoteAddress() const PURE; | ||
|
|
||
| /** | ||
| * Set the original source address of the socket | ||
| */ | ||
| virtual void resetRemoteAddress(Address::InstanceConstSharedPtr& remote_address) PURE; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ditto. |
||
|
|
||
| /** | ||
| * @return fd the accept socket's file descriptor. | ||
| */ | ||
| virtual int fd() const PURE; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Per @ggreenway, can we hide the fd from the filters and potentially just expose peek operations for now? I feel like fd can be an implementation detail and passed around as needed into the real connection when it is created. In general, we should heavily limit what filters can do on a non-const accepted socket. Can we try to limit this interface as much as possible, at least from the filter perspective? This might require a base interface just for use by filters.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note that PROXY protocol consumes bytes from the wire, so peek operation alone wouldn't work (but it's also needed).
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right, good point. We can have a read, etc. method also if needed.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I haven't looked at feasibility of this yet, but maybe it would be possible to factor out the buffering piece from the Connection object and have the listener filters use that as well? I wanted to keep the changes in this PR minimal and towards that goal did not want to re-engineer the proxy protocol implementation any more than necessary. It could still be argued that implementing full data visibility for the listener filters should be an additional PR to follow rather than being merged in to this PR.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Socket option access is needed by the original dst filter, so that should be added in as well. On the other hand I don't know what the transport socket PR will bring. Maybe keep these listener filters and the interface as they are now and reconsider after the transport socket work is in?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree that leaving
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it's fine to leave
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added a TODO. |
||
|
|
||
| /** | ||
| * Transfer ownership of the file descriptor to the caller, so that the underlying socket will | ||
| * not be closed on delete. | ||
| */ | ||
| virtual int takeFd() PURE; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Per my other comment let's remove this from the exposed interface. I think we should be able to hide this as an implementation detail during listener processing (one option is to just store the
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK, did this, but it was a lot of work and I had to bring close() back in to the exposed interface. Had to split up AcceptedSocket into multiple classes as it felt wrong to use that for ClientConnection. Let me know if you'd rather revert the last commit and do it as a separate PR after this one. |
||
|
|
||
| /** | ||
| * Clear 'reset' state so that the socket can be used again with a new listener. | ||
| */ | ||
| virtual void clearReset() PURE; | ||
|
|
||
| /** | ||
| * Close the underlying socket. | ||
| */ | ||
| virtual void close() PURE; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need an explicit
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right, I'll remove the explicit close().
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Had to reintroduce this in order to remove takeFd(), which was more offensive. |
||
| }; | ||
|
|
||
| typedef std::unique_ptr<AcceptSocket> AcceptSocketPtr; | ||
| typedef std::shared_ptr<AcceptSocket> AcceptSocketSharedPtr; | ||
|
|
||
| } // namespace Network | ||
| } // namespace Envoy | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -123,6 +123,62 @@ class FactoryContext { | |
| virtual Stats::Scope& listenerScope() PURE; | ||
| }; | ||
|
|
||
| /** | ||
| * This function is used to wrap the creation of a listener filter chain for new sockets as they are | ||
| * created. Filter factories create the lambda at configuration initialization time, and then they | ||
| * are used at runtime. | ||
| * @param filter_manager supplies the filter manager for the listener to install filters to. | ||
| * Typically the function will install a single filter, but it's technically possibly to install | ||
| * more than one if desired. | ||
| */ | ||
| typedef std::function<void(Network::ListenerFilterManager& filter_manager)> ListenerFilterFactoryCb; | ||
|
|
||
| /** | ||
| * Implemented by each listener filter and registered via Registry::registerFactory() | ||
| * or the convenience class RegisterFactory. | ||
| */ | ||
| class NamedListenerFilterConfigFactory { | ||
| public: | ||
| virtual ~NamedListenerFilterConfigFactory() {} | ||
|
|
||
| /** | ||
| * Create a particular listener filter factory implementation. If the implementation is unable to | ||
| * produce a factory with the provided parameters, it should throw an EnvoyException in the case | ||
| * of general error or a Json::Exception if the json configuration is erroneous. The returned | ||
| * callback should always be initialized. | ||
| * @param config supplies the general json configuration for the filter | ||
| * @param context supplies the filter's context. | ||
| * @return ListenerFilterFactoryCb the factory creation function. | ||
| */ | ||
| virtual ListenerFilterFactoryCb createFilterFactory(const Json::Object& config, | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we go v2 only, no necessary of this method
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK, removed. |
||
| FactoryContext& context) PURE; | ||
|
|
||
| /** | ||
| * v2 variant of createFilterFactory(..), where filter configs are specified as proto. This may be | ||
| * optionally implemented today, but will in the future become compulsory once v1 is deprecated. | ||
| */ | ||
| virtual ListenerFilterFactoryCb createFilterFactoryFromProto(const Protobuf::Message& config, | ||
| FactoryContext& context) { | ||
| UNREFERENCED_PARAMETER(config); | ||
| UNREFERENCED_PARAMETER(context); | ||
| NOT_IMPLEMENTED; | ||
| } | ||
|
|
||
| /** | ||
| * @return ProtobufTypes::MessagePtr create empty config proto message for v2. The filter | ||
| * config, which arrives in an opaque google.protobuf.Struct message, will be converted to | ||
| * JSON and then parsed into this empty proto. Optional today, will be compulsory when v1 | ||
| * is deprecated. | ||
| */ | ||
| virtual ProtobufTypes::MessagePtr createEmptyConfigProto() { return nullptr; } | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this should be a PURE method.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right, fixed! |
||
|
|
||
| /** | ||
| * @return std::string the identifying name for a particular implementation of a listener filter | ||
| * produced by the factory. | ||
| */ | ||
| virtual std::string name() PURE; | ||
| }; | ||
|
|
||
| /** | ||
| * This function is used to wrap the creation of a network filter chain for new connections as | ||
| * they come in. Filter factories create the lambda at configuration initialization time, and then | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we please make this a v2 only feature? For v1 I would recommend just internally converting "use_original_dst" into a filter internally. Otherwise this is a breaking config change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Happy to make this v2 only, simplifies it a little as well. It was not, however, a breaking config change, I had used this to test v1 access to the listener filters.