Expand description
A host-global record of this machine’s LAN-enabled instances, so the one
instance that holds the UDP probe port can list the others as siblings
in its reply (docs/specs/SPEC_LAN_FLEET_FEED_2026_10_03.md §3, which
links the mobile spec that owns the wire contract).
One <channel>.json per instance under
registry::resolve_shared_lan_instances_dir(), written only while LAN
discovery runs. It carries the instance’s lan_key, which that instance
already broadcasts to the LAN over mDNS, and never the full auth_key.
A channel with LAN off writes nothing, so it is never listed.
Structs§
- Instance
Record 🔒 - One instance’s record, as stored on disk.
Constants§
- MAX_
CHANNEL_ 🔒LEN - MAX_
FILES_ 🔒SCANNED - Directory entries looked at per read. Every file here is written by a local process, but a full disk of junk must not stall a probe reply.
- MAX_
FILE_ 🔒BYTES - A real record is about 200 bytes.
- MAX_
KEY_ 🔒LEN - MAX_
REPLY_ 🔒BYTES - Serialized size a probe reply with siblings is kept under: a single unfragmented datagram on an Ethernet/Wi-Fi MTU of 1500, with headroom.
- MAX_
SIBLINGS 🔒 - Siblings listed in one reply, before the byte budget below applies.
- MAX_
VERSION_ 🔒LEN - REWRITE_
INTERVAL 🔒 - How often a running instance rewrites its record.
- STALE_
AFTER_ 🔒MS - A record not rewritten for this long (three missed rewrites) is not listed.
Functions§
- attach_
siblings 🔒 - Set
response["siblings"]to as many ofsiblingsas keep the serialized reply withinbudgetbytes. Always present, empty when there are none, so a client can tell “no siblings” from “a build that does not send them”. - instances_
dir 🔒 - Where this instance’s record goes:
Nonewhen the shared root can’t be resolved, and alwaysNoneundercargo test, whoseLanDiscovery::startcalls must not overwrite a real instance’s record on the developer’s machine. Tests that exercise the files pass a temp directory. - read_
record 🔒 - Read one record, refusing an oversized file or out-of-bounds fields.
- read_
siblings 🔒 - The other LAN-enabled instances on this host: records in
dirthat are fresh (rewritten withinSTALE_AFTER_MS), whose process is alive, and that are not this instance (neitherown_channelnorown_pid). Sorted by channel, one per channel, at mostMAX_SIBLINGS. - record_
file_ 🔒name - The file a channel’s record lives in: a readable stem, reduced to
[a-z0-9_-](plus other Unicode letters and digits) and capped so it can never name a path outside the directory, then 8 hex chars of a SHA-256 of the exact channel name. The slug alone is lossy (Fooandfoo, orfoo barandfoo_bar, share one), and two LAN-enabled channels sharing a file would overwrite each other’s record (#4297). The real name stays in the file. - remove_
own_ 🔒record - Remove
channel’s record if it is this process’s (pid). Another process on the same channel name owns its own record; this one leaves it alone. - sibling_
json 🔒 - A sibling as it appears in the UDP reply.
auth_keyis that sibling’slan_key, under the field name every client already reads. - write_
record 🔒 - Write
recordatomically (temp file, then rename) with mode 0600 on Unix at open time, the same carereactive::registry::write_entry_filetakes for the shared registry, which also holds keys. On Windows the file inherits the user-only ACL of the user’s own profile directory.