Repository navigation
Peer socket over the LAN while Tailscale is down (server 0.3.34, client 0.1.35) - #90
Merged
Merged
Conversation
During the 2026-11-21 outage the audio moved to the LAN, but the peer socket stayed down: sage switched to one display, the hub never heard, and the top right of the desk couldn't be reached. Hub (0.3.34): with BRAGI_LAN_PEER_PORT set (the packaged unit sets 8443) a second uvicorn server on the LAN serves only /ws/peer/<name>, over TLS with a self-signed certificate made on first start, and only with that name's token, HMAC(secret, name). The "hub" message gives each tray its token and the certificate's SHA-256 over Tailscale. Everything else on that port is refused. Client (0.1.35): remembers those as BRAGI_HUB_LAN_PORT/_CERT/_TOKEN. After two failed tries over Tailscale it connects to the LAN socket, pinning the certificate and sending the token. While there it asks the Tailscale address every 30 s and moves back once it answers. Messages over the LAN don't count as Tailscale being back for the audio fallback, and the hub message there doesn't rewrite the audio or Deskflow address. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
During the 2026-11-21 outage the audio moved to the LAN (bragi#81), but the tray apps' peer socket stayed down. sage switched to one display, the hub never heard about it, and the top right of the desk couldn't be reached until I edited server.conf by hand.
Hub (0.3.34)
app/lan_peer.py: withBRAGI_LAN_PEER_PORTset (the packaged unit sets 8443), a second uvicorn server listens on the LAN. It serves only/ws/peer/<name>, over TLS with a self-signed certificate made on first start (openssl, EC P-256), and only with that name's token, HMAC-SHA256(secret, name). Everything else gets a 404, and a socket without the right token is closed (403).hubmessage gives each tray its token and the certificate's SHA-256, over Tailscale.Client (0.1.35)
BRAGI_HUB_LAN_PORT,_CERTand_TOKEN.wss://<hub LAN IP>:8443/ws/peer/<name>, pinning the certificate and sendingX-Bragi-Lan-Token.hubmessage there is ignored, so it can't rewrite the audio or Deskflow address.Tests
hubmessage.dotnet test139 passed, with new tests for parsing, remembering and the pin.Not yet tried with Tailscale actually down; I'll do that on sagehub after the release.
🤖 Generated with Claude Code