-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
quic: HTTP/3 upstream initial checkin (#15027)
This is working end to end for a number of the protocol integration tests, but still needs a bunch of work before it's production ready (I triaged some of the excludes but not all, watermarks not working etc). I think given this works for the happy path it's worth checking in, and I can iterate on getting individual tests working and doing the TODOs. Risk Level: low (minor core refactors, major changes are all behind hidden config) Testing: integration tests, some unit tests Docs Changes: n/a Release Notes: n/a #14829 Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
- Loading branch information
1 parent
50e8127
commit 0a58f84
Showing
34 changed files
with
592 additions
and
93 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#include "common/http/http3/conn_pool.h" | ||
|
||
#include <cstdint> | ||
|
||
#include "envoy/event/dispatcher.h" | ||
#include "envoy/upstream/upstream.h" | ||
|
||
#include "common/config/utility.h" | ||
#include "common/http/http3/quic_client_connection_factory.h" | ||
#include "common/http/http3/well_known_names.h" | ||
#include "common/http/utility.h" | ||
#include "common/network/address_impl.h" | ||
#include "common/network/utility.h" | ||
#include "common/runtime/runtime_features.h" | ||
|
||
namespace Envoy { | ||
namespace Http { | ||
namespace Http3 { | ||
|
||
ConnectionPool::InstancePtr | ||
allocateConnPool(Event::Dispatcher& dispatcher, Random::RandomGenerator& random_generator, | ||
Upstream::HostConstSharedPtr host, Upstream::ResourcePriority priority, | ||
const Network::ConnectionSocket::OptionsSharedPtr& options, | ||
const Network::TransportSocketOptionsSharedPtr& transport_socket_options, | ||
Upstream::ClusterConnectivityState& state, TimeSource& time_source) { | ||
return std::make_unique<FixedHttpConnPoolImpl>( | ||
host, priority, dispatcher, options, transport_socket_options, random_generator, state, | ||
[&dispatcher, &time_source](HttpConnPoolImplBase* pool) { | ||
Upstream::Host::CreateConnectionData data{}; | ||
data.host_description_ = pool->host(); | ||
auto host_address = data.host_description_->address(); | ||
auto source_address = data.host_description_->cluster().sourceAddress(); | ||
if (!source_address.get()) { | ||
source_address = Network::Utility::getLocalAddress(host_address->ip()->version()); | ||
} | ||
Network::TransportSocketFactory& transport_socket_factory = | ||
data.host_description_->transportSocketFactory(); | ||
data.connection_ = | ||
Config::Utility::getAndCheckFactoryByName<Http::QuicClientConnectionFactory>( | ||
Http::QuicCodecNames::get().Quiche) | ||
.createQuicNetworkConnection(host_address, source_address, transport_socket_factory, | ||
data.host_description_->cluster().statsScope(), | ||
dispatcher, time_source); | ||
return std::make_unique<ActiveClient>(*pool, data); | ||
}, | ||
[](Upstream::Host::CreateConnectionData& data, HttpConnPoolImplBase* pool) { | ||
CodecClientPtr codec{new CodecClientProd( | ||
CodecClient::Type::HTTP3, std::move(data.connection_), data.host_description_, | ||
pool->dispatcher(), pool->randomGenerator())}; | ||
return codec; | ||
}, | ||
std::vector<Protocol>{Protocol::Http3}); | ||
} | ||
|
||
} // namespace Http3 | ||
} // 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#pragma once | ||
|
||
#include <cstdint> | ||
|
||
#include "envoy/upstream/upstream.h" | ||
|
||
#include "common/http/codec_client.h" | ||
#include "common/http/http2/conn_pool.h" | ||
|
||
namespace Envoy { | ||
namespace Http { | ||
namespace Http3 { | ||
|
||
// TODO(#14829) the constructor of Http2::ActiveClient sets max requests per | ||
// connection based on HTTP/2 config. Sort out the HTTP/3 config story. | ||
class ActiveClient : public MultiplexedActiveClientBase { | ||
public: | ||
ActiveClient(Envoy::Http::HttpConnPoolImplBase& parent, | ||
Upstream::Host::CreateConnectionData& data) | ||
: MultiplexedActiveClientBase( | ||
parent, parent.host()->cluster().stats().upstream_cx_http3_total_, data) {} | ||
}; | ||
|
||
ConnectionPool::InstancePtr | ||
allocateConnPool(Event::Dispatcher& dispatcher, Random::RandomGenerator& random_generator, | ||
Upstream::HostConstSharedPtr host, Upstream::ResourcePriority priority, | ||
const Network::ConnectionSocket::OptionsSharedPtr& options, | ||
const Network::TransportSocketOptionsSharedPtr& transport_socket_options, | ||
Upstream::ClusterConnectivityState& state, TimeSource& time_source); | ||
|
||
} // namespace Http3 | ||
} // 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#pragma once | ||
|
||
#include <string> | ||
|
||
#include "envoy/config/listener/v3/quic_config.pb.h" | ||
#include "envoy/config/typed_config.h" | ||
#include "envoy/network/connection.h" | ||
#include "envoy/ssl/context_config.h" | ||
|
||
namespace Envoy { | ||
namespace Http { | ||
|
||
// A factory to create EnvoyQuicClientSession and EnvoyQuicClientConnection for QUIC | ||
class QuicClientConnectionFactory : public Config::UntypedFactory { | ||
public: | ||
~QuicClientConnectionFactory() override = default; | ||
|
||
virtual std::unique_ptr<Network::ClientConnection> | ||
createQuicNetworkConnection(Network::Address::InstanceConstSharedPtr server_addr, | ||
Network::Address::InstanceConstSharedPtr local_addr, | ||
Network::TransportSocketFactory& transport_socket_factory, | ||
Stats::Scope& stats_scope, Event::Dispatcher& dispatcher, | ||
TimeSource& time_source) PURE; | ||
|
||
std::string category() const override { return "envoy.quic_connection"; } | ||
}; | ||
|
||
} // 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
Oops, something went wrong.