A question is a name plus two 16-bit fields - the record type you want and its class. Today you encode a complete question, the part of the message that says what you are actually asking for.
Encode a question as a QNAME followed by QTYPE and QCLASS.
The question section is where a query states its request. Each question is a
QNAME (the name from lessons 7 and 8) followed by two 16-bit fields: QTYPE,
the kind of record you want, and QCLASS, the network class. For internet names
the class is always IN, value 1, and the most common type is A, an IPv4
address, also value 1. So a question for www.example.com A IN is the 17-byte
name plus 00 01 00 01, twenty-one bytes total.
That is the entire question format. QTYPE reuses the same numbering as record types
const (TypeA uint16 = 1ClassIN uint16 = 1)func encodeQuestion(name string, qtype, qclass uint16) []byte {out := encodeName(name)out = append(out, putUint16(qtype)...)return append(out, putUint16(qclass)...)}