-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6d6ea2e
commit f877b02
Showing
10 changed files
with
134 additions
and
46 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// SPDX-License-Identifier: GPL-2.0 | ||
/* Copyright (c) 2024 Chilledheart */ | ||
|
||
#include "net/protocol.hpp" | ||
|
||
#include <string_view> | ||
|
||
using std::string_view_literals::operator""sv; | ||
|
||
namespace net { | ||
|
||
NextProto NextProtoFromString(std::string_view proto_string) { | ||
if (proto_string == "http/1.1"sv) { | ||
return kProtoHTTP11; | ||
} | ||
if (proto_string == "h2"sv) { | ||
return kProtoHTTP2; | ||
} | ||
if (proto_string == "quic"sv || proto_string == "hq"sv) { | ||
return kProtoQUIC; | ||
} | ||
|
||
return kProtoUnknown; | ||
} | ||
|
||
std::string_view NextProtoToString(NextProto next_proto) { | ||
switch (next_proto) { | ||
case kProtoHTTP11: | ||
return "http/1.1"sv; | ||
case kProtoHTTP2: | ||
return "h2"sv; | ||
case kProtoQUIC: | ||
return "quic"sv; | ||
case kProtoUnknown: | ||
break; | ||
} | ||
return "unknown"; | ||
} | ||
|
||
} // namespace net |
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