gio.resolver

Module for [Resolver] class

Types 3

The object that handles DNS resolution. Use [gio.resolver.Resolver.getDefault] to get the default resolver.

[gio.resolver.Resolver] provides cancellable synchronous and asynchronous DNS resolution, for hostnames ([gio.resolver.Resolver.lookupByAddress], [gio.resolver.Resolver.lookupByName] and their async variants) and SRV (service) records ([gio.resolver.Resolver.lookupService]).

[gio.network_address.NetworkAddress] and [gio.network_service.NetworkService] provide wrappers around [gio.resolver.Resolver] functionality that also implement [gio.socket_connectable.SocketConnectable], making it easy to connect to a remote host/service.

The default resolver (see [gio.resolver.Resolver.getDefault]) 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.

Methods
GType _gType() @property
Resolver self()Returns `this`, for use in `with` statements.
ResolverGidBuilder builder()Get builder for [gio.resolver.Resolver] Returns: New builder object
uint timeout() @propertyGet `timeout` property. Returns: The timeout applied to all resolver lookups, in milliseconds.
void timeout(uint propval) @propertySet `timeout` property. Params: propval = The timeout applied to all resolver lookups, in milliseconds.
gio.resolver.Resolver getDefault()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...
uint getTimeout()Get the timeout applied to all resolver lookups. See #GResolver:timeout. Returns: the resolver timeout, in milliseconds, or `0` for no timeout
string lookupByAddress(gio.inet_address.InetAddress address, gio.cancellable.Cancellable cancellable = null)Synchronously reverse-resolves address to determine its associated hostname.
void lookupByAddressAsync(gio.inet_address.InetAddress address, gio.cancellable.Cancellable cancellable = null, gio.types.AsyncReadyCallback callback = null)Begins asynchronously reverse-resolving address to determine its associated hostname, and eventually calls callback, which must call [gio.resolver.Resolver.lookupByAddressFinish] to get the final r...
string lookupByAddressFinish(gio.async_result.AsyncResult result)Retrieves the result of a previous call to [gio.resolver.Resolver.lookupByAddressAsync].
gio.inet_address.InetAddress[] lookupByName(string hostname, gio.cancellable.Cancellable cancellable = null)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 ...
void lookupByNameAsync(string hostname, gio.cancellable.Cancellable cancellable = null, gio.types.AsyncReadyCallback callback = null)Begins asynchronously resolving hostname to determine its associated IP address(es), and eventually calls callback, which must call [gio.resolver.Resolver.lookupByNameFinish] to get the result. See...
gio.inet_address.InetAddress[] lookupByNameFinish(gio.async_result.AsyncResult result)Retrieves the result of a call to [gio.resolver.Resolver.lookupByNameAsync].
gio.inet_address.InetAddress[] lookupByNameWithFlags(string hostname, gio.types.ResolverNameLookupFlags flags, gio.cancellable.Cancellable cancellable = null)This differs from [gio.resolver.Resolver.lookupByName] in that you can modify the lookup behavior with flags. For example this can be used to limit results with [gio.types.ResolverNameLookupFlags.I...
void lookupByNameWithFlagsAsync(string hostname, gio.types.ResolverNameLookupFlags flags, gio.cancellable.Cancellable cancellable = null, gio.types.AsyncReadyCallback callback = null)Begins asynchronously resolving hostname to determine its associated IP address(es), and eventually calls callback, which must call [gio.resolver.Resolver.lookupByNameWithFlagsFinish] to get the re...
gio.inet_address.InetAddress[] lookupByNameWithFlagsFinish(gio.async_result.AsyncResult result)Retrieves the result of a call to [gio.resolver.Resolver.lookupByNameWithFlagsAsync].
glib.variant.Variant[] lookupRecords(string rrname, gio.types.ResolverRecordType recordType, gio.cancellable.Cancellable cancellable = null)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 reco...
void lookupRecordsAsync(string rrname, gio.types.ResolverRecordType recordType, gio.cancellable.Cancellable cancellable = null, gio.types.AsyncReadyCallback callback = null)Begins asynchronously performing a DNS lookup for the given rrname, and eventually calls callback, which must call [gio.resolver.Resolver.lookupRecordsFinish] to get the final result. See [gio.reso...
glib.variant.Variant[] lookupRecordsFinish(gio.async_result.AsyncResult result)Retrieves the result of a previous call to [gio.resolver.Resolver.lookupRecordsAsync]. Returns a non-empty list of records as #GVariant tuples. See #GResolverRecordType for information on what the ...
gio.srv_target.SrvTarget[] lookupService(string service, string protocol, string domain, gio.cancellable.Cancellable cancellable = null)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...
void lookupServiceAsync(string service, string protocol, string domain, gio.cancellable.Cancellable cancellable = null, gio.types.AsyncReadyCallback callback = null)Begins asynchronously performing a DNS SRV lookup for the given service and protocol in the given domain, and eventually calls callback, which must call [gio.resolver.Resolver.lookupServiceFinish] ...
gio.srv_target.SrvTarget[] lookupServiceFinish(gio.async_result.AsyncResult result)Retrieves the result of a previous call to [gio.resolver.Resolver.lookupServiceAsync].
void setDefault()Sets resolver to be the application's default resolver (reffing resolver, and unreffing the previous default resolver, if any). Future calls to [gio.resolver.Resolver.getDefault] will return this r...
void setTimeout(uint timeoutMs)Set the timeout applied to all resolver lookups. See #GResolver:timeout.
gulong connectReload(T)(T callback, Flag!"After" after = No.After) if (isCallable!T && is(ReturnType!T == void) && (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : gio.resolver.Resolver))) && Parameters!T.length < 2)Connect to `Reload` signal.
Constructors
this(void * ptr, Flag!"Take" take)
Methods
T timeout(uint propval)Set `timeout` property. Params: propval = The timeout applied to all resolver lookups, in milliseconds.

Fluent builder for [gio.resolver.Resolver]

Methods