ax(ueps): add usage-example comments to exported tag constants
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:
parent
d812ad92de
commit
0a30a45b7d
1 changed files with 5 additions and 5 deletions
|
|
@ -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
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue