Skip to main content

AddressCandidates

Trait AddressCandidates 

pub trait AddressCandidates:
    Send
    + Sync
    + 'static {
    // Required methods
    fn domain(&self) -> &Domain;
    fn stream<'a>(
        &'a self,
        extensions: &'a Extensions,
    ) -> Pin<Box<dyn Stream<Item = Result<IpAddr, Box<dyn Error + Sync + Send>>> + Send + 'a>>;
}
Available on crate feature net only.
Expand description

A lazily-resolved source of connection target IpAddresses.

This is the abstraction boundary between resolving a target and connecting to it. An upstream connector (e.g. the rama-dns address resolver) stamps a ConnectorTargetStream into the Extensions, and a transport connector consumes it: dialing (and optionally racing) the yielded addresses. The transport stays resolver-agnostic: it only ever sees a stream of IpAddrs, never a DNS resolver. It combines each address with the current connector target’s port immediately before dialing.

Required Methods§

fn domain(&self) -> &Domain

Return the domain these candidates resolve.

Transport connectors use this correlation to avoid consuming stale candidates after routing middleware selects a different domain.

fn stream<'a>( &'a self, extensions: &'a Extensions, ) -> Pin<Box<dyn Stream<Item = Result<IpAddr, Box<dyn Error + Sync + Send>>> + Send + 'a>>

Stream the candidate IpAddresses, in the order they should be attempted. The given Extensions carry per-request resolve config.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§