Skip to main content

SpfResolver

Trait SpfResolver 

Source
pub trait SpfResolver: Send + Sync {
    // Required methods
    fn lookup_txt<'life0, 'life1, 'async_trait>(
        &'life0 self,
        domain: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, SpfError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn lookup_a<'life0, 'life1, 'async_trait>(
        &'life0 self,
        domain: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<IpAddr>, SpfError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn lookup_aaaa<'life0, 'life1, 'async_trait>(
        &'life0 self,
        domain: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<IpAddr>, SpfError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn lookup_mx<'life0, 'life1, 'async_trait>(
        &'life0 self,
        domain: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<(u16, String)>, SpfError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Minimal DNS interface the SPF evaluator needs.

Implementors should map NXDOMAIN to empty Vec (not error) — “no record” is normal in SPF. Reserve Err(SpfError::DnsTempError) for actual lookup failures (timeout, SERVFAIL) and Err(SpfError::DnsPermError) for malformed responses.

Required Methods§

Source

fn lookup_txt<'life0, 'life1, 'async_trait>( &'life0 self, domain: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, SpfError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

TXT records for domain. SPF lives in TXT; one domain can have multiple TXT records (only one should be v=spf1 per RFC 7208 §4.5; we detect multi-v=spf1 in the evaluator).

Source

fn lookup_a<'life0, 'life1, 'async_trait>( &'life0 self, domain: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<IpAddr>, SpfError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

IPv4 A records for domain.

Source

fn lookup_aaaa<'life0, 'life1, 'async_trait>( &'life0 self, domain: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<IpAddr>, SpfError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

IPv6 AAAA records for domain.

Source

fn lookup_mx<'life0, 'life1, 'async_trait>( &'life0 self, domain: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<(u16, String)>, SpfError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

MX records. Returns (preference, exchange-hostname) pairs.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§