discovery
diapason.mesh.discovery
¶
Discover already-paired Diapason devices without publishing identity.
mDNS is a hint, never a credential. Anyone on the current Wi-Fi can publish
an SRV record, so this module neither enrols a device nor writes a discovered
address to the registry. It only contacts a candidate whose rotating service
name can be derived from a public key learned during pairing. The peer then
answers with its own signed presence beacon; beacon.verify_beacon remains
the sole path that may retain the address.
The record deliberately contains no device id, hostname, owner id, platform, version or capability. Its instance label rotates hourly, which prevents the same laptop from advertising one durable tracking token in every café it visits.
Advertisement
dataclass
¶
The complete public record — intentionally tiny and inspectable.
DiscoveryUnavailable
¶
Bases: RuntimeError
The optional cross-platform mDNS implementation is not installed.
consider_candidate(*, name, addresses, port, properties, registry, announce, now_ms)
¶
Contact one authenticated-by-pairing candidate, without retaining it.
current_advertisement(*, now_ms=None)
¶
Build what this process may truthfully advertise, or nothing.
No endpoint means the server has not promised a socket. Loopback, link-local and non-IP hosts are not advertised: a peer could not reach them through the transport policy, so publishing them would be a lie.
expected_names(registry, *, now_ms)
¶
Map rotating labels to trusted local device ids.
The previous and next periods tolerate clock skew around the hour. A
revoked device disappears because public_key_of refuses to return its
key, even if an old row still exists in the database.
run_discovery(*, registry=None, announce=None)
async
¶
Advertise and browse until the server lifespan cancels this task.
service_token(public_key, *, now_ms, offset=0)
¶
A 16-character rotating label known to already-paired devices only.
txt_properties()
¶
Protocol version, and absolutely no identifying metadata.