Skip to content

feat: add mDNS/DNS-SD LAN server discovery#84

Merged
linroid merged 5 commits intomainfrom
feat/mdns-lan-discovery
Feb 20, 2026
Merged

feat: add mDNS/DNS-SD LAN server discovery#84
linroid merged 5 commits intomainfrom
feat/mdns-lan-discovery

Conversation

@linroid
Copy link
Owner

@linroid linroid commented Feb 15, 2026

Summary

  • Register KDown daemon servers via mDNS/DNS-SD on startup for automatic LAN discovery
  • Add "Discover on LAN" button in the Add Remote Server dialog with progress indicator and clickable result chips
  • mDNS registration runs on a background daemon thread to avoid blocking the UI on server start
  • Platform support: JmDNS on Android/JVM, stubs on iOS/WasmJs

Changes

  • Server: KDownServerConfig gains mdnsEnabled, mdnsServiceName, mdnsServiceType properties; KDownServer registers/unregisters mDNS service on start/stop
  • App (shared): LanServerDiscovery expect/actual with DiscoveredServer data class
  • App (Android): AndroidNetworkEnvironment for multicast lock management, CHANGE_WIFI_MULTICAST_STATE permission
  • App (Desktop): Uses hostname as mDNS service name
  • UI: AddRemoteServerDialog gains discovery button and server chips

Test plan

  • Start server on desktop, verify mDNS registration (e.g. dns-sd -B _kdown._tcp)
  • Open Add Remote Server dialog on another device, tap "Discover on LAN", verify server appears
  • Tap discovered server chip, verify host/port fields are populated
  • Verify server start does not lag the UI
  • Verify KDownServerConfigTest passes with new default/custom values

🤖 Generated with Claude Code

Register KDown daemon servers via mDNS on startup and discover them
from the Add Remote Server dialog. mDNS registration runs on a
background daemon thread to avoid blocking the UI.

- Server: register/unregister mDNS service with configurable name/type
- App: LanServerDiscovery with expect/actual (JmDNS on Android/JVM,
  stubs on iOS/WasmJs)
- UI: "Discover on LAN" button with progress indicator and result chips
- Android: multicast lock + CHANGE_WIFI_MULTICAST_STATE permission

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@chatgpt-codex-connector
Copy link

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 15, 2026

Test Results

1 210 tests  +48   1 210 ✅ +48   12s ⏱️ ±0s
   94 suites + 6       0 💤 ± 0 
   94 files   + 6       0 ❌ ± 0 

Results for commit 9b842d7. ± Comparison against base commit 5f56d22.

♻️ This comment has been updated with latest results.

linroid and others added 4 commits February 15, 2026 19:51
Replace JVM-only JmDNS with dns-sd-kt KMP library for native mDNS
support on Android (NSD), iOS (Bonjour), and JVM. This enables real
iOS discovery and eliminates manual expect/actual boilerplate.

- Server: MdnsRegistrar interface + DnsSdRegistrar using createNetService()
- Client: MdnsDiscoverer interface with DnsSdDiscoverer on Android/JVM/iOS,
  NoOp on WasmJs; LanServerDiscovery accepts injected discoverer
- UI: DiscoveryState sealed interface, toggle Discover/Stop button,
  ListItem replacing AssistChip, inline error/empty states
- Shared MDNS_SERVICE_TYPE constant in library/api
- Delete AndroidNetworkEnvironment, old platform LanServerDiscovery actuals
- 27 tests covering discovery dedup/sorting and registration lifecycle

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Declare NEARBY_WIFI_DEVICES in the manifest and request it at runtime
on API 33+ to comply with Android 16 local network permission changes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
JmDNS conflicts with macOS's built-in mDNSResponder, making registered
services invisible to native mDNS tools. Add NativeMdnsRegistrar that
uses the `dns-sd -R` subprocess on macOS, falling back to dns-sd-kt
(JmDNS) on other platforms. Move mDNS classes to server.mdns package
and add KDownLogger throughout KDownServer.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace Thread+runBlocking with a CoroutineScope(Dispatchers.IO) for
mDNS registration. The coroutine registers the service, suspends via
awaitCancellation(), and unregisters in the finally block when the
scope is cancelled on stop().

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@linroid linroid merged commit c6a1b93 into main Feb 20, 2026
4 checks passed
@linroid linroid deleted the feat/mdns-lan-discovery branch February 20, 2026 04:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant