Commit Graph
8 Commits
Author SHA1 Message Date
Audric 76a7f3dce0 docs(topology): document LOCAL_ALIASES, fix stale and incorrect claims
The PDF is built from docs/topology_pdf/ (HTML + Graphviz), not from
TOPOLOGY_EXAMPLES.md, so the two prose copies had drifted. Resync them
and correct several claims that no longer matched the code.

- Add a LOCAL_ALIASES overlay section (+ diagram 6): re-home a short local
  TG under an owned prefix so the mesh routes the long number while local
  clients keep dialing the short one. Translation happens at the trunk
  boundary only -- clients and satellites see the short number.

- Peer interest: MsgPeerTgInterest (type 129) lets a passive listener
  register interest without keying. The HTML still claimed the owner
  cannot fan a TG back until the peer transmits; corrected in the
  Background, the section-2 return leg, and the Properties list.

- Satellite trust model: per-satellite SECRET_<id> is implemented
  (Reflector::resolveSatelliteSecret); drop the "future work" note.

- SATELLITE_FILTER: filter entries are exact unless suffixed with "*"
  (TgFilter::parse), so the documented bare 2222/2224 values matched only
  those literal TGs. Use 2222* and document the syntax.

- Zones are no longer drawn as satellites. A satellite owns no prefix and
  inherits its parent's identity, so a prefix-owning Zone cannot be one.
  Zones now hang off IT 222 as sub-trunks (REMOTE_PREFIX supports a
  comma-separated list), shown with a mix of owned, local-only and aliased
  TGs. Note that ROUTABLE_PREFIXES=* forwards unowned TGs to the uplink,
  where the peer drops them.

- Merge the old section 3 into section 2 as a "sub-trunk star" variant --
  it was the same two-domain topology with a star instead of a full mesh.
  Satellite becomes section 3, twin section 4.

- Disable code-font ligatures: JetBrains Mono rendered SECRET_<id>= as
  SECRET_<id>= with the ">" swallowed by a ">=" ligature.
2026-07-13 10:26:23 +02:00
Audric 0f83a25e50 docs(topology): explain ROUTABLE_PREFIXES for Zone->international reach
The gateway example (section 2) only traced the foreign->Zone direction,
which works via gateway prefix routing because the gateway holds the direct
trunk. The reverse — a regional Zone client calling an international TG —
does NOT work by default: the Zone's prefix table has only 222 + Zone
prefixes, so a foreign TG matches nothing and stays local. Without
ROUTABLE_PREFIXES a regional reflector can never call an international TG.

Add a subsection to section 2 (in both TOPOLOGY_EXAMPLES.md and the PDF
source topology.html) showing the Zone uplink config
(ROUTABLE_PREFIXES=262,240 alongside REMOTE_PREFIX=222), the explicit-prefix
rule for a multi-trunk Zone vs the '*' default route for a single-uplink
leaf, and the multi-trunk '*' warning. Cross-links to README section 5 and
CONCEPTS.md. Rebuilt TOPOLOGY_EXAMPLES.pdf.
2026-06-17 17:33:05 +02:00
Audric e35cf42b27 docs: clarify that local TG numbering is opt-in and routing follows the number
A reflector does not impose the prefix convention on its nodes. Make explicit
the third routing case (previously undocumented): a TG matching no prefix in
the mesh has no owner and stays local-only (relayed among the reflector's own
nodes, never trunked), exactly like stock SvxReflector.

Routing is decided solely by longest-prefix-match on the number itself,
regardless of length: a conforming number is routable wherever its prefix
points *if that prefix is owned by a reflector in the mesh* (e.g. 22210->222
Italy, 26201->262 Germany); a non-matching number (e.g. short 1-199 in a
typical MCC scheme) stays local and is unreachable by international traffic.
Conversely a 'local' number that happens to match a configured prefix will be
routed to that owner.

Use real in-repo MCC examples (222/262) instead of unassigned 201/401, and
state the 'if owned in the mesh' precondition. Updated README (How TG
ownership works), CONCEPTS.md (section 2), and TOPOLOGY_EXAMPLES.md; rebuilt
TOPOLOGY_EXAMPLES.pdf from the matching topology.html change.
2026-06-17 17:28:42 +02:00
Audric edd188b457 docs(topology): expand international mesh diagrams to 5 countries
- §1 (01_intl_mesh.dot): full mesh now includes ES (214), SE (240),
  DE (262), IT (222), UA (255) — 5-node pentagon with 10 edges.
