[−][src]Trait gio::ResolverExt
Required methods
fn lookup_by_address<P: IsA<InetAddress>, Q: IsA<Cancellable>>(
&self,
address: &P,
cancellable: Option<&Q>
) -> Result<GString, Error>
&self,
address: &P,
cancellable: Option<&Q>
) -> Result<GString, Error>
Synchronously reverse-resolves address
to determine its
associated hostname.
If the DNS resolution fails, error
(if non-None
) will be set to
a value from ResolverError
.
If cancellable
is non-None
, it can be used to cancel the
operation, in which case error
(if non-None
) will be set to
IOErrorEnum::Cancelled
.
address
the address to reverse-resolve
cancellable
a Cancellable
, or None
Returns
a hostname (either ASCII-only, or in ASCII-encoded
form), or None
on error.
fn lookup_by_address_async<P: IsA<InetAddress>, Q: IsA<Cancellable>, R: FnOnce(Result<GString, Error>) + Send + 'static>(
&self,
address: &P,
cancellable: Option<&Q>,
callback: R
)
&self,
address: &P,
cancellable: Option<&Q>,
callback: R
)
Begins asynchronously reverse-resolving address
to determine its
associated hostname, and eventually calls callback
, which must
call ResolverExt::lookup_by_address_finish
to get the final result.
address
the address to reverse-resolve
cancellable
a Cancellable
, or None
callback
callback to call after resolution completes
user_data
data for callback
fn lookup_by_address_async_future<P: IsA<InetAddress> + Clone + 'static>(
&self,
address: &P
) -> Pin<Box_<dyn Future<Output = Result<GString, Error>> + 'static>>
&self,
address: &P
) -> Pin<Box_<dyn Future<Output = Result<GString, Error>> + 'static>>
fn lookup_by_name<P: IsA<Cancellable>>(
&self,
hostname: &str,
cancellable: Option<&P>
) -> Result<Vec<InetAddress>, Error>
&self,
hostname: &str,
cancellable: Option<&P>
) -> Result<Vec<InetAddress>, 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 InetAddress::new_from_string
).
On success, ResolverExt::lookup_by_name
will return a non-empty glib::List
of
InetAddress
, 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. SocketListenerExt::add_address
.
If the DNS resolution fails, error
(if non-None
) will be set to a
value from ResolverError
and None
will be returned.
If cancellable
is non-None
, it can be used to cancel the
operation, in which case error
(if non-None
) will be set to
IOErrorEnum::Cancelled
.
If you are planning to connect to a socket on the resolved IP
address, it may be easier to create a NetworkAddress
and use its
SocketConnectable
interface.
hostname
the hostname to look up
cancellable
a Cancellable
, or None
Returns
a non-empty glib::List
of InetAddress
, or None
on error. You
must unref each of the addresses and free the list when you are
done with it. (You can use Resolver::free_addresses
to do this.)
fn lookup_by_name_async<P: IsA<Cancellable>, Q: FnOnce(Result<Vec<InetAddress>, Error>) + Send + 'static>(
&self,
hostname: &str,
cancellable: Option<&P>,
callback: Q
)
&self,
hostname: &str,
cancellable: Option<&P>,
callback: Q
)
Begins asynchronously resolving hostname
to determine its
associated IP address(es), and eventually calls callback
, which
must call ResolverExt::lookup_by_name_finish
to get the result.
See ResolverExt::lookup_by_name
for more details.
hostname
the hostname to look up the address of
cancellable
a Cancellable
, or None
callback
callback to call after resolution completes
user_data
data for callback
fn lookup_by_name_async_future(
&self,
hostname: &str
) -> Pin<Box_<dyn Future<Output = Result<Vec<InetAddress>, Error>> + 'static>>
&self,
hostname: &str
) -> Pin<Box_<dyn Future<Output = Result<Vec<InetAddress>, Error>> + 'static>>
fn lookup_records<P: IsA<Cancellable>>(
&self,
rrname: &str,
record_type: ResolverRecordType,
cancellable: Option<&P>
) -> Result<Vec<Variant>, Error>
&self,
rrname: &str,
record_type: ResolverRecordType,
cancellable: Option<&P>
) -> Result<Vec<Variant>, Error>
Synchronously performs a DNS record lookup for the given rrname
and returns
a list of records as glib::Variant
tuples. See ResolverRecordType
for
information on what the records contain for each record_type
.
If the DNS resolution fails, error
(if non-None
) will be set to
a value from ResolverError
and None
will be returned.
If cancellable
is non-None
, it can be used to cancel the
operation, in which case error
(if non-None
) will be set to
IOErrorEnum::Cancelled
.
rrname
the DNS name to look up the record for
record_type
the type of DNS record to look up
cancellable
a Cancellable
, or None
Returns
a non-empty glib::List
of
glib::Variant
, or None
on error. You must free each of the records and the list
when you are done with it. (You can use glib::List::free_full
with
glib::Variant::unref
to do this.)
fn lookup_records_async<P: IsA<Cancellable>, Q: FnOnce(Result<Vec<Variant>, Error>) + Send + 'static>(
&self,
rrname: &str,
record_type: ResolverRecordType,
cancellable: Option<&P>,
callback: Q
)
&self,
rrname: &str,
record_type: ResolverRecordType,
cancellable: Option<&P>,
callback: Q
)
Begins asynchronously performing a DNS lookup for the given
rrname
, and eventually calls callback
, which must call
ResolverExt::lookup_records_finish
to get the final result. See
ResolverExt::lookup_records
for more details.
rrname
the DNS name to look up the record for
record_type
the type of DNS record to look up
cancellable
a Cancellable
, or None
callback
callback to call after resolution completes
user_data
data for callback
fn lookup_records_async_future(
&self,
rrname: &str,
record_type: ResolverRecordType
) -> Pin<Box_<dyn Future<Output = Result<Vec<Variant>, Error>> + 'static>>
&self,
rrname: &str,
record_type: ResolverRecordType
) -> Pin<Box_<dyn Future<Output = Result<Vec<Variant>, Error>> + 'static>>
fn lookup_service<P: IsA<Cancellable>>(
&self,
service: &str,
protocol: &str,
domain: &str,
cancellable: Option<&P>
) -> Result<Vec<SrvTarget>, Error>
&self,
service: &str,
protocol: &str,
domain: &str,
cancellable: Option<&P>
) -> Result<Vec<SrvTarget>, Error>
Synchronously performs a DNS SRV lookup for the given service
and
protocol
in the given domain
and returns an array of SrvTarget
.
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, ResolverExt::lookup_service
will return a non-empty glib::List
of
SrvTarget
, 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-None
) will be set to
a value from ResolverError
and None
will be returned.
If cancellable
is non-None
, it can be used to cancel the
operation, in which case error
(if non-None
) will be set to
IOErrorEnum::Cancelled
.
If you are planning to connect to the service, it is usually easier
to create a NetworkService
and use its SocketConnectable
interface.
service
the service type to look up (eg, "ldap")
protocol
the networking protocol to use for service
(eg, "tcp")
domain
the DNS domain to look up the service in
cancellable
a Cancellable
, or None
Returns
a non-empty glib::List
of
SrvTarget
, or None
on error. You must free each of the targets and the
list when you are done with it. (You can use Resolver::free_targets
to do
this.)
fn lookup_service_async<P: IsA<Cancellable>, Q: FnOnce(Result<Vec<SrvTarget>, Error>) + Send + 'static>(
&self,
service: &str,
protocol: &str,
domain: &str,
cancellable: Option<&P>,
callback: Q
)
&self,
service: &str,
protocol: &str,
domain: &str,
cancellable: Option<&P>,
callback: Q
)
Begins asynchronously performing a DNS SRV lookup for the given
service
and protocol
in the given domain
, and eventually calls
callback
, which must call ResolverExt::lookup_service_finish
to
get the final result. See ResolverExt::lookup_service
for more
details.
service
the service type to look up (eg, "ldap")
protocol
the networking protocol to use for service
(eg, "tcp")
domain
the DNS domain to look up the service in
cancellable
a Cancellable
, or None
callback
callback to call after resolution completes
user_data
data for callback
fn lookup_service_async_future(
&self,
service: &str,
protocol: &str,
domain: &str
) -> Pin<Box_<dyn Future<Output = Result<Vec<SrvTarget>, Error>> + 'static>>
&self,
service: &str,
protocol: &str,
domain: &str
) -> Pin<Box_<dyn Future<Output = Result<Vec<SrvTarget>, Error>> + 'static>>
fn set_default(&self)
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 Resolver
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.
fn connect_reload<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
Emitted when the resolver notices that the system resolver configuration has changed.
Implementors
impl<O: IsA<Resolver>> ResolverExt for O
[src]
fn lookup_by_address<P: IsA<InetAddress>, Q: IsA<Cancellable>>(
&self,
address: &P,
cancellable: Option<&Q>
) -> Result<GString, Error>
[src]
&self,
address: &P,
cancellable: Option<&Q>
) -> Result<GString, Error>
fn lookup_by_address_async<P: IsA<InetAddress>, Q: IsA<Cancellable>, R: FnOnce(Result<GString, Error>) + Send + 'static>(
&self,
address: &P,
cancellable: Option<&Q>,
callback: R
)
[src]
&self,
address: &P,
cancellable: Option<&Q>,
callback: R
)
fn lookup_by_address_async_future<P: IsA<InetAddress> + Clone + 'static>(
&self,
address: &P
) -> Pin<Box_<dyn Future<Output = Result<GString, Error>> + 'static>>
[src]
&self,
address: &P
) -> Pin<Box_<dyn Future<Output = Result<GString, Error>> + 'static>>
fn lookup_by_name<P: IsA<Cancellable>>(
&self,
hostname: &str,
cancellable: Option<&P>
) -> Result<Vec<InetAddress>, Error>
[src]
&self,
hostname: &str,
cancellable: Option<&P>
) -> Result<Vec<InetAddress>, Error>
fn lookup_by_name_async<P: IsA<Cancellable>, Q: FnOnce(Result<Vec<InetAddress>, Error>) + Send + 'static>(
&self,
hostname: &str,
cancellable: Option<&P>,
callback: Q
)
[src]
&self,
hostname: &str,
cancellable: Option<&P>,
callback: Q
)
fn lookup_by_name_async_future(
&self,
hostname: &str
) -> Pin<Box_<dyn Future<Output = Result<Vec<InetAddress>, Error>> + 'static>>
[src]
&self,
hostname: &str
) -> Pin<Box_<dyn Future<Output = Result<Vec<InetAddress>, Error>> + 'static>>
fn lookup_records<P: IsA<Cancellable>>(
&self,
rrname: &str,
record_type: ResolverRecordType,
cancellable: Option<&P>
) -> Result<Vec<Variant>, Error>
[src]
&self,
rrname: &str,
record_type: ResolverRecordType,
cancellable: Option<&P>
) -> Result<Vec<Variant>, Error>
fn lookup_records_async<P: IsA<Cancellable>, Q: FnOnce(Result<Vec<Variant>, Error>) + Send + 'static>(
&self,
rrname: &str,
record_type: ResolverRecordType,
cancellable: Option<&P>,
callback: Q
)
[src]
&self,
rrname: &str,
record_type: ResolverRecordType,
cancellable: Option<&P>,
callback: Q
)
fn lookup_records_async_future(
&self,
rrname: &str,
record_type: ResolverRecordType
) -> Pin<Box_<dyn Future<Output = Result<Vec<Variant>, Error>> + 'static>>
[src]
&self,
rrname: &str,
record_type: ResolverRecordType
) -> Pin<Box_<dyn Future<Output = Result<Vec<Variant>, Error>> + 'static>>
fn lookup_service<P: IsA<Cancellable>>(
&self,
service: &str,
protocol: &str,
domain: &str,
cancellable: Option<&P>
) -> Result<Vec<SrvTarget>, Error>
[src]
&self,
service: &str,
protocol: &str,
domain: &str,
cancellable: Option<&P>
) -> Result<Vec<SrvTarget>, Error>
fn lookup_service_async<P: IsA<Cancellable>, Q: FnOnce(Result<Vec<SrvTarget>, Error>) + Send + 'static>(
&self,
service: &str,
protocol: &str,
domain: &str,
cancellable: Option<&P>,
callback: Q
)
[src]
&self,
service: &str,
protocol: &str,
domain: &str,
cancellable: Option<&P>,
callback: Q
)
fn lookup_service_async_future(
&self,
service: &str,
protocol: &str,
domain: &str
) -> Pin<Box_<dyn Future<Output = Result<Vec<SrvTarget>, Error>> + 'static>>
[src]
&self,
service: &str,
protocol: &str,
domain: &str
) -> Pin<Box_<dyn Future<Output = Result<Vec<SrvTarget>, Error>> + 'static>>