Repository navigation
feat(network): use the server's local address automatically at home - #598
Conversation
A signed-in phone or TV now sends its requests to the server's address on the local network whenever that address proves it is the server, and goes back to the saved address as soon as it doesn't. The app reads the key the server presents on its API port from GET /api/v2/system/connections, over the saved HTTPS address and without following redirects, and uses a private IPv4 address (the admin-set local address, or the one that last worked) only when TLS there presents that key and the identity check answers the saved server. Only the transport moves: an OkHttp interceptor rewrites scheme, host and port and relabels the response, so auth checks, caches, URL resolution and stored URLs keep the saved address. API requests, artwork and video move. A request that fails on the route drops it at once and goes again to the saved address when it can't have been sent or is a GET or HEAD. A stream keeps the route it started on, and continues from the saved address when that route goes. Sign-in and refresh, sockets, Watch Party, downloads, sidecar subtitles, audiobooks, the reader and casting stay on the saved address. Checks run in the foreground on Wi-Fi or Ethernet only, after every network change and foreground return, and once more after a failure. The active server's row in the phone and TV server lists reads "Connected on your local network" while the route is in use. Closes #591 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
The Android apps now move to the server's local address at home (Silo-Server/silo-android#598). They find it from Local network address only, so the Docker page no longer says the setting can stay empty with host networking, and the reverse-proxy page says the apps switch only on Wi-Fi or a wired network. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The probe clients keep no idle connections. Over HTTP/2, a multiplexed connection could be evicted from that empty pool before its answer was read, so a valid candidate sometimes failed its check. This flaked LocalRouteTransportTest in CI (11 of 200 local runs). The server's LAN TLS listener offers only HTTP/1.1, so the probes now ask for it alone: 0 of 600 runs failed. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…takes the route The server picks a playback session's local or remote bitrate cap from the network its `POST /api/v2/playback/start` arrives through, stores it, and reuses it for every replan. Admission went over the local route for every stream, including Watch Party, casting and audiobooks, whose media stays on the saved address. Those sessions got the local cap and counted as local while streaming over a tunnel or public address. Admission now takes the route only when the stream's media may: the phone and TV video starters pass the same rule their media gets, and every other caller admits on the saved address. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…resses first - A candidate that presents a key other than the pin now makes the app read the connections document again in the same check. Before, a SECRET_KEY rotation within 15 minutes of the last read left the old pin in place, and the route off, until a later trigger. - An admin-set host name is resolved only after the local address in use, the one that worked last and an IP-literal local address have failed, so a slow lookup no longer delays one that works. - The starter publishes the active server only if it is still the same after the sign-in lookup; a switch or sign-out during the lookup publishes itself next. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
The Android apps now move to the server's local address at home (Silo-Server/silo-android#598). They find it from Local network address only, so the Docker page no longer says the setting can stay empty with host networking, and the reverse-proxy page says the apps switch only on Wi-Fi or a wired network. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…address setting (#216) * docs(docker): cover HTTPS on the Silo port and the Local network address setting Co-Authored-By: Claude Opus 5.5 <[email protected]> * docs(reverse-proxy): say Apple apps switch to the local address at home Co-Authored-By: Claude Opus 5.5 <[email protected]> * docs: say the Android apps switch to the local address at home too The Android apps now move to the server's local address at home (Silo-Server/silo-android#598). They find it from Local network address only, so the Docker page no longer says the setting can stay empty with host networking, and the reverse-proxy page says the apps switch only on Wi-Fi or a wired network. Co-Authored-By: Claude Opus 5.5 <[email protected]> * docs(docker): use the Admin > Server > General path for Local network address * docs(docker): say only the Apple apps use the announcement to switch at home * docs(docker): say what the Silo apps check in the self-signed certificate * docs(reverse-proxy): name the address that has to work at home --------- Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: zZebrahz <[email protected]>
Problem
Closes #591
Related issue: Silo-Server/silo-server#1268
Validation tasks: none
At home, a signed-in phone or TV saved with the server's public URL, reverse proxy or tunnel still sends every request the long way round, through hairpin NAT or the tunnel's limits. The server counts those streams as remote and applies the remote bitrate limit. The Apple apps now switch to the server's local address on their own (Silo-Server/silo-apple#804); Android didn't.
Solution
The phone and TV apps now move their requests to the server's local address whenever it proves it is the server, and go back to the saved address as soon as it doesn't. This follows the server contract in Silo-Server/silo-server#2532 (
docs/architecture/server-identity.md, "Local network TLS") and the rules the Apple reviews settled.local_routefromGET /api/v2/system/connectionsonly over a saved HTTPS address with no path, on a client of its own that follows no redirect. A candidate is used only when TLS there presents exactly the pinned key andGET /api/v2/system/identityanswers the saved server's identity. No other certificate is ever accepted for a candidate, probes follow no redirect, and every routed request checks the connection's key again before anything is written, so a pooled or resumed connection can't carry it to another key.local_route.url, or the private addresses its host name resolves to), each tried ashttpson the same port and only as an RFC 1918 IPv4 address. A host name is looked up only after the known addresses fail. Android doesn't browse_silo._tcpyet (feat(onboarding): list Silo servers found on the network and tailnet #460), so a server that relies on its LAN announcement alone needs Local network address set before Android uses it.SECRET_KEYrotated. Nothing probes on a timer./api/moves.POST /api/v2/playback/startarrives through, and replans keep it. So admission takes the route only when the stream's media may: Watch Party, casting and audiobooks are admitted on the saved address.Validation
Ran against a dev sandbox built from silo-server
origin/maind94a97092, which includes Silo-Server/silo-server#2532. The saved address was an HTTPS reverse proxy with a publicly trusted certificate. The LAN address was a private IPv4 address the emulator reaches, forwarded at TCP level to the sandbox's API port so TLS ran end to end, and set as Local network address. Phone: Android 16 emulator (Wi-Fi plus a simulated LTE network). TV: Android TV 16 emulator (Ethernet).origin/main): the server lists show the saved address only, and the server counts a direct-play stream from the phone and from the TV as remote.LocalRouteTestandLocalRouteControllerTest(shared) andLocalRouteTransportTest(android-shared, MockWebServer over real TLS) cover the address rules, the controller's checks, fallbacks and retry limit, pin-only trust, a pooled connection whose key is no longer the pin, the retry rules, an interrupted read, auth paths, sockets and saved-address markers, media routing, and the pin read refusing a redirect.SequencedPlaybackTestcovers admission staying on the saved address unless the stream's media may take the route../gradlew testDebugUnitTestpasses (5,915 tests).CONTRIBUTING.mdpass, and both supply-chain scripts pass.:androidApp:assembleDebug,:androidTvApp:assembleDebugand both release bundles build.Evidence: https://evidence.siloserver.org/r/silo-android/issue-591/
Risks
Follow-ups
_silo._tcpadverts as candidates once Android discovers servers (feat(onboarding): list Silo servers found on the network and tailnet #460).AI disclosure
🤖 Generated with Claude Code
Note
Add automatic local-network routing to the active server on Android
LocalRouteControllerin shared code that learns a local route from the server's connections document, verifies candidates by TLS SPKI pin and server identity, and publishes the confirmed route to process-wideLocalRoutesstate. Android wiring lives inLocalRouteStarter, started from both phone and TV app entry points.LocalRouteTls,PinOnlyTrustManager,PinningHostnameVerifier) rewrite eligible requests to the local origin while pinning the endpoint key. Repeatable GET/HEAD requests fall back to the saved address on route failure; unrepeatable mutations that may have arrived are not retried.SiloPlayerFactory; Watch Party playback, downloads, sign-in, and Watch Together requests are explicitly kept on the saved address.Macroscope summarized 6c9f362.