Log as Q043, Q044, Q045, Q046. If the version is not supported/recognized,
log the 4 bytes as hex.
Only log for txs based on long headers.
fn log_template(tx: &QuicTransaction, js: &mut JsonBuilder) -> Result<(), JsonError> {
js.open_object("quic")?;
- js.set_uint("version", u32::from(tx.header.version).into())?;
-
+ if tx.header.flags.is_long {
+ js.set_string("version", String::from(tx.header.version).as_str())?;
+ }
js.open_array("cyu")?;
for cyu in &tx.cyu {
js.start_object()?;
}
}
+impl From<QuicVersion> for String {
+ fn from(from: QuicVersion) -> Self {
+ match from {
+ QuicVersion(0x51303433) => "Q043".to_string(),
+ QuicVersion(0x51303434) => "Q044".to_string(),
+ QuicVersion(0x51303435) => "Q045".to_string(),
+ QuicVersion(0x51303436) => "Q046".to_string(),
+ QuicVersion(x) => format!("{:x}", x),
+ }
+ }
+}
impl From<QuicVersion> for u32 {
fn from(from: QuicVersion) -> Self {
from.0