From c729cdd971b67216c3ae82d185c8bbdd78e85639 Mon Sep 17 00:00:00 2001 From: Miek Gieben Date: Mon, 17 Jan 2011 10:51:33 +0100 Subject: [PATCH] Add nsid to q --- TODO | 2 ++ _examples/q/q.go | 9 ++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/TODO b/TODO index d73df2d5..5b9dc21e 100644 --- a/TODO +++ b/TODO @@ -1,5 +1,6 @@ Todo: * NSEC3 - need base32 for Nsec3 +* Documentation * Cleanup the code * Cleanup the API * Tsig testing @@ -8,6 +9,7 @@ Todo: Longer term: * Parsing from strings, going with goyacc and own lexer +* Multi line output? Issues: * escaped dots in names \. diff --git a/_examples/q/q.go b/_examples/q/q.go index 4d91c515..65cdef48 100644 --- a/_examples/q/q.go +++ b/_examples/q/q.go @@ -18,6 +18,7 @@ func main() { var cd *bool = flag.Bool("cd", false, "Set CD flag in query") var rd *bool = flag.Bool("rd", true, "Unset RD flag in query") var tcp *bool = flag.Bool("tcp", false, "TCP mode") + var nsid *bool = flag.Bool("nsid", false, "Ask for the NSID") flag.Usage = func() { fmt.Fprintf(os.Stderr, "Usage: %s [@server] [qtype] [qclass] [name ...]\n", os.Args[0]) flag.PrintDefaults() @@ -77,15 +78,21 @@ FLAGS: m.MsgHdr.CheckingDisabled = *cd m.MsgHdr.RecursionDesired = *rd m.Question = make([]dns.Question, 1) - if *dnssec { + if *dnssec || *nsid { opt := new(dns.RR_OPT) opt.Hdr = dns.RR_Header{Name: "", Rrtype: dns.TypeOPT} opt.SetVersion(0) opt.SetDo() opt.SetUDPSize(4096) + if *nsid { + opt.Option = make([]dns.Option, 1) + opt.Option[0].Code = dns.OptionCodeNSID + opt.Option[0].Data = "" + } m.Extra = make([]dns.RR, 1) m.Extra[0] = opt } + for _, v := range qname { m.Question[0] = dns.Question{v, qtype, qclass} m.SetId()