The receive-side handlers (handleMsgTrunkTalkerStart, handleMsgTrunkAudio,
etc.) used isSharedTG() which only checks the remote peer's prefix. This
caused non-cluster TGs to be silently dropped on the receiving reflector —
e.g. a client on reflector-a talking on TG 40001 (owned by reflector-b)
would never reach reflector-b because reflector-b checked the TG against
reflector-a's prefix instead of its own.
Add isOwnedTG() that accepts TGs matching either the local or remote
prefix, and use it in all four receive handlers. The send-side still uses
isSharedTG() (remote prefix only) which is correct.
Also add a Docker-based integration test suite (tests/) with 11 automated
tests covering handshake, routing, cross-reflector audio delivery, cluster
TGs, heartbeat, disconnect cleanup, and trunk-to-trunk isolation. An
interactive mode lets users test arbitrary TG numbers with routing verified
via reflector logs. Topology is defined once in tests/topology.py.
Fix Dockerfile to copy built shared libraries to the runtime image.
Previously TrunkLink only connected outbound — there was no server
listening on port 5302, so both reflectors got "Connection refused."
Changes:
- Reflector: add trunk TcpServer (default port 5302, configurable
via TRUNK_LISTEN_PORT) that accepts inbound peer connections,
authenticates via HMAC, and matches by secret + prefix
- TrunkLink: support both outbound and inbound directions with
automatic conflict resolution (lower priority keeps outbound)
- Security: pre-auth frame size cap (4KB), max 5 pending connections,
10s hello timeout, log-injection sanitization
- Docs: updated TRUNK_PROTOCOL.md, README.md, CLAUDE.md
isSharedTG now finds the longest matching remote prefix and verifies
no other prefix in the mesh is more specific. Each TrunkLink receives
the full set of all prefixes at startup via setAllPrefixes().
initTrunkLinks is split into two passes: collect all prefixes first,
then create links with full knowledge.
Cluster TGs are a per-reflector subscription choice, not a mesh-wide
requirement. Document that satellites forward all TGs unconditionally
with no prefix or cluster TG filtering.
Satellite reflectors are lightweight relay instances that connect to a
parent reflector instead of joining the full trunk mesh. Clients connect
to the satellite normally; it relays all TGs bidirectionally to the
parent. The parent forwards satellite events to local clients, trunk
peers, and other satellites.
New classes:
- SatelliteLink: parent-side handler for each inbound satellite
connection (HMAC auth, heartbeat, all-TG relay)
- SatelliteClient: satellite-side outbound connection to parent
Wire protocol: MsgTrunkHello gains m_role field (ROLE_PEER=0,
ROLE_SATELLITE=1) to distinguish satellite handshakes.
Config:
- Parent: [SATELLITE] section with LISTEN_PORT and SECRET
- Satellite: SATELLITE_OF, SATELLITE_PORT, SATELLITE_SECRET in [GLOBAL]
HTTP /config endpoint now shows mode (reflector/satellite),
satellite_server config on parents, and satellite connection info.
Docs updated: README, DEPLOYMENT_ITALY, Italian translation.
Cluster TGs (BrandMeister-style): talk groups broadcast to all trunk
peers regardless of prefix ownership. Configured via CLUSTER_TGS in
[GLOBAL]. Routing checks in TrunkLink now accept isSharedTG || isClusterTG
for all 8 inbound/outbound handlers. Validated at startup to not overlap
with any LOCAL_PREFIX or REMOTE_PREFIX.
New GET /config endpoint returns static configuration (local_prefix,
cluster_tgs, listen_port, http_port, trunk peers) for dashboard use.
Docs: cluster TG sections added to README, DEPLOYMENT_ITALY, and
Italian translation. Design doc for satellite reflectors and cluster
TGs added.