package query import ( "git.froth.zone/sam/awl/cli" "git.froth.zone/sam/awl/internal/structs" "github.com/miekg/dns" ) func CreateQuery(opts cli.Options) (structs.Response, error) { var res structs.Response res.DNS = new(dns.Msg) res.DNS.SetQuestion(opts.Query, opts.Type) res.DNS.MsgHdr.Response = opts.QR res.DNS.MsgHdr.Authoritative = opts.AA res.DNS.MsgHdr.Truncated = opts.TC res.DNS.MsgHdr.RecursionDesired = opts.RD res.DNS.MsgHdr.RecursionAvailable = opts.RA res.DNS.MsgHdr.Zero = opts.Z res.DNS.MsgHdr.AuthenticatedData = opts.AD res.DNS.MsgHdr.CheckingDisabled = opts.CD if opts.DNSSEC { res.DNS.SetEdns0(1232, true) } resolver, err := LoadResolver(opts.Request.Server, opts) if err != nil { return structs.Response{}, err } return resolver.LookUp(res.DNS) }