- §2 (02_flat_mesh.dot): international side likewise widened to the
  5-country full mesh; IT 222 stays as the rightmost gateway vertex.
  National-side Zones spread into a 2x2 block mirroring the
  international layout so the 10 national edges have room to breathe.
- ASCII art in TOPOLOGY_EXAMPLES.md §1 and §2 updated to match.
- TOPOLOGY_EXAMPLES.pdf rebuilt via docs/build_topology_pdf.sh.
2026-05-17 13:26:21 +02:00
Audric 28525b03d5 docs(satellite): document per-id SECRET_<id>= across deployment and design docs
- WW_DEPLOYMENT.md, DEPLOYMENT_ITALY.md (+ IT translation): add the
  per-id SECRET_<id>= snippet alongside the existing single-secret
  example so operators see both forms.
- TOPOLOGY_EXAMPLES.md: rewrite the obsolete 'future work:
  per-satellite secrets' callout in §3 to reflect the shipped feature;
  touch up §4 reference to the parent's SECRET.
- DESIGN_SATELLITE_AND_CLUSTER.md: preserve the original design body;
  add a brief postscript pointing readers to the per-id form in the
  README.
2026-05-17 10:55:13 +02:00
Audric 6a6cfadd95 fix(twin): mirror inbound trunk audio across the twin link
When an external PAIRED=1 peer transmits to a twin pair, it picks a
single sticky socket per transmission and sends every frame on it. The
sticky-selected twin's TrunkLink::handleMsgPeerAudio used to broadcast
locally and to satellites but never relayed to the partner twin — so
local clients on the non-sticky twin were deaf to the audio even though
the talker state was mirrored correctly. The satellite-receive path
already had the symmetric forwarder (forwardSatelliteRawAudioToTwin);
the trunk path was just missing it.

Add Reflector::forwardTrunkAudioToTwin and forwardTrunkFlushToTwin,
modelled on the satellite variants, and invoke them from
TrunkLink::handleMsgPeerAudio and handleMsgPeerFlush after the local +
satellite broadcasts. Loop safety: TwinLink::handleMsgPeerAudio does
not re-forward to trunks, so there is no echo back to the originating
peer. Requires the external peer to use PAIRED=1 with both twin
hostnames in a single section — two independent trunk sections would
defeat the source-trunk exclusion at the external owner and cause
duplicates/echo. The docs now flag PAIRED=1 as mandatory for this
topology.

Test: test_twin.py::test_X4_paired_inbound_reaches_both_twins drives a
refa client on TG 26201 and asserts both ref1 and ref2 receive audio
frames and flush. Also rewrite test_01_twin_handshake and
test_05_twin_wiring_no_errors to read /status.twin instead of scraping
a 120s docker-logs window — the previous form flaked when the mesh had
been up long enough for boot-time log lines to scroll off.
2026-05-14 19:37:44 +02:00
Audric a6618790bb feat(peer): passive-monitor support via MsgPeerTgInterest
A node that has selected a TG without keying, or marked it in
monitoredTGs, never received any audio: peer interest was only
populated by talker activity, and the local UDP fanout filtered by
TgFilter alone (current TG match), ignoring monitor entries.

Adds:

- MsgPeerTgInterest (wire ID 129, peer_id + vector<uint32_t>) — each
  trunk peer advertises the union of its local clients' selected TG
  and monitoredTGs to peers whose prefix is the longest-prefix-match
  for the TG. Edge-triggered (500 ms debounce) on client connect /
  disconnect, MsgSelectTG, MsgTgMonitor, and trunk hello completion;
  60 s periodic refresh as a safety net, skipping when the outgoing
  set is unchanged. The receiver writes mapTgIn(tg) into
  m_peer_interested_tgs so the existing send-side gates
  (isPeerInterestedTG, shouldRelayInbound + forwardTrunkAudioToOther
  Trunks) deliver audio without requiring a PTT to bootstrap.

