Repository navigation
Move a relayed computer to its direct path on the phone, and back - #48
Merged
Merged
Conversation
The phone now finds its computer on the local network (NSD on Android, Bonjour on iOS) every time it connects, after a network change and on background probes while it is reached through the relay. A path that passes the pinned TLS handshake, the computer's authorization and the app hello replaces the relay: same network at once, any other direct path unless the relay is faster by more than 20 ms. Calls on the relay finish there before it closes, so no write is cut or sent twice. A direct path that ends falls back to the relay at once; one that keeps dropping holds probes off for 1 minute, doubling to 30. The Connection and speed screen says which path is in use, when and why it last changed, and why direct is not available.
…tor harness The Connection and speed sheet shows the path in its content: the sheet's subtitle kept its first, empty value. perf-link serve-upgrade runs a desktop on a real relay with a direct listener that can be shut and opened on a new port, for the relay-to-direct check on an Android emulator.
…found address, cancel the hand-over with the direct path
TheAnimatrix
force-pushed
the
direct-path-upgrade
branch
from
December 1, 2026 07:41
1713f9d to
8ed0680
Compare
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.
What
A phone paired with "Your own relay" on the same Wi-Fi as its computer stayed on the relay for good. It never learned the computer's LAN address, and once on the relay it never tried direct again until the network changed. Now the phone does what the desktop helper already does for a relayed host (
mousse-helperapp/paths.rsupgrade,app/lan.rs), in the shared Rust core:_mousse._tcpevery time it connects, after a network change, and on its direct probes. It uses NSD on Android (multicast lock held only during the 3 s browse) and Bonjour on iOS (NWBrowser). The core drives it through a newLocalNetworkBrowsercallback. Only LAN IP literals count. A browse is reused for 60 s, forgotten on a network change, and skipped off Wi-Fi.try_path_turn, candidate, thenreopened). New calls go direct at once. Calls already on the relay finish there (up to 20 s) before it closes withPATH_REPLACED. Readers reopen their streams on the new path from their cursors, woken by a status nudge.MayHaveHappened(now also forConnecting).note_route(last_route), so the next cold start at home tries it first.same_recordno longer compareslast_route, so saving it doesn't restart the worker.Checked
Rust.
direct::testscover the probe backoff, the flap hold-off, the RTT margin, the problem mapping, LAN-only browse results, and no LAN dials off Wi-Fi.tests/direct_path.rsuses a real engine host, a realmousse-relayand a phone paired relay-only, and covers:MayHaveHappened.Lookinginstead ofUnstable.--cfg mousse_control="skip-pin-check", a session forms with the stranger.Android emulator (API 36,
perf-link serve-upgrade: real host and real relay). The emulator's NAT hides multicast, so debug builds take--es test-lanas the browse result. The NSD browse itself only runs on a real phone.iOS.
scripts/build-ios.shbuilds the simulator app on the Mac.Not changed, and gaps
routes.jsonlan). Mousse adds no firewall rule. It relies on Windows' first-run prompt for Mousse.exe, so the network should be Private and Mousse.exe allowed.net.direct.endpointsanswers engine callers with nothing. So the phone learns addresses only by browsing (and from saved routes). Off the LAN (a tailnet or port forward the phone was never given), it can't learn them.Not tested
The owner's phone and home network, a real NSD/Bonjour browse on a phone, the iOS Local Network prompt, and leaving Wi-Fi on a real radio.