ax(ueps): rename header to packetHeader for AX Principle 1 compliance
Generic name `header` replaced with `packetHeader` throughout ReadAndVerify to satisfy AX predictable-names-over-short-names; the name now conveys what is being built without requiring context from the surrounding function. Co-Authored-By: Charon <charon@lethean.io>
This commit is contained in:
parent
c03b040240
commit
61c45810ba
1 changed files with 7 additions and 7 deletions
|
|
@ -30,7 +30,7 @@ type ParsedPacket struct {
|
|||
func ReadAndVerify(reader *bufio.Reader, sharedSecret []byte) (*ParsedPacket, error) {
|
||||
var (
|
||||
hmacInputBuffer bytes.Buffer
|
||||
header UEPSHeader
|
||||
packetHeader UEPSHeader
|
||||
hmacSignature []byte
|
||||
payload []byte
|
||||
)
|
||||
|
|
@ -61,27 +61,27 @@ func ReadAndVerify(reader *bufio.Reader, sharedSecret []byte) (*ParsedPacket, er
|
|||
|
||||
switch tagType {
|
||||
case TagVersion:
|
||||
header.Version = tagValue[0]
|
||||
packetHeader.Version = tagValue[0]
|
||||
hmacInputBuffer.WriteByte(tagType)
|
||||
hmacInputBuffer.WriteByte(tagLength)
|
||||
hmacInputBuffer.Write(tagValue)
|
||||
case TagCurrentLayer:
|
||||
header.CurrentLayer = tagValue[0]
|
||||
packetHeader.CurrentLayer = tagValue[0]
|
||||
hmacInputBuffer.WriteByte(tagType)
|
||||
hmacInputBuffer.WriteByte(tagLength)
|
||||
hmacInputBuffer.Write(tagValue)
|
||||
case TagTargetLayer:
|
||||
header.TargetLayer = tagValue[0]
|
||||
packetHeader.TargetLayer = tagValue[0]
|
||||
hmacInputBuffer.WriteByte(tagType)
|
||||
hmacInputBuffer.WriteByte(tagLength)
|
||||
hmacInputBuffer.Write(tagValue)
|
||||
case TagIntent:
|
||||
header.IntentID = tagValue[0]
|
||||
packetHeader.IntentID = tagValue[0]
|
||||
hmacInputBuffer.WriteByte(tagType)
|
||||
hmacInputBuffer.WriteByte(tagLength)
|
||||
hmacInputBuffer.Write(tagValue)
|
||||
case TagThreatScore:
|
||||
header.ThreatScore = binary.BigEndian.Uint16(tagValue)
|
||||
packetHeader.ThreatScore = binary.BigEndian.Uint16(tagValue)
|
||||
hmacInputBuffer.WriteByte(tagType)
|
||||
hmacInputBuffer.WriteByte(tagLength)
|
||||
hmacInputBuffer.Write(tagValue)
|
||||
|
|
@ -108,7 +108,7 @@ func ReadAndVerify(reader *bufio.Reader, sharedSecret []byte) (*ParsedPacket, er
|
|||
}
|
||||
|
||||
return &ParsedPacket{
|
||||
Header: header,
|
||||
Header: packetHeader,
|
||||
Payload: payload,
|
||||
}, nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue