module Dns_helper:dns_helper.mli --- Helpers to obtain relevant DNS information in a high level fashion.sig
..end
This API is part of ODNS library.
Copyright (C) 2011 Jehan Hysseo <hysseo at zemarmot point net>
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
"IN"
) class.
The goal is to keep these functions very simple to use, though they still do sometimes complex computations (like SRV), some verifications or multiple DNS queries.
If you need more control over the
whole querying process, you might want to have a look to the
Dns.query
resolver class, or more generally to the Dns
module.
val srv_lookup : ?configuration:Dns.resolver -> string -> (string * int) list
srv_lookup query
will return an (ip, port) list, for the requested
query
which must be in a SRV query format:
"_service._protocol.domain_name"
.
This list will be in a ready to try-and-connect order.
In other words, the developer should not reorder this list and should try to
connect to the returned (ip, port) combinations in the given order.
Implementation Note: The function will first lookup for SRV queries on the name server.
-1
port.
This allows a developper to not be blocked if he works with
services unknown on a user's system, or simply with experimental/custom
services not assigned by IANA."_service._protocol.domain_name"
.
In any case, it means either we don't have the information to connect OR that
you should not connect (first case). So your program should propose a graceful
alternative to the user when this happens (propose him to check he put the
right domain name in, to write explicit connection information, abandon,
etc.).configuration
: is a Dns.resolver
resolver, that you can optionally set if you
need particular configuration for any query which will be made (otherwise
default configuration is used). You cannot assume that this resolver will be
actually used for any query (it is more likely to be other resolvers with same
configuration) as it is used only as a configuration model. Still you
should not use any result which may be returned by this resolver after being
set a parameter here as you cannot know what is the last query (if any) which
has actually been made (we advice to Dns.resolver.reset_queries
it if you
want to use it after).val a_lookup : ?configuration:Dns.resolver -> string -> string list
a_lookup domain
will make necessary queries to return IPv4 addresses for a
given domain
.configuration
: is a Dns.resolver
resolver, that you can optionally set if you
need particular configuration for any query which will be made (otherwise
default configuration is used). You cannot assume that this resolver will be
actually used for any query (it is more likely to be other resolvers with same
configuration) as it is used only as a configuration model. Still you
should not use any result which may be returned by this resolver after being
set a parameter here as you cannot know what is the last query (if any) which
has actually been made (we advice to Dns.resolver.reset_queries
it if you
want to use it after).val aaaa_lookup : ?configuration:Dns.resolver -> string -> string list
aaaa_lookup domain
will return the IPv6 addresses associated to domain
.configuration
: is a Dns.resolver
resolver, that you can optionally set if you
need particular configuration for any query which will be made (otherwise
default configuration is used). You cannot assume that this resolver will be
actually used for any query (it is more likely to be other resolvers with same
configuration) as it is used only as a configuration model. Still you
should not use any result which may be returned by this resolver after being
set a parameter here as you cannot know what is the last query (if any) which
has actually been made (we advice to Dns.resolver.reset_queries
it if you
want to use it after).val address_lookup : ?configuration:Dns.resolver -> string -> string list
address_lookup domain
requests both IPv4 and IPv6 addresses of domain
.
(basically Dns_helper.a_lookup
and Dns_helper.aaaa_lookup
concatanated).configuration
: is a Dns.resolver
resolver, that you can optionally set if you
need particular configuration for any query which will be made (otherwise
default configuration is used). You cannot assume that this resolver will be
actually used for any query (it is more likely to be other resolvers with same
configuration) as it is used only as a configuration model. Still you
should not use any result which may be returned by this resolver after being
set a parameter here as you cannot know what is the last query (if any) which
has actually been made (we advice to Dns.resolver.reset_queries
it if you
want to use it after).