#include "quiche/quic/tools/connect_tunnel.h"
#include <cstdint>
#include <optional>
#include <string>
#include <utility>
#include <vector>
#include "absl/container/flat_hash_set.h"
#include "absl/status/status.h"
#include "absl/status/statusor.h"
#include "absl/strings/str_cat.h"
#include "absl/strings/string_view.h"
#include "absl/types/span.h"
#include "quiche/quic/core/quic_error_codes.h"
#include "quiche/quic/core/quic_server_id.h"
#include "quiche/quic/core/socket_factory.h"
#include "quiche/quic/platform/api/quic_socket_address.h"
#include "quiche/quic/tools/quic_backend_response.h"
#include "quiche/quic/tools/quic_name_lookup.h"
#include "quiche/quic/tools/quic_simple_server_backend.h"
#include "quiche/common/http/http_header_block.h"
#include "quiche/common/platform/api/quiche_logging.h"
#include "quiche/common/platform/api/quiche_mem_slice.h"
namespace quic {
namespace {
constexpr size_t kReadSize = …;
std::optional<QuicServerId> ValidateHeadersAndGetAuthority(
const quiche::HttpHeaderBlock& request_headers) { … }
bool ValidateAuthority(
const QuicServerId& authority,
const absl::flat_hash_set<QuicServerId>& acceptable_destinations) { … }
}
ConnectTunnel::ConnectTunnel(
QuicSimpleServerBackend::RequestHandler* client_stream_request_handler,
SocketFactory* socket_factory,
absl::flat_hash_set<QuicServerId> acceptable_destinations)
: … { … }
ConnectTunnel::~ConnectTunnel() { … }
void ConnectTunnel::OpenTunnel(const quiche::HttpHeaderBlock& request_headers) { … }
bool ConnectTunnel::IsConnectedToDestination() const { … }
void ConnectTunnel::SendDataToDestination(absl::string_view data) { … }
void ConnectTunnel::OnClientStreamClose() { … }
void ConnectTunnel::ConnectComplete(absl::Status ) { … }
void ConnectTunnel::ReceiveComplete(
absl::StatusOr<quiche::QuicheMemSlice> data) { … }
void ConnectTunnel::SendComplete(absl::Status ) { … }
void ConnectTunnel::BeginAsyncReadFromDestination() { … }
void ConnectTunnel::OnDestinationConnectionClosed() { … }
void ConnectTunnel::SendConnectResponse() { … }
void ConnectTunnel::TerminateClientStream(absl::string_view error_description,
QuicResetStreamError error_code) { … }
}