Resolver

open class Resolver(pointer: <Error class: unknown class><<Error class: unknown class>>)

The object that handles DNS resolution. Use func@Gio.Resolver.get_default to get the default resolver.

GResolver provides cancellable synchronous and asynchronous DNS resolution, for hostnames (method@Gio.Resolver.lookup_by_address, method@Gio.Resolver.lookup_by_name and their async variants) and SRV (service) records (method@Gio.Resolver.lookup_service).

class@Gio.NetworkAddress and class@Gio.NetworkService provide wrappers around GResolver functionality that also implement iface@Gio.SocketConnectable, making it easy to connect to a remote host/service.

The default resolver (see func@Gio.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.

Constructors

Link copied to clipboard
constructor(pointer: <Error class: unknown class><<Error class: unknown class>>)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
val gioResolverPointer: <Error class: unknown class><<Error class: unknown class>>
Link copied to clipboard
open var timeout: <Error class: unknown class>

The timeout applied to all resolver lookups, in milliseconds.

Functions

Link copied to clipboard
fun connectReload(connectFlags: <Error class: unknown class> = ConnectFlags(0u), handler: () -> Unit): <Error class: unknown class>

Emitted when the resolver notices that the system resolver configuration has changed.

Link copied to clipboard
open fun getTimeout(): <Error class: unknown class>

Get the timeout applied to all resolver lookups. See #GResolver:timeout.

Link copied to clipboard
open fun lookupByAddress(address: InetAddress, cancellable: Cancellable? = null): <Error class: unknown class><String>

Synchronously reverse-resolves @address to determine its associated hostname.

Link copied to clipboard
open fun lookupByAddressAsync(address: InetAddress, cancellable: Cancellable? = null, callback: AsyncReadyCallback)

Begins asynchronously reverse-resolving @address to determine its associated hostname, and eventually calls @callback, which must call g_resolver_lookup_by_address_finish() to get the final result.

Link copied to clipboard
open fun lookupByAddressFinish(result: AsyncResult): <Error class: unknown class><String>

Retrieves the result of a previous call to g_resolver_lookup_by_address_async().

Link copied to clipboard
open fun lookupByName(hostname: String, cancellable: Cancellable? = null): <Error class: unknown class><<Error class: unknown class>>

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 g_inet_address_new_from_string()).

Link copied to clipboard
open fun lookupByNameAsync(hostname: String, cancellable: Cancellable? = null, callback: AsyncReadyCallback)

Begins asynchronously resolving @hostname to determine its associated IP address(es), and eventually calls @callback, which must call g_resolver_lookup_by_name_finish() to get the result. See g_resolver_lookup_by_name() for more details.

Link copied to clipboard
open fun lookupByNameFinish(result: AsyncResult): <Error class: unknown class><<Error class: unknown class>>

Retrieves the result of a call to g_resolver_lookup_by_name_async().

Link copied to clipboard
open fun lookupByNameWithFlags(hostname: String, flags: ResolverNameLookupFlags, cancellable: Cancellable? = null): <Error class: unknown class><<Error class: unknown class>>

This differs from g_resolver_lookup_by_name() in that you can modify the lookup behavior with @flags. For example this can be used to limit results with %G_RESOLVER_NAME_LOOKUP_FLAGS_IPV4_ONLY.

Link copied to clipboard
open fun lookupByNameWithFlagsAsync(hostname: String, flags: ResolverNameLookupFlags, cancellable: Cancellable? = null, callback: AsyncReadyCallback)

Begins asynchronously resolving @hostname to determine its associated IP address(es), and eventually calls @callback, which must call g_resolver_lookup_by_name_with_flags_finish() to get the result. See g_resolver_lookup_by_name() for more details.

Link copied to clipboard
open fun lookupByNameWithFlagsFinish(result: AsyncResult): <Error class: unknown class><<Error class: unknown class>>

Retrieves the result of a call to g_resolver_lookup_by_name_with_flags_async().

Link copied to clipboard
open fun lookupRecords(rrname: String, recordType: ResolverRecordType, cancellable: Cancellable? = null): <Error class: unknown class><<Error class: unknown class>>

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.

Link copied to clipboard
open fun lookupRecordsAsync(rrname: String, recordType: ResolverRecordType, cancellable: Cancellable? = null, callback: AsyncReadyCallback)

Begins asynchronously performing a DNS lookup for the given

Link copied to clipboard
open fun lookupRecordsFinish(result: AsyncResult): <Error class: unknown class><<Error class: unknown class>>

Retrieves the result of a previous call to g_resolver_lookup_records_async(). Returns a non-empty list of records as #GVariant tuples. See #GResolverRecordType for information on what the records contain.

Link copied to clipboard
open fun lookupService(service: String, protocol: String, domain: String, cancellable: Cancellable? = null): <Error class: unknown class><<Error class: unknown class>>

Synchronously performs a DNS SRV lookup for the given @service and

Link copied to clipboard
open fun lookupServiceAsync(service: String, protocol: String, domain: String, cancellable: Cancellable? = null, callback: AsyncReadyCallback)

Begins asynchronously performing a DNS SRV lookup for the given

Link copied to clipboard
open fun lookupServiceFinish(result: AsyncResult): <Error class: unknown class><<Error class: unknown class>>

Retrieves the result of a previous call to g_resolver_lookup_service_async().

Link copied to clipboard
open fun setDefault()

Sets @resolver to be the application's default resolver (reffing

Link copied to clipboard
open fun setTimeout(timeoutMs: <Error class: unknown class>)

Set the timeout applied to all resolver lookups. See #GResolver:timeout.