-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tls: splitting config into downstream and upstream
Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
- Loading branch information
1 parent
7b7ab06
commit d901731
Showing
13 changed files
with
141 additions
and
53 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
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
29 changes: 29 additions & 0 deletions
29
source/extensions/transport_sockets/tls/downstream_config.h
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,29 @@ | ||
#pragma once | ||
|
||
#include "envoy/registry/registry.h" | ||
#include "envoy/server/transport_socket_config.h" | ||
|
||
#include "source/extensions/transport_sockets/tls/config.h" | ||
|
||
namespace Envoy { | ||
namespace Extensions { | ||
namespace TransportSockets { | ||
namespace Tls { | ||
|
||
class DownstreamSslSocketFactory | ||
: public Server::Configuration::DownstreamTransportSocketConfigFactory, | ||
public SslSocketConfigFactory { | ||
public: | ||
Network::DownstreamTransportSocketFactoryPtr | ||
createTransportSocketFactory(const Protobuf::Message& config, | ||
Server::Configuration::TransportSocketFactoryContext& context, | ||
const std::vector<std::string>& server_names) override; | ||
ProtobufTypes::MessagePtr createEmptyConfigProto() override; | ||
}; | ||
|
||
DECLARE_FACTORY(DownstreamSslSocketFactory); | ||
|
||
} // namespace Tls | ||
} // namespace TransportSockets | ||
} // namespace Extensions | ||
} // namespace Envoy |
37 changes: 37 additions & 0 deletions
37
source/extensions/transport_sockets/tls/upstream_config.cc
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,37 @@ | ||
#include "source/extensions/transport_sockets/tls/upstream_config.h" | ||
|
||
#include "envoy/extensions/transport_sockets/tls/v3/cert.pb.h" | ||
#include "envoy/extensions/transport_sockets/tls/v3/tls.pb.validate.h" | ||
|
||
#include "source/common/protobuf/utility.h" | ||
#include "source/common/tls/context_config_impl.h" | ||
#include "source/common/tls/ssl_socket.h" | ||
|
||
namespace Envoy { | ||
namespace Extensions { | ||
namespace TransportSockets { | ||
namespace Tls { | ||
|
||
Network::UpstreamTransportSocketFactoryPtr UpstreamSslSocketFactory::createTransportSocketFactory( | ||
const Protobuf::Message& message, | ||
Server::Configuration::TransportSocketFactoryContext& context) { | ||
auto client_config = std::make_unique<ClientContextConfigImpl>( | ||
MessageUtil::downcastAndValidate< | ||
const envoy::extensions::transport_sockets::tls::v3::UpstreamTlsContext&>( | ||
message, context.messageValidationVisitor()), | ||
context); | ||
return std::make_unique<ClientSslSocketFactory>( | ||
std::move(client_config), context.sslContextManager(), context.statsScope()); | ||
} | ||
|
||
ProtobufTypes::MessagePtr UpstreamSslSocketFactory::createEmptyConfigProto() { | ||
return std::make_unique<envoy::extensions::transport_sockets::tls::v3::UpstreamTlsContext>(); | ||
} | ||
|
||
LEGACY_REGISTER_FACTORY(UpstreamSslSocketFactory, | ||
Server::Configuration::UpstreamTransportSocketConfigFactory, "tls"); | ||
|
||
} // namespace Tls | ||
} // namespace TransportSockets | ||
} // namespace Extensions | ||
} // 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#pragma once | ||
|
||
#include "envoy/registry/registry.h" | ||
#include "envoy/server/transport_socket_config.h" | ||
|
||
#include "source/extensions/transport_sockets/tls/config.h" | ||
|
||
namespace Envoy { | ||
namespace Extensions { | ||
namespace TransportSockets { | ||
namespace Tls { | ||
|
||
class UpstreamSslSocketFactory : public Server::Configuration::UpstreamTransportSocketConfigFactory, | ||
public SslSocketConfigFactory { | ||
public: | ||
Network::UpstreamTransportSocketFactoryPtr createTransportSocketFactory( | ||
const Protobuf::Message& config, | ||
Server::Configuration::TransportSocketFactoryContext& context) override; | ||
ProtobufTypes::MessagePtr createEmptyConfigProto() override; | ||
}; | ||
|
||
DECLARE_FACTORY(UpstreamSslSocketFactory); | ||
|
||
} // namespace Tls | ||
} // namespace TransportSockets | ||
} // namespace Extensions | ||
} // 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