[−][src]Crate lib3h_mdns
lib3h mDNS LAN discovery module
Our simple use case is the following:
use lib3h_mdns as mdns; use lib3h_protocol::discovery::Discovery; use std::{thread, time::Duration}; let mut mdns = mdns::MulticastDnsBuilder::new() // Let's define our own networkId (the network we operate on) and how to access us .own_record("holonaute.holo.host", &["wss://192.168.0.87:88088?a=hc0"]) // Sets the interval between two automatic queries .query_interval_ms(1_000) .bind_port(8585) .build() .expect("Fail to build mDNS."); // Make myself known on the network and find a name for myself mdns.advertise() .expect("Fail to advertise my existence to the world."); // Let's listen to the network for a few moments... for _ in 0..5 { mdns.discover(); println!("mDNS neighbourhood : {:#?}", &mdns.records()); thread::sleep(Duration::from_millis(100)); }
Re-exports
pub use error::MulticastDnsError; |
pub use error::MulticastDnsResult; |
pub use dns::*; |
pub use builder::MulticastDnsBuilder; |
Modules
builder | MulticastDns builder definition. |
dns | mDNS message serializer. |
error | mDNS module error definition. |
record | mDNS resource record definition. |
Structs
MulticastDns | an mdns instance that can send and receive dns packets on LAN UDP multicast |