Repository navigation
feat(transport): add the LAN transport constants, discovery and the device's LAN address - #52
Conversation
…evice's LAN address Adds [lan] to transport.toml (TCP port, client limit, mDNS service and TXT keys, the UDP probe and reply), SystemState.lan_address, a handshake rate limit for the secure channel, and docs/lan.md. Closes #47 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XkZEiUcxbhmHS339r4nWo6
|
The latest Buf updates on your PR. Results from workflow Proto Check / check (pull_request).
|
Hardware test: WiCAN (ESP32-C3) + virtual-carTested together with firmware#135, firmware#136 and mobile-app#138. Requested changes
ResultsSetup (2026-12-06)
1. [Analysis] Boot, and Bluetooth with the new app: passThe boot log shows 2. [PR] Bluetooth off → Wi-Fi, commands, connection log, settings: pass, but see the tier change below
Lock and unlock work over Wi-Fi. The connection log shows Wi-Fi connected, and Settings hides the Bluetooth-only sections and shows the Wi-Fi address row. The availability over LAN follows the dev lock (dimmed while locked), and the dev lock can only be unlocked over Bluetooth, as expected for a system command. 3. [PR] Discovery, from the container: pass
4. [Analysis] Strangers on the LAN can't push the phone off: pass (twice)With the phone's session in slot 0, three raw TCP connections were opened one second apart and never handshaked. Each took slot 1 from the previous one, and the last was closed 10.0 s after connecting. The phone's session never dropped. The free heap was 66380 B with the phone alone and 65892 B with the phone and one stranger. 5. [PR] Board reset while on Wi-Fi: pass, but slow on the direct path
Through the VPN, the subnet router reset the dead connection quickly. On the direct path nothing tells the app the board is gone, so it waits for its idle keepalive (see mobile-app#138). 6. [Analysis] Bluetooth back on → LAN released: pass (twice)Direct: BLE connected at 01:36:45.9, the app subscribed at 01:36:47.46, and the LAN connection was 7. [PR] Manual Wi-Fi address: pass as built, but the requested behaviour changes (see mobile-app#138)With 10. [Analysis] Screen lock and unlock on Wi-Fi: passScreen off at 01:33:53, and Android cut the app's network about 4 s after it stopped (board: 8. [PR] Flash and RAM cost on the C3: measuredSame config,
At runtime the free heap stays around 66 KB with one or two LAN connections open, and a handshake takes 183–205 ms (11 handshakes). The heap with MQTT over TLS wasn't measured. 9. [PR #135] The PR's PC test plan: passTwo clients enrolled through the BLE mock, A from 127.0.0.1 and B from 172.17.0.2 (the mock tells phones apart by IP).
Not tested: an address change from DHCP or a WiFi reconnection, the heap with MQTT over TLS, two real phones on the LAN at once (the second session was a PC client), iOS, LTE builds (LAN is left out by design), E-GMP in the car, and the 0x310 frame on Contract-level checks that held on hardware: the 15-byte probe and 17-byte reply, the 4 replies per second, the TXT keys ( |
- Through the secure channel (LAN and relay) a phone gets the basic state only and may send basic vehicle commands only: reaching the device over a network is no proof of being at the car. Advanced commands need Bluetooth. - An address the user entered is tried alone, with no discovery fallback. - [lan] system_state_repeat_ms (5000) and receive_timeout_ms (15000): the app treats a silent connection as dropped. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XkZEiUcxbhmHS339r4nWo6
|
Thanks for the test. All three are in b101725:
firmware#135/#136 and mobile-app#138 are pinned to this commit. Generated by Claude Code |
Hardware retest: WiCAN (ESP32-C3) + virtual-carRetest after b101725, together with firmware#135 All the requested changes check out. Nothing is left to change from the hardware side. Setup (2026-12-06, same bench as the first test)
R1. Wi-Fi is the remote tier, in the app: passBluetooth off at 04:38:29.19 → LAN connected at 29.39, handshake 190 ms. The pill says Remote, and the dashboard is the remote one (car picture, Doors, Driving, Odometer; no Gear, Speed or Custom 1). Doors lock and unlock work. The connection log says it's Wi-Fi, and Settings still hides the Bluetooth-only sections. Bluetooth back on: BLE connected at 04:56:05.30, and the LAN connection was closed by the app at 06.82. R2. Wi-Fi is the remote tier, on the device (PC): passOver the LAN session, decoded:
Regression: with two sessions open, a third connection is still refused ( R3. A manual address is used alone: pass
R4. Receive timeout, after a board reset: pass
17.2 s from reset to reconnect, against 42.9 s before the change. That fits the 15 s receive timeout followed by an immediate search. R5. Search right away on resume: passScreen off at 04:42:53.8. Android cut the app's network (board: R6. Cold start with Bluetooth on: passApp started at 04:37:07. BLE connected at 04:37:08.8 and subscribed at 09.8, with no LAN connection. Before the change the app did a LAN handshake at every start. Not retested (code unchanged): the probe byte format and its rate limit, the 10 s handshake timeout. Still not tested: an address change from DHCP or a WiFi reconnection, the heap with MQTT over TLS, two real phones, iOS, LTE builds, E-GMP in the car, |
|
🎉 This PR is included in version 0.17.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Requested by Michaël · project thread
What and why
Phase 2 of the epic #44 (LAN direct), contracts side. Closes #47.
[lan]intransport.toml: TCP port 4734, 2 clients, connect timeout, app keepalive every 60 s, and the discovery order (mDNS, UDP probe, last known address).[lan.mdns]:_opencar._tcp, TXT keysid(device key ID) andv(version), browse timeout.[lan.udp_discovery]: port 4735, a fixed-size 15-byte probe (OCDQ, version, key ID or all zero) and a 17-byte reply (OCDR, version, key ID, TCP port), rate-limited to 4 replies per second. Specified as bytes indocs/lan.md, with a test vector.SystemState.lan_address(field 11,ip:port), sent over BLE and through the channel, only a hint.[secure_channel] max_handshake_inits_per_second = 8: a cap on handshake inits across all transports, since each costs X25519 work on the C3 and anyone on the LAN (or the relay's broker, later) can send them. Documented insecure-channel.md.docs/lan.md, linked from the README andsecure-channel.md.Choices the issue left open (please check)
pidTXT key: the issue listed it, but the app matches onidonly, and announcing the car platform tells everyone on the WiFi what car this is.Checklist
buf format,buf lintandbuf breaking --against '.git#branch=main'passlan_addressappended as field 11 andoptionalip:portstring adds at most about 24 bytes to a system state update)Source of the data
Not vehicle data. Port availability from the IANA registry.
Generated by Claude Code