Expand description
The UDP multicast provider: the preferred LAN mechanism. One socket, bound to the configured port and joined to the group; a listener thread hands every datagram to the manager, an announcer thread transmits the beacon on the interval with jitter. IPv4 only, TTL from the declaration (1 by default: the local segment and no further).
Multicast does not work on every network, and this provider assumes nothing: a socket
that cannot bind (another local Majordomus already listens on the port) or a group
that cannot be joined marks the provider Failed with the reason, and every other
provider runs on. The datagrams this socket hears may also be unicast or broadcast
aimed at the port — provenance names the socket that heard, not the routing that
delivered.
use majordomus_cli::mesh::multicast::MulticastProvider;
use majordomus_cli::mesh::config::MulticastConfig;
use majordomus_cli::mesh::provider::{MeshProvider, MeshProviderState};
// Before the manager starts it, a provider is stopped and has heard nothing.
let provider = MulticastProvider::new(MulticastConfig::default());
assert_eq!(provider.id(), "udp_multicast");
assert_eq!(provider.status().state, MeshProviderState::Stopped);Structs§
- Multicast
Provider - The multicast provider: the declared group and port, the socket its threads share, and the counters its status reports. Constructed by the manager from the declaration.