Skip to main content

ServerOptions

Struct ServerOptions 

Source
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

Source

pub fn new() -> Self

Build a new options bundle with defaults.

Source

pub const fn ipv4(&self) -> bool

Whether IPv4 is enabled.

Source

pub fn with_ipv4(self, enable: bool) -> Self

Disable IPv4. At least one of v4/v6 must remain enabled.

Source

pub const fn ipv6(&self) -> bool

Whether IPv6 is enabled.

Source

pub fn with_ipv6(self, enable: bool) -> Self

Disable IPv6.

Source

pub const fn interface_index(&self) -> Option<u32>

The pinned interface index, if any.

Source

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.

Source

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).

Source

pub fn with_max_payload_size(self, size: usize) -> Self

Override the maximum outgoing packet size.

Source

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.

Source

pub fn with_max_recv_packet_size(self, size: usize) -> Self

Override the recv buffer size.

Source

pub const fn update_channel_capacity(&self) -> usize

👎Deprecated:

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.

Source

pub fn with_update_channel_capacity(self, cap: usize) -> Self

👎Deprecated:

per-handle channels are unbounded; this setting has no effect

Override the per-handle update channel capacity. No-op — see Self::update_channel_capacity.

Source

pub const fn endpoint_config(&self) -> &EndpointConfig

The proto-layer EndpointConfig.

Source

pub fn with_endpoint_config(self, cfg: EndpointConfig) -> Self

Override the proto-layer EndpointConfig.

Trait Implementations§

Source§

impl Clone for ServerOptions

Source§

fn clone(&self) -> ServerOptions

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ServerOptions

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ServerOptions

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more