Trait HostResolve

Source
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:

  1. If user specified port of the service explicitly (example.org:1234)
  2. 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§

Source

type HostFuture: Future<Item = IpList, Error = Error>

A future returned from resolve()

Required Methods§

Source

fn resolve_host(&self, name: &Name) -> Self::HostFuture

Resolve a name to an address once

Provided Methods§

Source

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

Source

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.

Implementations on Foreign Types§

Source§

impl<T: HostResolve> HostResolve for Arc<T>

Implementors§