mDNS, Avahi and Docker non-root containers
gnaneshkunal.github.io
gnaneshkunal.github.io
You can run the app on the host with docker containers and traefik and any service.local domain configured in labels will be announced via mdns. Services themselves don't have to be mdns aware and will be registered/removed as they come up/down. It works without traefik too, but you have to include the port then as well.
[0] Back in the Web 1.0 era, there were lots of Windows PCs connected directly to the Internet with file and printer sharing enabled. People wrote search engines and download tools for scraping them.
All sorts of things use mDNS now (chromecast, spotify, printers, thermostats). And finally windows will start to support mDNS so hopefully we can finally settle on one good autodiscovery protocol and get rid of the horror that is SSDP.
Lots of new core APIs added in Windows 10 aren’t available via Win32 even if they have nothing to do with packages, unfortunately. It’s extremely convoluted but you can use the Windows.Sdk, Contracts, or CsWinRT packages to interop with the WinRT APIs from a C++, C#, or now even rust application but depending on which APIs you consume you may need to use a Windows Application Project appx/msix wrapper to package your code and associate it with a package ID unlocking the APIs for use.
(I have a hello world project demonstrating a WPF .NET Core project hosting a custom control consisting of a single text block that displays your current location via the Geolocator API and it requires four different individually user-created projects in the Visual Studio solution and a minimum half-a-dozen NuGet dependencies just to make it happen. It’s a terrible, terrible mess.)
https://github.com/microsoft/ProjectReunion
So I'm hoping this improved things in the future.
https://docs.microsoft.com/en-us/windows/uwp/devices-sensors...
This uses mDNS under the hood and works pretty well now. The basics is that you create a device watcher and set it up to look for devices of a specific kind. In this case, you're looking for network-based devices with a specific service type.
It's however somewhat of a pain to get running as there's a lot of details you need to know / figure out before you can get running.
And are you sure the Windns.h API is deprecated? I could have sworn it only showed up last year.
I'm basing my "deprecated" comment on this: https://docs.microsoft.com/en-us/uwp/api/Windows.Networking....
However that looks to be different from the windns.h stuff. To be honest, I wasn't aware of windns.h and just assumed it was the above link you were talking about. It's probably worth taking a look at :)
That's what I'm seeking to avoid too. I'll have to take a closer look at the device enumeration API next time I circle around to the Windows port. Thanks for sharing your experience with it.
The only major database I know which supports it is Postgres (it's disabled by default) [4]. On MySQL, it's an open work item, untouched for 13 years [5].
Last I checked, no major web framework broadcasts its service using Zeroconf.
Zeroconf service broadcast is so easy to implement (really) and such a tremendous help to users that I don't understand why developers aren't falling over themselves to implement it.
[1]: https://apple.stackexchange.com/questions/299700 [2]: https://bugs.chromium.org/p/chromium/issues/detail?id=13573 [3]: https://bugzilla.mozilla.org/show_bug.cgi?id=173804 [4]: https://www.postgresql.org/docs/9.1/runtime-config-connectio... [5]: https://dev.mysql.com/worklog/?sc=id&sd=ASC&pg=3
How do browsers 'support mDNS for name resolution'? Isn't that a feature of the OS? I can "ping NAS.local" (without a DNS server) just as easily as I can go to "http://NAS.local", and ping.c doesn't appear to have any mDNS code.
You're are correct, mDNS name resolution is an OS feature and to the browser/program/app it makes no difference.
Having said all that, I do wish Safari still supported it.
Why should that be the case? If you have 1000 nodes, you could organize your network such that node one gets prefix::00:01, node two gets prefix::00:02, node 138 gets prefix::01:38, etc.
There is so much space in IPv6 that you can group things more logically than was ever doable in the IPv4 world.
Perhaps I'm misunderstanding this, but why would your systems not have access to a local DNS server? My routers respond just fine to DNS queries for "hostname.local"-like requests without using something like mDNS.
In my opinion, modern systems shouldn't run services in case something needs them, they should be dynamically loaded and unloaded (isn't this what dbus is for??). If Chrome needs mDNS it can ask for it. If network resources are accessed at login, the login processes can request avahi to be loaded and then unloaded once they're done. What really feels like insult to injury is how systemd was forced on unwilling users because of features like this, yet avahi,cups,etc... Just sit there idle even if you didn't start any application that has a need for them.
I think maybe I am seeing it from the wrong perspective?
It's not installed by default in the author's example; they specifically install it in the Docker image.
> In my opinion, modern systems shouldn't run services in case something needs them, they should be dynamically loaded and unloaded (isn't this what dbus is for??).
That's exactly how it works in Debian today.
> ...how systemd was forced on unwilling users because of features like this...
systemd wasn't forced on anyone. If you're an "unwilling user", use a distribution that doesn't use systemd! But systemd does support socket activation, which is the exact feature you're claiming doesn't exist!
> systemd wasn't forced on anyone. If you're an "unwilling user", use a distribution that doesn't use systemd! But systemd does support socket activation, which is the exact feature you're claiming doesn't exist!
It was forced on existing users. If someone gives you the choice between moving to a different house or accepting something and staying where you are, if you don't like that thing you just got forced out of your house,if you accept that thing you were forced into accepting it. If someone puts a gun to your head and asks for your money, the fact that you can chose to die does not mean your money was not taken from you by force when you opt to live.
I did not claim socket activation does not exist, I even mentiones dbus as a way. I said it was not being used, services are just left running. Even GPG has a service that just idles.
Complaints like this about mDNS are my pet peeve. Back in the day networks were 1000 times slower and we had Appletalk and dynamic peer-to-peer LAN networking was absolutely effortless. It was plug-and-play, networking-for-dummies easy. And nobody had to explain to their Mom over the phone what an IP address was.
But Appletalk was chatty and that bugged people with large enterprise LANs. So Apple turned it off and invented mDNS which was less chatty and used modern DNS protocols. It made LAN setup about half as easy as Appletalk but by that time everybody had gotten used to typing IP addresses into their printers as if that was "normal." Or they just gave up on peer-to-peer connections entirely.
So now not many people use mDNS and it's not nearly as chatty as Appletalk and our networks are 1000 times faster and a tiny bit of LAN traffic is nothing; nothing compared to the value mDNS would bring if people just used it. But no. Let's complain about how chatty it is and continue using LANs full of multi-teraflop computers that have no way to ask their neighbors what their damned IP addresses are.
Yes I'm bitter.
I am very bitter about this too. I turn on a computer and it broadcasts excessive details about itself to anyone that will listen to it.it does things I did not ask it to do and refuses to do things I need it to do because people like you think there is one way everyone should do things.
What on earth is stopping you from turning on Avahi and using mDNS right now? Clicking on a checkbox in system settings? What else is there to it?
I will continue to complain on how chatty this and a plethora of other things are. Actually their chattiness is not the issue, the fact that they sent even one packet of that protocol is my issue, or more importantly that they listened on that port offerinf network services on my client computer. So, now when there's a vulnerability abusing that service, a service no one uses, well too bad then right? A network service is an exposure, people/apps should opt into not opt out of exposures!
Personally, I wish there was a way at install time to completely opt-out of these unneeded and overpromiscuous services.
My linux machines don't print, I don't use any peer-to-peer dns on any of my machines, I don't need advanced routing protocols, etc...
Another thing I notice is an ubuntu machine I'm using runs 10-15 evolution contacts/calendars/etc processes and all I do on that machine is compile.