Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions awscrt/aws_iot_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,14 +207,16 @@ def _minimum_tls_version_metrics_value(version):
def _tls_cipher_preference_metrics_value(pref):
"""Map TlsCipherPref to its single-character metrics value.

Mapping: PQ_TLSv1_0_2021_05->A, PQ_DEFAULT->B, TLSv1_2_2025_07->C.
Returns None for DEFAULT.
Mapping: PQ_TLSv1_0_2021_05->F, PQ_DEFAULT->H, TLSv1_2_2025_07->I.
Letters A-E, G, J, K are reserved for cipher preferences exposed by
other language SDKs but not by Python.
Returns None for DEFAULT or any unrecognized value.
"""
from awscrt.io import TlsCipherPref
mapping = {
TlsCipherPref.PQ_TLSv1_0_2021_05: "A",
TlsCipherPref.PQ_DEFAULT: "B",
TlsCipherPref.TLSv1_2_2025_07: "C",
TlsCipherPref.PQ_TLSv1_0_2021_05: "F",
TlsCipherPref.PQ_DEFAULT: "H",
TlsCipherPref.TLSv1_2_2025_07: "I",
}
return mapping.get(pref)

Expand Down
6 changes: 3 additions & 3 deletions test/test_aws_iot_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def test_all_mqtt5_features_set(self):
self.assertIn("H/A", result) # HTTP proxy (no TLS on proxy)
self.assertIn("K/D", result) # TLSv1_2
if cipher_pref.is_supported():
self.assertIn("J/B", result) # PQ_DEFAULT
self.assertIn("J/H", result) # PQ_DEFAULT

def test_alternate_values(self):
"""MQTT5 with alternate non-default values."""
Expand Down Expand Up @@ -155,7 +155,7 @@ def test_alternate_values(self):
self.assertIn("H/B", result) # HTTPS proxy
self.assertIn("K/E", result) # TLSv1_3
if cipher_pref.is_supported():
self.assertIn("J/A", result) # PQ_TLSv1_0_2021_05
self.assertIn("J/F", result) # PQ_TLSv1_0_2021_05

def test_mqtt3_with_proxy_and_tls(self):
"""MQTT3 with HTTPS proxy and TLS context."""
Expand All @@ -178,7 +178,7 @@ def test_mqtt3_with_proxy_and_tls(self):
self.assertIn("H/B", result) # HTTPS
self.assertIn("K/D", result) # TLSv1_2
if cipher_pref.is_supported():
self.assertIn("J/C", result) # TLSv1_2_2025_07
self.assertIn("J/I", result) # TLSv1_2_2025_07


class TestMergeFeatureLists(NativeResourceTest):
Expand Down
Loading