Skip to content

Commit 97786e0

Browse files
authored
Change mDNS record to note TLS support. (#55)
1 parent e7ccbfb commit 97786e0

2 files changed

Lines changed: 13 additions & 3 deletions

File tree

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>org.mozilla.iot</groupId>
88
<artifactId>webthing</artifactId>
9-
<version>0.12.2</version>
9+
<version>0.12.3</version>
1010

1111
<name>WebThing</name>
1212
<description>Implementation of an HTTP Web Thing.</description>
@@ -73,7 +73,7 @@
7373
<dependency>
7474
<groupId>org.json</groupId>
7575
<artifactId>json</artifactId>
76-
<version>20190722</version>
76+
<version>20200518</version>
7777
</dependency>
7878
<dependency>
7979
<groupId>org.nanohttpd</groupId>

src/main/java/org/mozilla/iot/webthing/WebThingServer.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import java.net.InetAddress;
1313
import java.security.NoSuchAlgorithmException;
1414
import java.util.ArrayList;
15+
import java.util.HashMap;
1516
import java.util.List;
1617
import java.util.Map;
1718
import java.util.Timer;
@@ -293,11 +294,20 @@ public void start(boolean daemon) throws IOException {
293294
this.hosts.add(systemHostname);
294295
this.hosts.add(String.format("%s:%d", systemHostname, this.port));
295296

297+
Map txt = new HashMap();
298+
txt.put("path", "/");
299+
300+
if (this.isTls) {
301+
txt.put("tls", "1");
302+
}
303+
296304
ServiceInfo serviceInfo = ServiceInfo.create("_webthing._tcp.local",
297305
this.name,
298306
null,
299307
this.port,
300-
"path=/");
308+
0,
309+
0,
310+
txt);
301311
this.jmdns.registerService(serviceInfo);
302312

303313
super.start(this.SOCKET_READ_TIMEOUT, daemon);

0 commit comments

Comments
 (0)