pub struct ServerOptions { /* private fields */ }Expand description
Build-time configuration for an mDNS Endpoint.
The defaults bind on one interface for both IPv4 and IPv6: the first
up + multicast-capable, non-loopback interface reported by
getifs::interfaces that has a usable address for each enabled
family, falling back to the loopback interface if no other is eligible.
Use Self::with_interface_index to pin a specific interface.
Multi-interface binding (one socket pair per interface) is not yet
supported — callers who need to advertise on several NICs should
construct one Endpoint per interface.
Implementations§
Source§impl ServerOptions
impl ServerOptions
Sourcepub fn with_ipv4(self, enable: bool) -> Self
pub fn with_ipv4(self, enable: bool) -> Self
Disable IPv4. At least one of v4/v6 must remain enabled.
Sourcepub const fn interface_index(&self) -> Option<u32>
pub const fn interface_index(&self) -> Option<u32>
The pinned interface index, if any.
Sourcepub fn with_interface_index(self, idx: Option<u32>) -> Self
pub fn with_interface_index(self, idx: Option<u32>) -> Self
Pin the listener to a specific interface (by OS index). When None
(the default), the first multicast-capable, non-loopback interface is
picked.
Sourcepub const fn max_payload_size(&self) -> usize
pub const fn max_payload_size(&self) -> usize
Maximum outgoing-packet buffer size. RFC 6762 §17 recommends staying within the path MTU on send (~1500 bytes for Ethernet).
Sourcepub fn with_max_payload_size(self, size: usize) -> Self
pub fn with_max_payload_size(self, size: usize) -> Self
Override the maximum outgoing packet size.
Sourcepub const fn max_recv_packet_size(&self) -> usize
pub const fn max_recv_packet_size(&self) -> usize
Maximum size of an inbound mDNS datagram that we will fully receive without truncation. RFC 6762 §17 says implementations MUST be prepared to receive messages up to 9000 bytes (jumbo-frame-sized) even though outgoing messages should fit in the path MTU.
Sourcepub fn with_max_recv_packet_size(self, size: usize) -> Self
pub fn with_max_recv_packet_size(self, size: usize) -> Self
Override the recv buffer size.
Sourcepub const fn update_channel_capacity(&self) -> usize
👎Deprecated: per-handle channels are unbounded; this setting has no effect
pub const fn update_channel_capacity(&self) -> usize
per-handle channels are unbounded; this setting has no effect
Capacity of the per-handle update channel that the driver writes to.
Deprecated: per-handle channels are now unbounded so that critical events (Established/Renamed/Conflict/HostConflict/ Terminal) cannot be silently dropped under backpressure. This value is preserved for API compatibility but has no effect.
Sourcepub fn with_update_channel_capacity(self, cap: usize) -> Self
👎Deprecated: per-handle channels are unbounded; this setting has no effect
pub fn with_update_channel_capacity(self, cap: usize) -> Self
per-handle channels are unbounded; this setting has no effect
Override the per-handle update channel capacity. No-op —
see Self::update_channel_capacity.
Sourcepub const fn endpoint_config(&self) -> &EndpointConfig
pub const fn endpoint_config(&self) -> &EndpointConfig
The proto-layer EndpointConfig.
Sourcepub fn with_endpoint_config(self, cfg: EndpointConfig) -> Self
pub fn with_endpoint_config(self, cfg: EndpointConfig) -> Self
Override the proto-layer EndpointConfig.
Trait Implementations§
Source§impl Clone for ServerOptions
impl Clone for ServerOptions
Source§fn clone(&self) -> ServerOptions
fn clone(&self) -> ServerOptions
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ServerOptions
impl Debug for ServerOptions
Auto Trait Implementations§
impl Freeze for ServerOptions
impl RefUnwindSafe for ServerOptions
impl Send for ServerOptions
impl Sync for ServerOptions
impl Unpin for ServerOptions
impl UnsafeUnpin for ServerOptions
impl UnwindSafe for ServerOptions
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<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