-
Notifications
You must be signed in to change notification settings - Fork 5.5k
network: add DownstreamTransportSocketConfigFactory and registry #2437
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 13 commits
48950a0
f34d885
8c4e39c
b78b836
e843dee
deb5486
1abb513
d5127bb
b98f539
06dba15
bafd37a
813b77e
b250972
364d4fc
d958983
dbeec06
981ba1e
9375259
a14e609
99cabb0
9468ac7
97a8926
e870f04
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 |
|---|---|---|
|
|
@@ -7,6 +7,7 @@ | |
| #include "envoy/common/exception.h" | ||
| #include "envoy/network/connection.h" | ||
| #include "envoy/network/listen_socket.h" | ||
| #include "envoy/network/transport_socket.h" | ||
| #include "envoy/ssl/context.h" | ||
|
|
||
| namespace Envoy { | ||
|
|
@@ -32,9 +33,9 @@ class ListenerConfig { | |
| virtual ListenSocket& socket() PURE; | ||
|
|
||
| /** | ||
| * @return Ssl::ServerContext* the default SSL context. | ||
| * @return TransportSocketFacotry& the transport socket factory. | ||
|
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: TransportSocketFactory |
||
| */ | ||
| virtual Ssl::ServerContext* defaultSslContext() PURE; | ||
| virtual TransportSocketFactory& transportSocketFactory() PURE; | ||
|
|
||
| /** | ||
| * @return bool specifies whether the listener should actually listen on the port. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,11 +33,31 @@ class TransportSocketConfigFactory { | |
| public: | ||
| virtual ~TransportSocketConfigFactory() {} | ||
|
|
||
| /** | ||
| * @return ProtobufTypes::MessagePtr create empty config proto message. The transport socket | ||
| * config, which arrives in an opaque google.protobuf.Struct message, will be converted | ||
| * to JSON and then parsed into this empty proto. | ||
| */ | ||
| virtual ProtobufTypes::MessagePtr createEmptyConfigProto() PURE; | ||
|
|
||
| /** | ||
| * @return std::string the identifying name for a particular TransportSocketFactoryPtr | ||
| * implementation produced by the factory. | ||
| */ | ||
| virtual std::string name() const PURE; | ||
| }; | ||
|
|
||
| /** | ||
| * Implemented by each transport socket which used for upstream connections. Registered via class | ||
|
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: rm which (repeated below for DownstreamTransportSocketConfigFactory) |
||
| * RegisterFactory. | ||
| */ | ||
| class UpstreamTransportSocketConfigFactory : public virtual TransportSocketConfigFactory { | ||
| public: | ||
| /** | ||
| * Create a particular transport socket factory implementation. | ||
| * @param config const Protobuf::Message& supplies the config message for the transport socket | ||
| * implementation. | ||
| * @param context TransportSocketFactoryContext& supplies the transport socket's context. | ||
| * @param context TransportSocketFactoryContext& supplies the transport socket's context. | ||
| * @return Network::TransportSocketFactoryPtr the transport socket factory instance. The returned | ||
| * TransportSocketFactoryPtr should not be nullptr. | ||
| * | ||
|
|
@@ -47,23 +67,40 @@ class TransportSocketConfigFactory { | |
| virtual Network::TransportSocketFactoryPtr | ||
| createTransportSocketFactory(const Protobuf::Message& config, | ||
| TransportSocketFactoryContext& context) PURE; | ||
| }; | ||
|
|
||
| /** | ||
| * Implemented by each transport socket which used for downstream connections. Registered via class | ||
| * RegisterFactory. | ||
| */ | ||
| class DownstreamTransportSocketConfigFactory : public virtual TransportSocketConfigFactory { | ||
| public: | ||
| /** | ||
| * @return ProtobufTypes::MessagePtr create empty config proto message. The transport socket | ||
| * config, which arrives in an opaque google.protobuf.Struct message, will be converted | ||
| * to JSON and then parsed into this empty proto. | ||
| */ | ||
| virtual ProtobufTypes::MessagePtr createEmptyConfigProto() PURE; | ||
|
|
||
| /** | ||
| * @return std::string the identifying name for a particular TransportSocketFactoryPtr | ||
| * implementation produced by the factory. | ||
| * Create a particular downstream transport socket factory implementation. | ||
| * TODO(lizan): Revisit the parameters for SNI below when TLS sniffing and filter chain match are | ||
| * implemented. | ||
| * @param listener_name const std::string& the name of the listener. | ||
| * @param server_names const std::vector<std::string>& the names of the server. This parameter is | ||
| * currently used by SNI implementation to know the expected server names. | ||
| * @param skip_ssl_context_update bool indicates whether the ssl context update should be skipped. | ||
|
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. Ditto |
||
| * This parameter is currently used by SNI implementation to know whether it should perform | ||
| * certificate selection. | ||
| * @param config const Protobuf::Message& supplies the config message for the transport socket | ||
| * implementation. | ||
| * @param context TransportSocketFactoryContext& supplies the transport socket's context. | ||
| * @return Network::TransportSocketFactoryPtr the transport socket factory instance. The returned | ||
| * TransportSocketFactoryPtr should not be nullptr. | ||
| * | ||
| * @throw EnvoyException if the implementation is unable to produce a factory with the provided | ||
| * parameters. | ||
| */ | ||
| virtual std::string name() const PURE; | ||
| virtual Network::TransportSocketFactoryPtr | ||
| createTransportSocketFactory(const std::string& listener_name, | ||
| const std::vector<std::string>& server_names, | ||
| bool skip_ssl_context_update, const Protobuf::Message& config, | ||
| TransportSocketFactoryContext& context) PURE; | ||
| }; | ||
|
|
||
| class UpstreamTransportSocketConfigFactory : public virtual TransportSocketConfigFactory {}; | ||
|
|
||
| } // namespace Configuration | ||
| } // namespace Server | ||
| } // namespace Envoy | ||
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.
Please fix doc comments