#[non_exhaustive]pub struct AddressFilter {
pub bind_addresses: Vec<IpAddr>,
pub include_loopback: bool,
pub include_link_local: bool,
pub interface_filter: Option<InterfaceFilter>,
pub ip_filter: Option<IpFilter>,
}Expand description
Which local addresses get host candidates.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.bind_addresses: Vec<IpAddr>Only these addresses (bind addresses); empty: every address of every interface.
include_loopback: boolLoopback addresses too (off by default: RFC 8445 section 5.1.1.1: “Addresses from a
loopback interface MUST NOT be included in the candidate addresses”; turning this on
departs from that rule, for local use and tests only). On Windows a driver with mDNS on a loopback address leaves a
destination-cache route for 224.0.0.251 via loopback after the process exits, and the
system then routes the group by loopback for other processes until the entry is deleted
(peer module documentation), so on Windows a PeerDriver sends no mDNS on loopback
unless PeerDriverConfig::mdns_on_loopback_on_windows asks.
include_link_local: boolIPv6 link-local addresses too (off by default).
interface_filter: Option<InterfaceFilter>Keep an interface by name (eth0, en0, …).
ip_filter: Option<IpFilter>Keep an address.
Implementations§
Source§impl AddressFilter
impl AddressFilter
Sourcepub fn new() -> Self
pub fn new() -> Self
Every address of every interface, without loopback and IPv6 link-local ones.
Sourcepub fn with_bind_addresses(self, bind_addresses: Vec<IpAddr>) -> Self
pub fn with_bind_addresses(self, bind_addresses: Vec<IpAddr>) -> Self
Only these addresses (bind_addresses).
Sourcepub fn with_include_loopback(self, include_loopback: bool) -> Self
pub fn with_include_loopback(self, include_loopback: bool) -> Self
Loopback addresses too (include_loopback).
Sourcepub fn with_include_link_local(self, include_link_local: bool) -> Self
pub fn with_include_link_local(self, include_link_local: bool) -> Self
Link-local addresses too (include_link_local).
Sourcepub fn with_interface_filter(
self,
filter: impl Fn(&str) -> bool + Send + Sync + 'static,
) -> Self
pub fn with_interface_filter( self, filter: impl Fn(&str) -> bool + Send + Sync + 'static, ) -> Self
Keeps only the interfaces filter accepts by name.
Sourcepub fn with_ip_filter(
self,
filter: impl Fn(IpAddr) -> bool + Send + Sync + 'static,
) -> Self
pub fn with_ip_filter( self, filter: impl Fn(IpAddr) -> bool + Send + Sync + 'static, ) -> Self
Keeps only the addresses filter accepts.
Trait Implementations§
Source§impl Clone for AddressFilter
impl Clone for AddressFilter
Source§impl Debug for AddressFilter
impl Debug for AddressFilter
Auto Trait Implementations§
impl !RefUnwindSafe for AddressFilter
impl !UnwindSafe for AddressFilter
impl Forget for AddressFilter
impl Freeze for AddressFilterwhere
*const u8 is !null: Freeze,
PhantomData<IpAddr>: Freeze,
*const ArcInner<dyn Fn(&str) -> bool + Sync + Send> is !null: Freeze,
PhantomData<ArcInner<dyn Fn(&str) -> bool + Sync + Send>>: Freeze,
*const ArcInner<dyn Fn(IpAddr) -> bool + Sync + Send> is !null: Freeze,
PhantomData<ArcInner<dyn Fn(IpAddr) -> bool + Sync + Send>>: Freeze,
impl Move for AddressFilter
impl Send for AddressFilter
impl Sync for AddressFilter
impl Unpin for AddressFilter
impl UnsafeUnpin for AddressFilterwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<IpAddr>: UnsafeUnpin,
*const ArcInner<dyn Fn(&str) -> bool + Sync + Send> is !null: UnsafeUnpin,
PhantomData<ArcInner<dyn Fn(&str) -> bool + Sync + Send>>: UnsafeUnpin,
*const ArcInner<dyn Fn(IpAddr) -> bool + Sync + Send> is !null: UnsafeUnpin,
PhantomData<ArcInner<dyn Fn(IpAddr) -> bool + Sync + Send>>: UnsafeUnpin,
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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<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 moreSource§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.