From 98fb872fc118164c5a6b06e2a93ae6ababc77903 Mon Sep 17 00:00:00 2001 From: PhatPhuckDave <> Date: Mon, 22 Jul 2024 22:49:01 +0200 Subject: [PATCH] Rework encode, idiot --- pdu/pdu.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/pdu/pdu.go b/pdu/pdu.go index 0f4c15b..ba00d95 100644 --- a/pdu/pdu.go +++ b/pdu/pdu.go @@ -28,11 +28,8 @@ type ( func (p *PDU_HEADER) Encode() ([]uint8, error) { buf := make([]uint8, 16) - binary.BigEndian.PutUint32(buf[0:4], p.command_length) - binary.BigEndian.PutUint32(buf[4:8], p.command_id) - binary.BigEndian.PutUint32(buf[8:12], p.command_status) - binary.BigEndian.PutUint32(buf[12:16], p.sequence_number) - return buf, nil + err := p.EncodeInto(&buf) + return buf, err } func (p *PDU_HEADER) EncodeInto(buf *[]uint8) error { if buf == nil {