class resolver :DNS resolver.object
..end
method reset_queries : unit
NOTE: when doing this, answers
, authorities
and additionals
are
reseted as well as though the resolver was new.
This methods allows the same resolver to be used multiple times with the
same configuration.
method add_query : ?qtype:string -> ?qclass:string -> qname:string -> unit
add_query ~qname ~qtype ~qclass
adds a new query to the packet.
The exceptions Dns.Unknown_type
and Dns.Unknown_class
may occurre when a
support of a query type or class is missing in ODNS. If this was to
happen, you can still construct the query by adding the type and the class as
their integer value using Dns.resolver.raw_query
.
NOTE: when adding a query, answers
, authorities
and additionals
are
reseted as well as though the resolver was new, so that the answers are
always consistent to the current list of query.
Raises
Unknown_type
when qtype
does not correspond to a known resource
record.Unknown_class
when qclass
does not correspond to a known class.qtype
: the type of the query (default to "IN"
).qclass
: the class of the query (default to "A"
).qname
: the domain name queried.method query : unit
timeout
seconds and
retrying retries
times when failures occurred).method answers : rr list
Dns.resolver.query
.
Moreover this function has no meaning before you run Dns.resolver.query
(it would raise
).Name_error
when a queried domain name does not exist.Nameservers_failure
when all nameservers failed us and we got no
response (which does not mean there is none. We just don't know).Not_queried
when you try to get answers while you haven't actually
queried yet (with Dns.resolver.query
) or whether you have changed the query since the
last Dns.resolver.query
(with Dns.resolver.add_query
or Dns.resolver.reset_queries
).Dns.Name_error
or Dns.Nameservers_failure
).rr list
: Dns.resolver.query
.
Moreover this function has no meaning before you run Dns.resolver.query
(TODO: raise
an exception then).Name_error
when a queried domain name does not exist.Nameservers_failure
when all nameservers failed us and we got no
response (which does not mean there is none. We just don't know).Not_queried
when you try to get answers while you haven't actually
queried yet (with Dns.resolver.query
) or whether you have changed the query since the
last Dns.resolver.query
(with Dns.resolver.add_query
or Dns.resolver.reset_queries
).method additionals : rr list
Dns.resolver.query
.
Moreover this function has no meaning before you run Dns.resolver.query
(TODO: raise
an exception then).Name_error
when a queried domain name does not exist.Nameservers_failure
when all nameservers failed us and we got no
response (which does not mean there is none. We just don't know).Not_queried
when you try to get answers while you haven't actually
queried yet (with Dns.resolver.query
) or whether you have changed the query since the
last Dns.resolver.query
(with Dns.resolver.add_query
or Dns.resolver.reset_queries
).method nameservers : string list
method set_nameservers : string list -> unit
set_nameservers ns
sets the list ns
as the new list of nameservers.
Name servers will be tried and contacted in the order of the provided list.
As a special case, if an empty list is given, the system's default list of
name servers (from /etc/resolv.conf) will be used instead.
method set_nocache : bool -> unit
method nocache : bool
method timeout : float
method set_timeout : float -> unit
set_timeout t
sets a new timeout of t
seconds.
If you don't set any, the default value is 5 seconds.method retries : int
method set_retries : int -> unit
set_retries n
set to n
the number of time the resolver algorithm will
retry a same request on a same server when previous one failed.
As a special case, if you set it to a negative value, it will be equivalent
to 0
.
If you don't set this parameter, the default value is 1
.
method recursive : bool
true
if recursion is desired for the query to be sent.method set_recursive : bool -> unit
set_recursive true
makes so that the query will "ask" the name server
to use its recursive capabilities.method search_list : string list
man 5
resolv.conf
if you don't know what is the search list.method set_search_list : string list -> unit
set_search ns
sets the list ns
as the new search list.
Name servers will be tried and contacted in the order of the provided list.method verbose : Pervasives.out_channel option
method set_verbose : Pervasives.out_channel option -> unit
None
disables the verbose mode.
It is up to you to be sure the file can be written in and has not been
closed, though in any case, this function cannot crash.
It is also up to you to close this channel (if necessary) when all no
output should occurre again.
method ansi_capable : bool
method set_ansi_capable : bool -> unit
set_ansi_capable true
indicates that the verbose output channel is
ANSI capable. You might want to set this if the output is a terminal
emulator in order to color different kind of output for instance, but
disable it when outputing to a file.
Default to false
.method raw_response : message option
None
if all name servers timed out the query.method raw_query : message
raw_query
enables to study the generated DNS message which will be sent
over the wire.
Aware developers can also directly hack this message in order to exploit
DNS features non-supported by the ODNS library, for instance.
This should be done after running Dns.resolver.add_query
but before running Dns.resolver.query
.
Returns the DNS message used as a query.