module Uq_resolver:sig
..end
The plugin mechanism allows one to change the name resovler Ocamlnet
uses. Resolvers can be both synchronous or asynchronous. Note however,
that the default resolver is synchronous and simply bases on
Unix.gethostbyname
.
Requirements of the resolver:
Unix.inet_addr
.Uq_engines
, here only
redefined for systematic reasonstype't
engine_state =[ `Aborted | `Done of 't | `Error of exn | `Working of int ]
class type['t]
engine =object
..end
exception Host_not_found of string
class type resolver =object
..end
val get_host_by_name : ?resolver:resolver -> string -> Unix.host_entry
Host_not_found
.
If a resolver
is passed, this resolver is used, otherwise the
pluggable resolver is used.
val sockaddr_of_socksymbol : ?resolver:resolver -> Netsockaddr.socksymbol -> Unix.sockaddr
Netsockaddr.socksymbol
,
and convert the symbol to a Unix.sockaddr
only containing IP
addresses.
If a resolver
is passed, this resolver is used, otherwise the
pluggable resolver is used.
val default_resolver : unit -> resolver
Unix.gethostbyname
to look up names.
Note that this means that no IPv6 addresses are returned.val gai_resolver : ?ipv4:bool -> ?ipv6:bool -> unit -> resolver
Unix.getaddrinfo
. One can set whether IPv4
or IPv6 addresses may be returned (only one type is returned).
The order of addresses cannot
be set, but there is a global config file /etc/gai.info
.
The h_aliases
field of the result is not set.
By default, both ipv4
and ipv6
are enabled.
val current_resolver : unit -> resolver
set_current_resolver
, the returned resolver depends on the result
of Netsys.is_ipv6_system
.val set_current_resolver : resolver -> unit