pub trait HostResolve {
type HostFuture: Future<Item = IpList, Error = Error>;
// Required method
fn resolve_host(&self, name: &Name) -> Self::HostFuture;
// Provided methods
fn frozen_host_subscriber(self) -> FrozenSubscriber<Self>
where Self: Sized { ... }
fn null_service_resolver(self) -> NullResolver<Self>
where Self: Sized { ... }
}
Expand description
Resolves a hostname into a list of IpAddresses
This is usually equivalent of the resolving A or AAAA record. This kind of resolution is used in two cases:
- If user specified port of the service explicitly (
example.org:1234
) - When there is known default port like
80
for http
Note: akin to A records this method returns plain list of addresses so
it can’t use a backup addresses and weights. So this should be used for
simple cases and full blown Resolve
trait (i.e. SRV records) for
more complex ones.
Required Associated Types§
Sourcetype HostFuture: Future<Item = IpList, Error = Error>
type HostFuture: Future<Item = IpList, Error = Error>
A future returned from resolve()
Required Methods§
Sourcefn resolve_host(&self, name: &Name) -> Self::HostFuture
fn resolve_host(&self, name: &Name) -> Self::HostFuture
Resolve a name to an address once
Provided Methods§
Sourcefn frozen_host_subscriber(self) -> FrozenSubscriber<Self>where
Self: Sized,
fn frozen_host_subscriber(self) -> FrozenSubscriber<Self>where
Self: Sized,
Create a subscriber that resolves once using this resolver and never updates a stream
This is mostly useful for tests
Sourcefn null_service_resolver(self) -> NullResolver<Self>where
Self: Sized,
fn null_service_resolver(self) -> NullResolver<Self>where
Self: Sized,
Create a thing that implements Resolve+HostResolve but returns
NameNotFound
on resolve
This is needed to add resolver that can only resolve hostnames to the router.