ax(ueps): add usage-example comments to exported tag constants
Some checks failed
Security Scan / security (push) Successful in 30s
Test / test (push) Has been cancelled

TagCurrentLayer, TagTargetLayer, TagIntent, and TagThreatScore were
exported constants with no comment, violating AX Principle 2 (comments
as usage examples). Each now has a concrete writeTLV call showing the
tag, value encoding, and valid range where relevant.

Co-Authored-By: Charon <charon@lethean.io>
This commit is contained in:
Claude 2026-04-02 12:13:50 +01:00
parent d812ad92de
commit 0a30a45b7d
No known key found for this signature in database
GPG key ID: AF404715446AEB41

View file

@ -18,11 +18,11 @@ func (packetErrorValue packetError) Error() string { return string(packetErrorVa
// writeTLV(buffer, TagVersion, []byte{0x09}); writeTLV(buffer, TagHMAC, hmacSignature); buffer.WriteByte(TagPayload)
const (
TagVersion = 0x01
TagCurrentLayer = 0x02
TagTargetLayer = 0x03
TagIntent = 0x04
TagThreatScore = 0x05
TagVersion = 0x01 // writeTLV(buffer, TagVersion, []byte{0x09})
TagCurrentLayer = 0x02 // writeTLV(buffer, TagCurrentLayer, []byte{5}) // 5 = Application
TagTargetLayer = 0x03 // writeTLV(buffer, TagTargetLayer, []byte{3}) // 3 = Network
TagIntent = 0x04 // writeTLV(buffer, TagIntent, []byte{0x01}) // 0x01 = ping, 0x02 = data, 0x03 = auth
TagThreatScore = 0x05 // writeTLV(buffer, TagThreatScore, []byte{0x00, 0x00}) // 0 = clean, 65535 = max threat
TagHMAC = 0x06 // writeTLV(buffer, TagHMAC, hmacSignature) — covers all preceding header TLVs + payload
TagPayload = 0xFF // buffer.WriteByte(TagPayload); buffer.Write(rawPayload) — no length prefix
)