blob: 2bab26be436e144629655f41114bed1e08461f1e [file] [log] [blame]
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "quiche/quic/masque/masque_utils.h"
namespace quic {
ParsedQuicVersionVector MasqueSupportedVersions() {
QuicVersionInitializeSupportForIetfDraft();
ParsedQuicVersionVector versions;
for (const ParsedQuicVersion& version : AllSupportedVersions()) {
// Use all versions that support IETF QUIC.
if (version.UsesHttp3()) {
QuicEnableVersion(version);
versions.push_back(version);
}
}
QUICHE_CHECK(!versions.empty());
return versions;
}
QuicConfig MasqueEncapsulatedConfig() {
QuicConfig config;
config.SetMaxPacketSizeToSend(kMasqueMaxEncapsulatedPacketSize);
return config;
}
std::string MasqueModeToString(MasqueMode masque_mode) {
switch (masque_mode) {
case MasqueMode::kInvalid:
return "Invalid";
case MasqueMode::kOpen:
return "Open";
case MasqueMode::kConnectIp:
return "CONNECT-IP";
}
return absl::StrCat("Unknown(", static_cast<int>(masque_mode), ")");
}
std::ostream& operator<<(std::ostream& os, const MasqueMode& masque_mode) {
os << MasqueModeToString(masque_mode);
return os;
}
} // namespace quic