feat: add mDNS registration for mind-map.local - #18
Merged
Conversation
Register the HTTP server via mDNS (hashicorp/mdns) so it is discoverable as mind-map.local on the local network. - Add internal/mdns package with Register/Shutdown helpers - Register _http._tcp service named 'mind-map' on serve startup - Change default listen port from 51849 to 80 so http://mind-map.local works without specifying a port - Add --no-mdns flag to serve command to disable registration - Propagate --no-mdns through system service path Closes #10
Both install.sh and install.ps1 now prompt during service setup: - mDNS on/off (default: on), passes --no-mdns when disabled - Port selection (default: 80) with availability check — loops until the user picks a free port - Shows mDNS URL in post-install summary when enabled
Instead of running a second mDNS responder on port 5353 (which conflicts with avahi-daemon on Linux and mDNSResponder on macOS), register through the system daemon: - Linux: avahi-publish-address + avahi-publish-service - macOS/Windows: dns-sd -R (Bonjour) - Fallback: hashicorp/mdns when no system daemon is available Platform-specific files: - mdns_linux.go: avahi path with virtual-interface filtering - mdns_bonjour.go: dns-sd path (darwin + windows build tags) - mdns_other.go: fallback stub for other platforms Also update devcontainer for mDNS testing: - Add avahi-daemon, avahi-utils, dbus to Dockerfile - Add postStartCommand to start dbus + avahi - Add --network=host for multicast access
VS Code's port forwarding binds the port on the host, which conflicts when the server tries to bind the same port on the shared host network. With --network=host all ports are already accessible — forwardPorts is unnecessary.
The service record (avahi-publish-service) is the critical piece and now registers under the machine's real hostname instead of forcing --host=mind-map.local. The address record (avahi-publish-address mind-map.local) is attempted best-effort and logged as a warning if it fails (e.g. name collision).
Both installers now offer 'enter nothing to auto-pick a free port' when the default port (80) is unavailable. Scans 8080-8180 for a free port and selects the first available one.
mind-map is a personal wiki — it should not be accessible from other machines on the network. Change default listen address from :80 (all interfaces) to 127.0.0.1:80 (loopback only). mDNS now advertises 127.0.0.1 so mind-map.local resolves to loopback. Users type a friendly URL in their browser but the wiki stays private to the machine.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Registers the mind-map HTTP server via mDNS so it is discoverable as
mind-map.localon the local network, per #10.Changes
internal/mdnspackage — wrapshashicorp/mdnswithRegister(port)/Shutdown()helpers_http._tcpservice namedmind-mapwith hostnamemind-map.localhttp://mind-map.localworks without a port suffix (applies toserve,service install/start/stop/uninstall/status, and install scripts)--no-mdnsflag — added toservecommand (and propagated through the system service path) to disable mDNS registrationinstall.shandinstall.ps1default port updated from 51849 → 80Notes
--addr :51849or any other port)Closes #10