From 449678df29018f845a0eadeba3948bbc8eed116d Mon Sep 17 00:00:00 2001 From: Shulhan Date: Wed, 19 Sep 2018 05:22:32 +0700 Subject: lib/dns: set default new message header and question On header, set the query count to 1; on question set type to "A" and class to "IN". --- lib/dns/message.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/dns/message.go b/lib/dns/message.go index c5d9f770..691cc044 100644 --- a/lib/dns/message.go +++ b/lib/dns/message.go @@ -73,8 +73,12 @@ func NewMessage() *Message { Header: &SectionHeader{ IsQuery: true, IsRD: true, + QDCount: 1, + }, + Question: &SectionQuestion{ + Type: QueryTypeA, + Class: QueryClassIN, }, - Question: &SectionQuestion{}, Packet: make([]byte, maxUDPPacketSize), dnameOff: make(map[string]uint16), } -- cgit v1.3