pub enum Mechanism {
All,
Include {
macro_string: Macro,
},
A {
macro_string: Macro,
ip4_mask: u32,
ip6_mask: u128,
},
Mx {
macro_string: Macro,
ip4_mask: u32,
ip6_mask: u128,
},
Ptr {
macro_string: Macro,
},
Ip4 {
addr: Ipv4Addr,
mask: u32,
},
Ip6 {
addr: Ipv6Addr,
mask: u128,
},
Exists {
macro_string: Macro,
},
}Expand description
An SPF mechanism (RFC 7208, Section 5).
mechanism = ( all / include
/ a / mx / ptr / ip4 / ip6 / exists )Masks are stored as network bitmasks derived from the CIDR prefix length
at parse time, not as prefix lengths: a /24 IPv4 prefix is stored as
0xFFFF_FF00, a missing prefix as all ones (host match) and /0 as zero
(matches any address). An address matches when
ip & mask == addr & mask.
Variants§
All
all: always matches (Section 5.1).
Include
include:<domain-spec>: matches when the SPF record of the target
domain evaluates to pass (Section 5.2).
A
a[:<domain-spec>][/<ip4-cidr>][//<ip6-cidr>]: matches when the client
IP is one of the target domain’s A or AAAA addresses (Section 5.3).
Fields
macro_string: MacroTarget domain, as a macro string; Macro::None means the
current <domain>.
Mx
mx[:<domain-spec>][/<ip4-cidr>][//<ip6-cidr>]: matches when the client
IP is an address of one of the target domain’s MX hosts (Section 5.4).
Fields
macro_string: MacroTarget domain, as a macro string; Macro::None means the
current <domain>.
Ptr
ptr[:<domain-spec>]: matches when a validated reverse DNS name of the
client IP ends in the target domain (Section 5.5; use is discouraged).
Fields
macro_string: MacroTarget domain, as a macro string; Macro::None means the
current <domain>.
Ip4
ip4:<ip4-network>[/<ip4-cidr>]: matches when the client IP is in the
given IPv4 network (Section 5.6).
Fields
Ip6
ip6:<ip6-network>[/<ip6-cidr>]: matches when the client IP is in the
given IPv6 network (Section 5.6).
Fields
Exists
exists:<domain-spec>: matches when the target name has an A record
(Section 5.7).
Implementations§
Trait Implementations§
impl Eq for Mechanism
impl StructuralPartialEq for Mechanism
Auto Trait Implementations§
impl Freeze for Mechanism
impl RefUnwindSafe for Mechanism
impl Send for Mechanism
impl Sync for Mechanism
impl Unpin for Mechanism
impl UnsafeUnpin for Mechanism
impl UnwindSafe for Mechanism
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more