From fc8ff4fc24a5de798419d59139a9cc7ad737b003 Mon Sep 17 00:00:00 2001 From: Ishan Jain Date: Sun, 10 Dec 2023 00:47:56 +0530 Subject: [PATCH] encode to little endian --- src/main.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main.rs b/src/main.rs index 10ed440..615fee1 100644 --- a/src/main.rs +++ b/src/main.rs @@ -82,8 +82,8 @@ impl Question { pub fn write_to(self, buf: &mut Vec) { self.name.write_to(buf); - buf.extend(self.q_type.to_be_bytes()); - buf.extend(self.class.to_be_bytes()); + buf.extend(self.q_type.to_le_bytes()); + buf.extend(self.class.to_le_bytes()); } } @@ -166,9 +166,9 @@ impl Header { buf.push(flag1_byte); // Write counts - buf.extend(self.question_records.to_be_bytes()); - buf.extend(self.answer_records.to_be_bytes()); - buf.extend(self.authority_records.to_be_bytes()); - buf.extend(self.additional_records.to_be_bytes()); + buf.extend(self.question_records.to_le_bytes()); + buf.extend(self.answer_records.to_le_bytes()); + buf.extend(self.authority_records.to_le_bytes()); + buf.extend(self.additional_records.to_le_bytes()); } }