It derives from <GObject>.
The object that handles DNS resolution. Use resolver:get-default to get the default resolver.
<GResolver> provides cancellable synchronous and
asynchronous DNS resolution, for hostnames (resolver:lookup-by-address, resolver:lookup-by-name and their async variants) and
SRV (service) records (resolver:lookup-service).
<GNetworkAddress> and
<GNetworkService> provide wrappers around
<GResolver> functionality that also implement
<GSocketConnectable>, making it easy to
connect to a remote host/service.
The default resolver (see resolver:get-default) has a timeout of 30s set on it
since GLib 2.78. Earlier versions of GLib did not support resolver
timeouts.
This is an abstract type; subclasses of it implement different resolvers for different platforms and situations.
parent-instanceprivThe timeout applied to all resolver lookups, in milliseconds.
This may be changed through the lifetime of the
<GResolver>. The new value will apply to any
lookups started after the change, but not to any already-ongoing
lookups.
If this is 0, no timeout is applied to lookups.
No timeout was applied to lookups before this property was added in GLib 2.78.
Its value is an unsigned 32-bit integer.
Set it with (set! (resolver:timeout self) value).
Gets the default <GResolver>. You should unref
it when you are done with it. <GResolver> may
use its reference count as a hint about how many threads it should
allocate for concurrent DNS resolutions.
Returned: a <GResolver>.
the default <GResolver>.
Get the timeout applied to all resolver lookups. See
resolver:timeout.
Passed: a <GResolver>.
Returned: an unsigned 32-bit integer.
the resolver timeout, in milliseconds, or 0 for no timeout
Synchronously reverse-resolves address to determine its associated hostname.
If the DNS resolution fails, error (if non-#f) will be set
to a value from <GResolverError>.
If cancellable is non-#f, it can be used to cancel the
operation, in which case error (if non-#f) will be set to
cancelled.
Passed: a <GResolver>.
Passed: a <GInetAddress>.
the address to reverse-resolve
Passed, or left out: a <GCancellable>, or
#f.
a <GCancellable>, or #f
Returned: a string.
a hostname (either ASCII-only, or in ASCII-encoded form), or #f
on error.
Begins asynchronously reverse-resolving address to determine its
associated hostname, and eventually calls callback, which must
call resolver:lookup-by-address-finish to get the
final result.
Passed: a <GResolver>.
Passed: a <GInetAddress>.
the address to reverse-resolve
Passed, or left out: a <GCancellable>, or
#f.
a <GCancellable>, or #f
Passed, or left out: a procedure, or #f.
callback to call after resolution completes
See GAsyncReadyCallback for how it is
called.
Not passed: guile-gi supplies it.
data for callback
Retrieves the result of a previous call to resolver:lookup-by-address-async.
If the DNS resolution failed, error (if non-#f) will be set
to a value from <GResolverError>. If the
operation was cancelled, error will be set to
cancelled.
Passed: a <GResolver>.
Passed: a <GAsyncResult>.
the result passed to your
GAsyncReadyCallback
Returned: a string.
a hostname (either ASCII-only, or in ASCII-encoded form), or #f
on error.
Synchronously resolves hostname to determine its associated IP
address(es). hostname may be an ASCII-only or UTF-8 hostname, or
the textual form of an IP address (in which case this just becomes a
wrapper around inet-address:new-from-string).
On success, resolver:lookup-by-name will return a non-empty
GList of <GInetAddress>, sorted in
order of preference and guaranteed to not contain duplicates. That is,
if using the result to connect to hostname, you should attempt to
connect to the first address first, then the second if the first fails,
etc. If you are using the result to listen on a socket, it is
appropriate to add each result using e.g. socket-listener:add-address.
If the DNS resolution fails, error (if non-#f) will be set
to a value from <GResolverError> and
#f will be returned.
If cancellable is non-#f, it can be used to cancel the
operation, in which case error (if non-#f) will be set to
cancelled.
If you are planning to connect to a socket on the resolved IP address,
it may be easier to create a
<GNetworkAddress> and use its
<GSocketConnectable> interface.
Passed: a <GResolver>.
Passed: a string.
the hostname to look up
Passed, or left out: a <GCancellable>, or
#f.
a <GCancellable>, or #f
Returned: a list, each a <GInetAddress>.
a non-empty GList of <GInetAddress>, or
#f on error. You must unref each of the addresses and free the
list when you are done with it. (You can use
g_resolver_free_addresses() to do this.)
Begins asynchronously resolving hostname to determine its
associated IP address(es), and eventually calls callback, which
must call resolver:lookup-by-name-finish to get the
result. See resolver:lookup-by-name for more details.
Passed: a <GResolver>.
Passed: a string.
the hostname to look up the address of
Passed, or left out: a <GCancellable>, or
#f.
a <GCancellable>, or #f
Passed, or left out: a procedure, or #f.
callback to call after resolution completes
See GAsyncReadyCallback for how it is
called.
Not passed: guile-gi supplies it.
data for callback
Retrieves the result of a call to resolver:lookup-by-name-async.
If the DNS resolution failed, error (if non-#f) will be set
to a value from <GResolverError>. If the
operation was cancelled, error will be set to
cancelled.
Passed: a <GResolver>.
Passed: a <GAsyncResult>.
the result passed to your
GAsyncReadyCallback
Returned: a list, each a <GInetAddress>.
a GList of <GInetAddress>, or #f
on error. See resolver:lookup-by-name for more details.
This differs from resolver:lookup-by-name in that you can modify the
lookup behavior with flags. For example this can be used to limit
results with ipv4-only.
Passed: a <GResolver>.
Passed: a string.
the hostname to look up
Passed: a
<GResolverNameLookupFlags>, or a
list of its symbols, or one of them.
extra <GResolverNameLookupFlags>
for the lookup
Passed, or left out: a <GCancellable>, or
#f.
a <GCancellable>, or #f
Returned: a list, each a <GInetAddress>.
a non-empty GList of <GInetAddress>, or
#f on error. You must unref each of the addresses and free the
list when you are done with it. (You can use
g_resolver_free_addresses() to do this.)
Begins asynchronously resolving hostname to determine its
associated IP address(es), and eventually calls callback, which
must call resolver:lookup-by-name-with-flags-finish
to get the result. See resolver:lookup-by-name for more details.
Passed: a <GResolver>.
Passed: a string.
the hostname to look up the address of
Passed: a
<GResolverNameLookupFlags>, or a
list of its symbols, or one of them.
extra <GResolverNameLookupFlags>
for the lookup
Passed, or left out: a <GCancellable>, or
#f.
a <GCancellable>, or #f
Passed, or left out: a procedure, or #f.
callback to call after resolution completes
See GAsyncReadyCallback for how it is
called.
Not passed: guile-gi supplies it.
data for callback
Retrieves the result of a call to resolver:lookup-by-name-with-flags-async.
If the DNS resolution failed, error (if non-#f) will be set
to a value from <GResolverError>. If the
operation was cancelled, error will be set to
cancelled.
Passed: a <GResolver>.
Passed: a <GAsyncResult>.
the result passed to your
GAsyncReadyCallback
Returned: a list, each a <GInetAddress>.
a GList of <GInetAddress>, or #f
on error. See resolver:lookup-by-name for more details.
Synchronously performs a DNS record lookup for the given rrname
and returns a list of records as <GVariant>
tuples. See <GResolverRecordType> for
information on what the records contain for each record-type.
If the DNS resolution fails, error (if non-#f) will be set
to a value from <GResolverError> and
#f will be returned.
If cancellable is non-#f, it can be used to cancel the
operation, in which case error (if non-#f) will be set to
cancelled.
Passed: a <GResolver>.
Passed: a string.
the DNS name to look up the record for
Passed: a <GResolverRecordType>, or one
of its symbols.
the type of DNS record to look up
Passed, or left out: a <GCancellable>, or
#f.
a <GCancellable>, or #f
Returned: a list, each a <GVariant>.
a non-empty GList of <GVariant>, or
#f on error. You must free each of the records and the list when
you are done with it. (You can use g_list_free_full() with
variant:unref to do this.)
Begins asynchronously performing a DNS lookup for the given
rrname, and eventually calls callback, which must call
resolver:lookup-records-finish to get the final
result. See resolver:lookup-records for more details.
Passed: a <GResolver>.
Passed: a string.
the DNS name to look up the record for
Passed: a <GResolverRecordType>, or one
of its symbols.
the type of DNS record to look up
Passed, or left out: a <GCancellable>, or
#f.
a <GCancellable>, or #f
Passed, or left out: a procedure, or #f.
callback to call after resolution completes
See GAsyncReadyCallback for how it is
called.
Not passed: guile-gi supplies it.
data for callback
Retrieves the result of a previous call to resolver:lookup-records-async. Returns a
non-empty list of records as <GVariant>
tuples. See <GResolverRecordType> for
information on what the records contain.
If the DNS resolution failed, error (if non-#f) will be set
to a value from <GResolverError>. If the
operation was cancelled, error will be set to
cancelled.
Passed: a <GResolver>.
Passed: a <GAsyncResult>.
the result passed to your
GAsyncReadyCallback
Returned: a list, each a <GVariant>.
a non-empty GList of <GVariant>, or
#f on error. You must free each of the records and the list when
you are done with it. (You can use g_list_free_full() with
variant:unref to do this.)
Synchronously performs a DNS SRV lookup for the given service and
protocol in the given domain and returns an array of
<GSrvTarget>. domain may be an ASCII-only
or UTF-8 hostname. Note also that the service and protocol
arguments do not include the leading underscore that appears in the
actual DNS entry.
On success, resolver:lookup-service will return a non-empty
GList of <GSrvTarget>, sorted in order of
preference. (That is, you should attempt to connect to the first target
first, then the second if the first fails, etc.)
If the DNS resolution fails, error (if non-#f) will be set
to a value from <GResolverError> and
#f will be returned.
If cancellable is non-#f, it can be used to cancel the
operation, in which case error (if non-#f) will be set to
cancelled.
If you are planning to connect to the service, it is usually easier to
create a <GNetworkService> and use its
<GSocketConnectable> interface.
Passed: a <GResolver>.
Passed: a string.
the service type to look up (eg, "ldap")
Passed: a string.
the networking protocol to use for service (eg, "tcp")
Passed: a string.
the DNS domain to look up the service in
Passed, or left out: a <GCancellable>, or
#f.
a <GCancellable>, or #f
Returned: a list, each a <GSrvTarget>.
a non-empty GList of <GSrvTarget>, or
#f on error. You must free each of the targets and the list when
you are done with it. (You can use g_resolver_free_targets() to
do this.)
Begins asynchronously performing a DNS SRV lookup for the given
service and protocol in the given domain, and
eventually calls callback, which must call resolver:lookup-service-finish to get the final
result. See resolver:lookup-service for more details.
Passed: a <GResolver>.
Passed: a string.
the service type to look up (eg, "ldap")
Passed: a string.
the networking protocol to use for service (eg, "tcp")
Passed: a string.
the DNS domain to look up the service in
Passed, or left out: a <GCancellable>, or
#f.
a <GCancellable>, or #f
Passed, or left out: a procedure, or #f.
callback to call after resolution completes
See GAsyncReadyCallback for how it is
called.
Not passed: guile-gi supplies it.
data for callback
Retrieves the result of a previous call to resolver:lookup-service-async.
If the DNS resolution failed, error (if non-#f) will be set
to a value from <GResolverError>. If the
operation was cancelled, error will be set to
cancelled.
Passed: a <GResolver>.
Passed: a <GAsyncResult>.
the result passed to your
GAsyncReadyCallback
Returned: a list, each a <GSrvTarget>.
a non-empty GList of <GSrvTarget>, or
#f on error. See resolver:lookup-service for more details.
Sets self to be the application’s default resolver (reffing
self, and unreffing the previous default resolver, if any). Future
calls to resolver:get-default will
return this resolver.
This can be used if an application wants to perform any sort of DNS
caching or "pinning"; it can implement its own
<GResolver> that calls the original default
resolver for DNS operations, and implements its own cache policies on
top of that, and then set itself as the default resolver for all later
code to use.
Passed: a <GResolver>.
the new default <GResolver>
Set the timeout applied to all resolver lookups. See
resolver:timeout.
Passed: a <GResolver>.
Passed: an unsigned 32-bit integer.
timeout in milliseconds, or 0 for no timeouts
Connect a handler with (connect object resolver:reload handler).
It is called as (handler self).
Emitted when the resolver notices that the system resolver configuration has changed.
Passed: a <GResolver>.
Synchronously reverse-resolves address to determine its associated hostname.
If the DNS resolution fails, error (if non-#f) will be set
to a value from <GResolverError>.
If cancellable is non-#f, it can be used to cancel the
operation, in which case error (if non-#f) will be set to
cancelled.
To override it in a new class, give register-type #:vfuncs
`((lookup-by-address . ,procedure)). The procedure is called as
(procedure self address cancellable) ⇒ %return.
Passed: the class whose implementation to call:
<GResolver>, or a class that derives from it, or
its GType number.
Passed: a <GResolver>.
Passed: a <GInetAddress>.
the address to reverse-resolve
Passed, or left out: a <GCancellable>, or
#f.
a <GCancellable>, or #f
Returned: a string.
a hostname (either ASCII-only, or in ASCII-encoded form), or #f
on error.
Begins asynchronously reverse-resolving address to determine its
associated hostname, and eventually calls callback, which must
call resolver:lookup-by-address-finish to get the
final result.
To override it in a new class, give register-type #:vfuncs
`((lookup-by-address-async . ,procedure)). The procedure is called as
(procedure self address cancellable callback user-data).
Passed: the class whose implementation to call:
<GResolver>, or a class that derives from it, or
its GType number.
Passed: a <GResolver>.
Passed: a <GInetAddress>.
the address to reverse-resolve
Passed, or left out: a <GCancellable>, or
#f.
a <GCancellable>, or #f
Passed, or left out: a procedure, or #f.
callback to call after resolution completes
See GAsyncReadyCallback for how it is
called.
Not passed: guile-gi supplies it.
data for callback
Retrieves the result of a previous call to resolver:lookup-by-address-async.
If the DNS resolution failed, error (if non-#f) will be set
to a value from <GResolverError>. If the
operation was cancelled, error will be set to
cancelled.
To override it in a new class, give register-type #:vfuncs
`((lookup-by-address-finish . ,procedure)). The procedure is called
as (procedure self result) ⇒ %return.
Passed: the class whose implementation to call:
<GResolver>, or a class that derives from it, or
its GType number.
Passed: a <GResolver>.
Passed: a <GAsyncResult>.
the result passed to your
GAsyncReadyCallback
Returned: a string.
a hostname (either ASCII-only, or in ASCII-encoded form), or #f
on error.
Synchronously resolves hostname to determine its associated IP
address(es). hostname may be an ASCII-only or UTF-8 hostname, or
the textual form of an IP address (in which case this just becomes a
wrapper around inet-address:new-from-string).
On success, resolver:lookup-by-name will return a non-empty
GList of <GInetAddress>, sorted in
order of preference and guaranteed to not contain duplicates. That is,
if using the result to connect to hostname, you should attempt to
connect to the first address first, then the second if the first fails,
etc. If you are using the result to listen on a socket, it is
appropriate to add each result using e.g. socket-listener:add-address.
If the DNS resolution fails, error (if non-#f) will be set
to a value from <GResolverError> and
#f will be returned.
If cancellable is non-#f, it can be used to cancel the
operation, in which case error (if non-#f) will be set to
cancelled.
If you are planning to connect to a socket on the resolved IP address,
it may be easier to create a
<GNetworkAddress> and use its
<GSocketConnectable> interface.
To override it in a new class, give register-type #:vfuncs
`((lookup-by-name . ,procedure)). The procedure is called as
(procedure self hostname cancellable) ⇒ %return.
Passed: the class whose implementation to call:
<GResolver>, or a class that derives from it, or
its GType number.
Passed: a <GResolver>.
Passed: a string.
the hostname to look up
Passed, or left out: a <GCancellable>, or
#f.
a <GCancellable>, or #f
Returned: a list, each a <GInetAddress>.
a non-empty GList of <GInetAddress>, or
#f on error. You must unref each of the addresses and free the
list when you are done with it. (You can use
g_resolver_free_addresses() to do this.)
Begins asynchronously resolving hostname to determine its
associated IP address(es), and eventually calls callback, which
must call resolver:lookup-by-name-finish to get the
result. See resolver:lookup-by-name for more details.
To override it in a new class, give register-type #:vfuncs
`((lookup-by-name-async . ,procedure)). The procedure is called as
(procedure self hostname cancellable callback user-data).
Passed: the class whose implementation to call:
<GResolver>, or a class that derives from it, or
its GType number.
Passed: a <GResolver>.
Passed: a string.
the hostname to look up the address of
Passed, or left out: a <GCancellable>, or
#f.
a <GCancellable>, or #f
Passed, or left out: a procedure, or #f.
callback to call after resolution completes
See GAsyncReadyCallback for how it is
called.
Not passed: guile-gi supplies it.
data for callback
Retrieves the result of a call to resolver:lookup-by-name-async.
If the DNS resolution failed, error (if non-#f) will be set
to a value from <GResolverError>. If the
operation was cancelled, error will be set to
cancelled.
To override it in a new class, give register-type #:vfuncs
`((lookup-by-name-finish . ,procedure)). The procedure is called as
(procedure self result) ⇒ %return.
Passed: the class whose implementation to call:
<GResolver>, or a class that derives from it, or
its GType number.
Passed: a <GResolver>.
Passed: a <GAsyncResult>.
the result passed to your
GAsyncReadyCallback
Returned: a list, each a <GInetAddress>.
a GList of <GInetAddress>, or #f
on error. See resolver:lookup-by-name for more details.
This differs from resolver:lookup-by-name in that you can modify the
lookup behavior with flags. For example this can be used to limit
results with ipv4-only.
To override it in a new class, give register-type #:vfuncs
`((lookup-by-name-with-flags . ,procedure)). The procedure is called
as (procedure self hostname flags cancellable) ⇒ %return.
Passed: the class whose implementation to call:
<GResolver>, or a class that derives from it, or
its GType number.
Passed: a <GResolver>.
Passed: a string.
the hostname to look up
Passed: a
<GResolverNameLookupFlags>, or a
list of its symbols, or one of them.
extra <GResolverNameLookupFlags>
for the lookup
Passed, or left out: a <GCancellable>, or
#f.
a <GCancellable>, or #f
Returned: a list, each a <GInetAddress>.
a non-empty GList of <GInetAddress>, or
#f on error. You must unref each of the addresses and free the
list when you are done with it. (You can use
g_resolver_free_addresses() to do this.)
Begins asynchronously resolving hostname to determine its
associated IP address(es), and eventually calls callback, which
must call resolver:lookup-by-name-with-flags-finish
to get the result. See resolver:lookup-by-name for more details.
To override it in a new class, give register-type #:vfuncs
`((lookup-by-name-with-flags-async . ,procedure)). The procedure is
called as (procedure self hostname flags cancellable callback
user-data).
Passed: the class whose implementation to call:
<GResolver>, or a class that derives from it, or
its GType number.
Passed: a <GResolver>.
Passed: a string.
the hostname to look up the address of
Passed: a
<GResolverNameLookupFlags>, or a
list of its symbols, or one of them.
extra <GResolverNameLookupFlags>
for the lookup
Passed, or left out: a <GCancellable>, or
#f.
a <GCancellable>, or #f
Passed, or left out: a procedure, or #f.
callback to call after resolution completes
See GAsyncReadyCallback for how it is
called.
Not passed: guile-gi supplies it.
data for callback
Retrieves the result of a call to resolver:lookup-by-name-with-flags-async.
If the DNS resolution failed, error (if non-#f) will be set
to a value from <GResolverError>. If the
operation was cancelled, error will be set to
cancelled.
To override it in a new class, give register-type #:vfuncs
`((lookup-by-name-with-flags-finish . ,procedure)). The procedure is
called as (procedure self result) ⇒ %return.
Passed: the class whose implementation to call:
<GResolver>, or a class that derives from it, or
its GType number.
Passed: a <GResolver>.
Passed: a <GAsyncResult>.
the result passed to your
GAsyncReadyCallback
Returned: a list, each a <GInetAddress>.
a GList of <GInetAddress>, or #f
on error. See resolver:lookup-by-name for more details.
Synchronously performs a DNS record lookup for the given rrname
and returns a list of records as <GVariant>
tuples. See <GResolverRecordType> for
information on what the records contain for each record-type.
If the DNS resolution fails, error (if non-#f) will be set
to a value from <GResolverError> and
#f will be returned.
If cancellable is non-#f, it can be used to cancel the
operation, in which case error (if non-#f) will be set to
cancelled.
To override it in a new class, give register-type #:vfuncs
`((lookup-records . ,procedure)). The procedure is called as
(procedure self rrname record-type cancellable) ⇒ %return.
Passed: the class whose implementation to call:
<GResolver>, or a class that derives from it, or
its GType number.
Passed: a <GResolver>.
Passed: a string.
the DNS name to look up the record for
Passed: a <GResolverRecordType>, or one
of its symbols.
the type of DNS record to look up
Passed, or left out: a <GCancellable>, or
#f.
a <GCancellable>, or #f
Returned: a list, each a <GVariant>.
a non-empty GList of <GVariant>, or
#f on error. You must free each of the records and the list when
you are done with it. (You can use g_list_free_full() with
variant:unref to do this.)
Begins asynchronously performing a DNS lookup for the given
rrname, and eventually calls callback, which must call
resolver:lookup-records-finish to get the final
result. See resolver:lookup-records for more details.
To override it in a new class, give register-type #:vfuncs
`((lookup-records-async . ,procedure)). The procedure is called as
(procedure self rrname record-type cancellable callback
user-data).
Passed: the class whose implementation to call:
<GResolver>, or a class that derives from it, or
its GType number.
Passed: a <GResolver>.
Passed: a string.
the DNS name to look up the record for
Passed: a <GResolverRecordType>, or one
of its symbols.
the type of DNS record to look up
Passed, or left out: a <GCancellable>, or
#f.
a <GCancellable>, or #f
Passed, or left out: a procedure, or #f.
callback to call after resolution completes
See GAsyncReadyCallback for how it is
called.
Not passed: guile-gi supplies it.
data for callback
Retrieves the result of a previous call to resolver:lookup-records-async. Returns a
non-empty list of records as <GVariant>
tuples. See <GResolverRecordType> for
information on what the records contain.
If the DNS resolution failed, error (if non-#f) will be set
to a value from <GResolverError>. If the
operation was cancelled, error will be set to
cancelled.
To override it in a new class, give register-type #:vfuncs
`((lookup-records-finish . ,procedure)). The procedure is called as
(procedure self result) ⇒ %return.
Passed: the class whose implementation to call:
<GResolver>, or a class that derives from it, or
its GType number.
Passed: a <GResolver>.
Passed: a <GAsyncResult>.
the result passed to your
GAsyncReadyCallback
Returned: a list, each a <GVariant>.
a non-empty GList of <GVariant>, or
#f on error. You must free each of the records and the list when
you are done with it. (You can use g_list_free_full() with
variant:unref to do this.)
To override it in a new class, give register-type #:vfuncs
`((lookup-service-async . ,procedure)). The procedure is called as
(procedure self rrname cancellable callback user-data).
Passed: the class whose implementation to call:
<GResolver>, or a class that derives from it, or
its GType number.
Passed: a <GResolver>.
Passed: a string.
Passed, or left out: a <GCancellable>, or
#f.
Passed, or left out: a procedure, or #f.
See GAsyncReadyCallback for how it is
called.
Not passed: guile-gi supplies it.
Retrieves the result of a previous call to resolver:lookup-service-async.
If the DNS resolution failed, error (if non-#f) will be set
to a value from <GResolverError>. If the
operation was cancelled, error will be set to
cancelled.
To override it in a new class, give register-type #:vfuncs
`((lookup-service-finish . ,procedure)). The procedure is called as
(procedure self result) ⇒ %return.
Passed: the class whose implementation to call:
<GResolver>, or a class that derives from it, or
its GType number.
Passed: a <GResolver>.
Passed: a <GAsyncResult>.
the result passed to your
GAsyncReadyCallback
Returned: a list, each a <GSrvTarget>.
a non-empty GList of <GSrvTarget>, or
#f on error. See resolver:lookup-service for more details.
To override it in a new class, give register-type #:vfuncs
`((reload . ,procedure)). The procedure is called as (procedure
self).
Passed: the class whose implementation to call:
<GResolver>, or a class that derives from it, or
its GType number.
Passed: a <GResolver>.