- Multi-hop propagation. Receivers re-advertise interest from other
  peers, prefix-filtered for the destination link and source-link
  excluded, so country-gateway-into-national-mesh layouts (§2)
  converge in one debounce per hop. Closes the gap where SE
  monitoring an Italian regional TG would never reach Z1 without
  IT 222 explicitly forwarding interest.

- TgMonitorFilter applied at every local UDP fanout (audio +
  MsgUdpFlushSamples) — Reflector::onUdpFrameReceived and the local
  talker stop, the trunk receive path, and both directions of the
  satellite mirror. Without this, the protocol-level interest
  arrives at the right reflector but stops at its UDP fanout — the
  passive monitor still hears nothing. Strict superset: no existing
  delivery path is removed.

Loop safety relies on filtering local-side MsgPeerTgInterest by
isSharedTG (same gate as audio fanout). Advertising to non-owner
peers would register ghost interest there, which gateway prefix
routing would then relay back across the mesh. Verified by
test_32_three_way_conversation (full mesh, no echo loops).

Tests: new test_39_passive_monitor_multihop covers the §2 chain
(SE-style monitor on a, talker on d, gateway b). All existing
tests pass: 42 trunk + 7 mqtt-deltas + 6 logging + 14 twin = 69/69.

Builds on the idea originally proposed in #4 by @sa2blv; the
single-hop and wire-ID-collision issues described in the close
comment are addressed in this rewrite.
2026-05-08 20:38:14 +02:00
Audric 52b5e4f3cf feat(reflector): gateway prefix routing via shouldRelayInbound
A non-owner reflector with two trunk legs (a country gateway sitting
between an international mesh and a national mesh) now forwards inbound
trunk traffic toward the actual prefix owner — automatically, via
longest-prefix-match in its own [TRUNK_x] table. Cluster TGs keep their
deliberate single-hop semantic to prevent loops in cyclic meshes.

Implementation
- Reflector::shouldRelayInbound(tg) composes the inbound relay decision:
  * isLocalTG          -> fan out (existing owner-relay)
  * isClusterTG        -> stop (anti-loop; cluster TGs broadcast outbound
                                from local clients only)
  * hasPrefixRoute     -> gateway forwarding via per-trunk isSharedTG
- The four isLocalTG gates in TrunkLink::handleMsgPeer{TalkerStart,
  TalkerStop,Audio,Flush} are replaced by shouldRelayInbound. Source
  exclusion in forwardTrunk*ToOtherTrunks plus per-link interest
  tracking keep the topology naturally loop-free.

Tests
- topology.py: per-reflector `peers` filter for sparse layouts; new
  reflector `d` (prefix 1219, trunked only to `b`) demonstrating
  gateway-only reachability from `a` to `d`.
- generate_configs.py: honours the peers filter.
- test_trunk.py:
  * setUpClass and test_01 skip non-existent pairs in sparse layouts.
  * test_37_gateway_prefix_routing: a-client (122) <-> d-client (1219)
    over TG 121950 in both directions, no CLUSTER_TGS.
  * test_38_cluster_tg_local_client_broadcast: explicit coverage for
    the outbound local-client cluster broadcast path.
- All previously passing tests still pass: 41/41 trunk + 7/7
  mqtt-deltas + 14/14 twin.

Docs
- docs/TOPOLOGY_EXAMPLES.md (new) + .pdf + topology_pdf/ build sources +
  build_topology_pdf.sh: visual cookbook of the five topology shapes
  (international full-mesh, national mesh joined at gateway, satellite
  tree, hybrid satellite-under-regional, HA twin pair). Includes an
  MCC-range appendix with the recommendation to draw cluster TGs from
  100-199 / 800-999 to avoid country-prefix collisions.
- docs/PEER_PROTOCOL.md: rewrote the "Owner-Relay Fanout" section as
  "Inbound Relay (shouldRelayInbound)" with the three-regime
  composition and clarified the single-mesh fanout caveat.
- README.md: feature bullet now describes gateway prefix routing and
  links to TOPOLOGY_EXAMPLES.md (also added to the documentation list).
2026-05-07 16:12:14 +02:00