WIP: Advertise over mDNS
AbandonedPublic

Authored by sredman on Sep 7 2018, 6:24 PM.

Details

Reviewers
rytilahti
Group Reviewers
KDE Connect
Summary

This adds advertising over mDNS [https://tools.ietf.org/html/rfc6762], allowing kdeconnect-supporting devices.
https://phabricator.kde.org/D15334 is the counterpart for publishing mobile app over mDNS.

Example output from avahi-browse -ar:

= vboxnet1 IPv4 KDEConnect on tpr@maksalaatikko               _kdeconnect._tcp     local
   hostname = [xyaz.local]
   address = [192.0.2.1]
   port = [1716]
   txt = ["type=desktop" "protocolVersion=7" "name=tpr@xyaz" "id=_d1c8fa43_xxxx_430d_xxxx_75ebb1xxxx_"]

Diff Detail

Repository
R224 KDE Connect
Branch
add_mdns_discovery
Lint
Lint OK
Unit
No Unit Test Coverage
Build Status
Buildable 2576
Build 2594: arc lint + arc unit
rytilahti created this revision.Sep 7 2018, 6:24 PM
Restricted Application added a project: KDE Connect. · View Herald TranscriptSep 7 2018, 6:24 PM
Restricted Application added a subscriber: kdeconnect. · View Herald Transcript
rytilahti requested review of this revision.Sep 7 2018, 6:24 PM

I really like this as an idea! Even if it only works in the same places as the current UDP broadcast (and my quick testing says it should work more places) it feels way more modern and professional. Of course, we really need support on (at least one of) Android and desktop for using this to initiate a pairing.

core/backends/lan/lanlinkprovider.cpp
115–117

Avoiding code reuse is definitely good, but maybe it would make even more sense to have a higher-level helper function, something like "get device identity", which maybe returns some custom "identity" class(/struct) and is used by both this and the createIdentityPacket method? That just feels a little nicer that "ad-hoc" using the identity packet, and is robust to the potential of that packet changing in the future.

Thanks for the feedback Simon!

I really like this as an idea! Even if it only works in the same places as the current UDP broadcast (and my quick testing says it should work more places) it feels way more modern and professional. Of course, we really need support on (at least one of) Android and desktop for using this to initiate a pairing.

One of the reasons I delved into this is the fact that my phone may be sometimes in a separate network, which can thankfully be enabled fairly easily: https://www.systutorials.com/docs/linux/man/5-avahi-daemon.conf/#lbAH :-)

I'll see to implement the pairing initiation inside this PR.

core/backends/lan/lanlinkprovider.cpp
115–117

Indeed, this was just a PoC to see how easy it would be to add support for this. A simple identity wrapper sounds like a way to go, I'll see what I can do.

apol added a subscriber: apol.Nov 7 2018, 2:42 PM

Hey, sorry it took so long to review.

I was looking at this, while it seems really cool to be able to use avahi for discovering devices. That won't help to be able to detect and connect to other devices on the network though, right?

sredman commandeered this revision.Jul 25 2019, 8:33 AM
sredman added a reviewer: rytilahti.

Hi @rytilahti,

We have done a little bit more on mDNS on our Gitlab. Feel free to check it out! Android C++

I am going to close this merge request since we are moving away from Phabricator.

Thanks for your work and inspiration!

sredman abandoned this revision.Jul 25 2019, 8:33 AM