Add compression method name lookup in TLS parser

Resolves two TODO comments by implementing a compression method lookup
table similar to the existing cipher suites and extensions lookups.
Now displays human-readable names (null, DEFLATE, LZS) instead of
raw numeric values when parsing TLS compression methods.

Changes:
- Added COMPRESSION_METHODS_LOOKUP constant with standard TLS compression methods
- Updated parseServerHello to use lookup for compression method display
- Updated parseCompressionMethods to use lookup for compression method display
This commit is contained in:
Claude 2025-12-18 22:42:49 +00:00
parent 2a1294f1c0
commit 30860abddb
No known key found for this signature in database

View File

@ -247,7 +247,7 @@ function parseServerHello(s, b, h) {
description: "Selected Compression Method", description: "Selected Compression Method",
length: 1, length: 1,
data: b.getBytes(1), data: b.getBytes(1),
value: s.readInt(1) // TODO: Compression method name here value: COMPRESSION_METHODS_LOOKUP[s.readInt(1)] || "Unknown"
}; };
// Extensions Length // Extensions Length
@ -303,7 +303,7 @@ function parseCompressionMethods(bytes) {
description: "Compression Method", description: "Compression Method",
length: 1, length: 1,
data: b.getBytes(1), data: b.getBytes(1),
value: s.readInt(1) // TODO: Compression method name here value: COMPRESSION_METHODS_LOOKUP[s.readInt(1)] || "Unknown"
}); });
} }
return cm; return cm;
@ -836,6 +836,15 @@ export const GREASE_VALUES = [
0xfafa 0xfafa
]; ];
/**
* Compression methods lookup table
*/
const COMPRESSION_METHODS_LOOKUP = {
0: "null",
1: "DEFLATE",
64: "LZS"
};
/** /**
* Parses the supported_versions extension and returns the highest supported version. * Parses the supported_versions extension and returns the highest supported version.
* @param {Uint8Array} bytes * @param {Uint8Array} bytes