Trait wasmtime_wasi::preview2::command::wasi::sockets::ip_name_lookup::Host
source · pub trait Host: HostResolveAddressStream {
// Required method
fn resolve_addresses<'life0, 'async_trait>(
&'life0 mut self,
network: Resource<Network>,
name: String,
address_family: Option<IpAddressFamily>,
include_unavailable: bool
) -> Pin<Box<dyn Future<Output = Result<Result<Resource<ResolveAddressStream>, ErrorCode>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}
Required Methods§
sourcefn resolve_addresses<'life0, 'async_trait>(
&'life0 mut self,
network: Resource<Network>,
name: String,
address_family: Option<IpAddressFamily>,
include_unavailable: bool
) -> Pin<Box<dyn Future<Output = Result<Result<Resource<ResolveAddressStream>, ErrorCode>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn resolve_addresses<'life0, 'async_trait>(
&'life0 mut self,
network: Resource<Network>,
name: String,
address_family: Option<IpAddressFamily>,
include_unavailable: bool
) -> Pin<Box<dyn Future<Output = Result<Result<Resource<ResolveAddressStream>, ErrorCode>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Resolve an internet host name to a list of IP addresses.
See the wasi-socket proposal README.md for a comparison with getaddrinfo.
Parameters
name
: The name to look up. IP addresses are not allowed. Unicode domain names are automatically converted to ASCII using IDNA encoding.address-family
: If provided, limit the results to addresses of this specific address family.include-unavailable
: When set to true, this function will also return addresses of which the runtime thinks (or knows) can’t be connected to at the moment. For example, this will return IPv6 addresses on systems without an active IPv6 interface. Notes:- Even when no public IPv6 interfaces are present or active, names like “localhost” can still resolve to an IPv6 address.
- Whatever is “available” or “unavailable” is volatile and can change everytime a network cable is unplugged.
This function never blocks. It either immediately fails or immediately returns successfully with a resolve-address-stream
that can be used to (asynchronously) fetch the results.
At the moment, the stream never completes successfully with 0 items. Ie. the first call
to resolve-next-address
never returns ok(none)
. This may change in the future.
Typical errors
invalid-argument
:name
is a syntactically invalid domain name.invalid-argument
:name
is an IP address.not-supported
: The specifiedaddress-family
is not supported. (EAI_FAMILY)