pub struct LocalServiceConfig {
pub service_type: String,
pub port: u16,
pub instance_name: String,
pub properties: Option<HashMap<String, String>>,
pub service_ttl: u64,
pub mdns_response_delay_ms: (u64, u64),
pub refresh_interval: u64,
}Expand description
Configuration for registering a local service and for discovery behavior.
Fields§
§service_type: StringThe type of service to be broadcast and discovered.
Example: "_myapp-filetransfer._tcp.local.".
port: u16The network port on which the local service is listening.
instance_name: StringAn optional custom instance name for the service.
If not provided, a name might be generated or a default used.
Example: "My Custom Service Name". The full mDNS name will be constructed from this.
properties: Option<HashMap<String, String>>A collection of additional properties (metadata) to be broadcast with the service. These are often published as TXT records in mDNS.
service_ttl: u64Service Time-To-Live (TTL) in seconds. This is the maximum time a discovered service is considered online without a refresh by the remote peer. Local cleanup of stale services also uses this.
mdns_response_delay_ms: (u64, u64)mDNS response delay range in milliseconds: (min_ms, max_ms).
Helps prevent network congestion (response storms) when multiple devices
respond to mDNS queries simultaneously. A random delay within this range is chosen.
refresh_interval: u64Discovery refresh interval in seconds. The interval at which the discovery component might re-query or re-announce to keep service lists fresh. (Note: mDNS has its own refresh mechanisms).
Trait Implementations§
Source§impl Clone for LocalServiceConfig
impl Clone for LocalServiceConfig
Source§fn clone(&self) -> LocalServiceConfig
fn clone(&self) -> LocalServiceConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more