]>
git.ipfire.org Git - thirdparty/pdns.git/blob - pdns/stubquery.cc
4 #include "arguments.hh"
5 #include "dnsrecords.hh"
6 #include "dns_random.hh"
7 #include "stubresolver.hh"
14 static ArgvMap theArg
;
19 cerr
<<"stubquery"<<endl
;
20 cerr
<<"Syntax: stubquery QUESTION [QUESTION-TYPE]"<<endl
;
23 int main(int argc
, char** argv
)
29 for(int i
=1; i
<argc
; i
++) {
30 if ((string
) argv
[i
] == "--help") {
35 if ((string
) argv
[i
] == "--version") {
36 cerr
<<"stubquery "<<VERSION
<<endl
;
46 string
type(argc
== 2 ? "A" : argv
[2]);
48 ::arg().set("resolver","Use this resolver for ALIAS and the internal stub resolver")="no";
51 stubParseResolveConf();
53 vector
<DNSZoneRecord
> ret
;
55 int res
=stubDoResolve(DNSName(argv
[1]), DNSRecordContent::TypeToNumber(type
), ret
);
57 cout
<<"res: "<<res
<<endl
;
58 for(const auto& r
: ret
) {
59 cout
<<r
.dr
.getContent()->getZoneRepresentation()<<endl
;
62 catch(std::exception
&e
)
64 cerr
<<"Fatal: "<<e
.what()<<endl
;
66 catch(PDNSException
&e
)
68 cerr
<<"Fatal: "<<e
.reason
<<endl
;