mirror of
https://github.com/feschber/lan-mouse.git
synced 2026-05-15 06:06:07 -06:00
[PR #423] feat(discovery): mDNS-SD primary-IP hints for service-order-aware dialing #415
Labels
No labels
Xorg
documentation
enhancement
macos
pull-request
question
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/lan-mouse#415
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/feschber/lan-mouse/pull/423
Author: @jondkinney
Created: 5/6/2026
Status: 🔄 Open
Base:
main← Head:split/04-mdns📝 Commits (10+)
31298f2feat: cross-platform wall-press auto-release fallbackbffbef0proto: add Bounds(width, height) event variant2219f45feat(emulation): display_bounds + warp_cursor for all backends5de5016feat(emulation): send Bounds + warp cursor on Enter68fab55feat(capture): cache peer bounds and use as wall-press upper clamp944e758ui: wrap window content in GtkScrolledWindow56f7730ui: rename Auto-Release group to scope it to outgoing capturecd63f5dfix: preserve cross-axis cursor position across machine transitions2571b47fix(capture/layer_shell): report screen-space cursor position on Entercbe2ec1fix(capture): warp host cursor to guest position on release📊 Changes
37 files changed (+3476 additions, -394 deletions)
View changed files
📝
Cargo.lock(+494 -204)📝
Cargo.toml(+5 -1)📝
input-capture/Cargo.toml(+1 -0)📝
input-capture/src/dummy.rs(+2 -2)📝
input-capture/src/layer_shell.rs(+67 -17)📝
input-capture/src/lib.rs(+579 -11)📝
input-capture/src/libei.rs(+5 -2)📝
input-capture/src/macos.rs(+152 -13)📝
input-capture/src/windows.rs(+1 -1)📝
input-capture/src/windows/event_thread.rs(+64 -12)📝
input-capture/src/x11.rs(+1 -1)📝
input-emulation/src/lib.rs(+36 -0)📝
input-emulation/src/libei.rs(+41 -2)📝
input-emulation/src/macos.rs(+34 -1)📝
input-emulation/src/windows.rs(+24 -1)📝
input-emulation/src/wlroots.rs(+190 -1)📝
input-emulation/src/x11.rs(+27 -0)📝
lan-mouse-gtk/resources/window.ui(+83 -5)📝
lan-mouse-gtk/src/client_object.rs(+10 -0)📝
lan-mouse-gtk/src/client_object/imp.rs(+1 -0)...and 17 more files
📄 Description
Summary
mDNS-SD service-order discovery — even with a multi-homed listener, the dialer still has to choose which of the peer's IPs to dial first, and plain hostname resolution returns every interface's IP without ranking.
connect_any's parallel race picks whichever DTLS handshake completes first, which is RTT-roughly-correct but not always what the user wanted. The classic symptom: Wi-Fi wins the race even when the user has Ethernet ranked higher in macOS's service order, leading to a stuttery session over Wi-Fi while a healthy wired path sits idle.Each lan-mouse instance now publishes a
_lan-mouse._udp.local.Bonjour service whose TXT record carriesprimary=<ipv4>, where<ipv4>is the IP of the interface that owns the default route — which on macOS reflects service order, on Linux the lowest-metric default route, on Windows whateverGetBestRoute2selects. The dialer continuously browses the same service type and cachespeer_hostname → primary_ipv4in aRc<RefCell<HashMap>>shared withLanMouseConnection.connect_anyextended with happy-eyeballs head-start: if a preferred address is known, dial it alone for 200ms before joining the rest of the candidate list to the race. A healthy preferred path virtually always wins; a broken one only delays connect by 200ms before fallbacks kick in. (Cf. RFC 8305 IPv6→IPv4 fallback delay.)Subsystem gated by a new
mdns_discoveryconfig flag (default true) and a corresponding GUI switch under a new "Network Discovery" preferences group. Toggling off unregisters the service, aborts the browse task, and shuts the daemon, but preserves theprimary_cacheso already-known hints stay queryable until overwritten — useful on networks where mDNS multicast (224.0.0.251) is firewalled. A 30-seconddiscovery_refresh_tickre-publishes the TXT record so it stays accurate when the OS-preferred interface changes (e.g. user toggles Wi-Fi off and Ethernet takes over).New deps:
mdns-sd(cross-platform mDNS responder, doesn't piggyback on system Avahi/Bonjour),netdev(default-route lookup),hostname(local hostname for the service instance name).Falls back gracefully when
ServiceDaemon::newfails (multicast group locked / no perms), no interface owns the default route, or the peer isn't announcing (old version or discovery disabled there) — the dialer just seespreferred = Noneand the existingconnect_anyrace runs unchanged.Test plan
_lan-mouse._udp.local.advertised) — dialer seespreferred = Noneand falls back to existing race behaviorSplit out from #418, the umbrella PR collecting ~10 independent feature areas. This PR is the mDNS-SD discovery subset and depends on the multi-homed-listener PR. See #418 for the full picture.
Stack overview
These PRs are split out from #418 and stack in this order:
Each PR's branch builds on the previous one, so until earlier PRs are merged the cumulative diff against
mainincludes all preceding work. Reviewing in order is easiest.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.