Commit e8074809 authored by toby's avatar toby

raw multicast output

parent 907ed145
......@@ -91,3 +91,13 @@ pub fn resolve_service<'a>(service_name: &'a str) {
run_loop.run(requests).unwrap();
run_loop.run(responses).unwrap();
}
pub fn raw() {
let mut run_loop = Core::new().unwrap();
let stream = Protocol::framed_with_handle(&run_loop.handle());
let responses = stream.for_each(|r| {
println!("{:?}", r);
Ok(())
});
run_loop.run(responses).unwrap();
}
......@@ -25,7 +25,8 @@ fn main() {
.value_name("SERVICE.local")
.help("Resolve a `SRV` record from a `PTR`.")
.conflicts_with("host")
.conflicts_with("discover"))
.conflicts_with("discover")
.conflicts_with("raw"))
.arg(Arg::with_name("host")
.short("n")
.long("name")
......@@ -33,17 +34,28 @@ fn main() {
.value_name("HOST.local")
.help("Resolve an `A` record from a `SRV.target`.")
.conflicts_with("discover")
.conflicts_with("service")
.conflicts_with("raw"))
.arg(Arg::with_name("raw")
.short("r")
.long("raw")
.takes_value(false)
.help("Display raw multi-cast output")
.conflicts_with("discover")
.conflicts_with("name")
.conflicts_with("service"))
.get_matches();
match (
matches.value_of("discover"),
matches.value_of("host"),
matches.value_of("service"))
matches.value_of("service"),
matches.is_present("raw"))
{
(Some(service), _, _) => discover::query_service(service),
(_, Some(host), _) => discover::resolve_host(host),
(_, _, Some(service)) => discover::resolve_service(service),
(_, _, _) => panic!()
(Some(service), _, _, _) => discover::query_service(service),
(_, Some(host), _, _) => discover::resolve_host(host),
(_, _, Some(service), _) => discover::resolve_service(service),
(_, _, _, true) => discover::raw(),
(_, _, _, _) => panic!()
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment