Skip to main content

Module plugin_mdns

Module plugin_mdns 

Source
Expand description

The mdns.advertise and mdns.browse plugin methods: DNS-SD on the LAN, done by the host on a plugin’s behalf.

A sandboxed plugin cannot run an mDNS responder itself. Every plugin unit carries SocketBindDeny=any, and systemd’s bind filter matches every port under any, the ephemeral port 0 included, so an in-process daemon fails at its first bind (the signal socket) before it could reach the multicast port. The host is not sandboxed and publishes the record with the same library and the same SRV-target rule core’s own _ados._tcp advert uses: the system hostname as crate::reach::mdns_hostname resolves it, the one name avahi answers for.

An advert is owned by the plugin connection that made it and is withdrawn when that connection ends, so a record never outlives the process serving the port it names. Its port must be one of the plugin’s declared listen_ports: a plugin can only advertise what the sandbox lets it serve. The service types core publishes itself (RESERVED_SERVICE_TYPES) are refused, so a plugin cannot impersonate a node’s pairing record or a ground station’s receiver. Browsing any well-formed type is allowed.

The types are the wire shape: the host decodes the request and serializes the reply with them, and the SDK does the reverse, so the two cannot drift.

Structs§

AdvertiseRequest
An mdns.advertise request.
Advertised
The record the host published.
BrowseReply
What one browse found.
BrowseRequest
An mdns.browse request.
DiscoveredService
One resolved service instance.

Constants§

ADVERTISE_CAPABILITY
The capability mdns.advertise is gated on: advertising a port is offering it to the network, which is what network.listen grants.
ADVERTISE_METHOD
The advertise method’s wire name.
BROWSE_CAPABILITY
The capability mdns.browse is gated on: a browse finds peers to connect out to.
BROWSE_DEFAULT_TIMEOUT_MS
The browse window when the request names none.
BROWSE_MAX_RESULTS
The most services one browse returns.
BROWSE_MAX_TIMEOUT_MS
The longest browse window a request may ask for.
BROWSE_METHOD
The browse method’s wire name.
BROWSE_MIN_TIMEOUT_MS
The shortest browse window: one mDNS query round trip.
RESERVED_SERVICE_TYPES
The service types core publishes. A plugin may browse them but never advertise one: _ados._tcp is every node’s pairing record (the control front publishes it on every profile and interface) and _ados-receiver._tcp is the ground-station mesh receiver.
TXT_MAX_ENTRIES
The most TXT entries one advert may carry.
TXT_MAX_KEY_LEN
The longest TXT key.
TXT_MAX_VALUE_LEN
The longest TXT value, in bytes.

Functions§

advertisable_service_type
The service type a plugin may advertise, canonical: TCP, well formed, and not one core publishes.
normalize_service_type
The canonical _<name>._<tcp|udp> form of a service type (a trailing .local. or .local is stripped), or why it is not one.
validate_txt
Check a TXT record against the size and key rules: at most TXT_MAX_ENTRIES entries, keys of 1..=TXT_MAX_KEY_LEN printable ASCII characters without =, values of at most TXT_MAX_VALUE_LEN bytes.