An multicast DNS client in Rust.
Find IP addresses for all Chromecasts on the local network.
```rust extern crate mdns;
use mdns::{Record, RecordKind}; use std::net::IpAddr;
const SERVICENAME: &'static str = "googlecast._tcp.local";
fn main() { for response in mdns::discover::all(SERVICE_NAME).unwrap() { let response = response.unwrap();
let addr = response.records()
.filter_map(self::to_ip_addr)
.next();
if let Some(addr) = addr {
println!("found cast device at {}", addr);
} else {
println!("cast device does not advertise address");
}
}
}
fn toipaddr(record: &Record) -> Option