Browse Source

main: add mdns responder

Alexandre Janniaux 6 years ago
parent
commit
57c34cb369
1 changed files with 11 additions and 0 deletions
  1. 11 0
      src/main.rs

+ 11 - 0
src/main.rs

@@ -5,6 +5,8 @@ extern crate rocket;
 extern crate rocket_contrib;
 #[macro_use]
 extern crate serde_derive;
+extern crate libmdns;
+extern crate env_logger;
 
 use std::fs;
 use rocket::Outcome;
@@ -314,6 +316,15 @@ fn fs_dl(_token: AuthToken, file_path: String) -> NamedFile
 
 fn main()
 {
+    env_logger::init();
+    let responder = libmdns::Responder::new().expect("cannot create mdns service");
+
+    responder.register(
+        "_fbx-api._tcp".into(),
+        "Freebox Test server".into(),
+        8000,
+        &["path=/"]);
+
     rocket::ignite()
         .mount("/",routes![
                index,