encode to little endian

This commit is contained in:
Ishan Jain 2023-12-10 00:47:56 +05:30
parent a5c884efd0
commit fc8ff4fc24
Signed by: ishan
GPG Key ID: 0506DB2A1CC75C27

View File

@ -82,8 +82,8 @@ impl Question {
pub fn write_to(self, buf: &mut Vec<u8>) {
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());
}
}