Skip to content

Commit daee955

Browse files
authored
Change mDNS record to note TLS support. (#51)
1 parent e550e5a commit daee955

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "webthing"
3-
version = "0.12.3"
3+
version = "0.12.4"
44
authors = ["Mozilla IoT <iot@mozilla.com>"]
55
repository = "https://github.com/mozilla-iot/webthing-rust"
66
homepage = "https://github.com/mozilla-iot/webthing-rust"

src/server.rs

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1076,11 +1076,17 @@ impl WebThingServer {
10761076
});
10771077

10781078
let responder = libmdns::Responder::new().unwrap();
1079-
responder.register("_webthing._tcp".to_owned(), name.clone(), port, &["path=/"]);
10801079

10811080
#[cfg(feature = "ssl")]
10821081
match self.ssl_options {
10831082
Some(ref o) => {
1083+
responder.register(
1084+
"_webthing._tcp".to_owned(),
1085+
name.clone(),
1086+
port,
1087+
&["path=/", "tls=1"],
1088+
);
1089+
10841090
let mut builder = SslAcceptor::mozilla_intermediate(SslMethod::tls()).unwrap();
10851091
builder
10861092
.set_private_key_file(o.0.clone(), SslFiletype::PEM)
@@ -1091,14 +1097,18 @@ impl WebThingServer {
10911097
.expect("Failed to bind socket")
10921098
.start()
10931099
}
1094-
None => server
1095-
.bind(format!("0.0.0.0:{}", port))
1096-
.expect("Failed to bind socket")
1097-
.start(),
1100+
None => {
1101+
responder.register("_webthing._tcp".to_owned(), name.clone(), port, &["path=/"]);
1102+
server
1103+
.bind(format!("0.0.0.0:{}", port))
1104+
.expect("Failed to bind socket")
1105+
.start()
1106+
}
10981107
}
10991108

11001109
#[cfg(not(feature = "ssl"))]
11011110
{
1111+
responder.register("_webthing._tcp".to_owned(), name.clone(), port, &["path=/"]);
11021112
server
11031113
.bind(format!("0.0.0.0:{}", port))
11041114
.expect("Failed to bind socket")

0 commit comments

Comments
 (0)