m := new(dns.Msg) m.SetQuestion("example.com.", dns.TypeA) m.SetEdns0(4096, false) // set maximum UDP size to 4096
m := new(dns.Msg) m.SetQuestion("example.com.", dns.TypeSOA) m.SetEdns0(4096, true) // enable DNSSEC on this queryThis example is similar to the first, but we are setting the question section to query for the SOA record of example.com. We then call the SetEdns0() method again, but this time we enable DNSSEC on this query by setting the DNSSEC Ok flag to true. Overall, the github.com/miekg/dns package is a useful library for working with DNS messages in Go, providing several helpful methods like SetEdns0() for manipulating DNS packets.