docs: refresh test docs and complete MsgTrunk* -> MsgPeer* rename
- TWIN_PROTOCOL.md: note that the trunk->twin mirror delivers to selected
AND monitoring clients (the composite selected-OR-monitor filter),
pairing with the TwinLink fix in f1d4afd; complete the MsgTrunk* ->
MsgPeer* rename in the steady-state message table and design narrative.
- TESTS.md: bring in line with the current suite — trunk 35->50, twin
11->17. Document test_trunk 33-47 (satellite cross-visibility, prefix
routing/cluster fanout, monitor-TG fanout, trunk resilience) and the
test_twin X1-X5 series including the new X5 monitor regression; add the
mqtt-deltas, satellite-secrets, and logging suites to the run sequence;
update the five-client roster.
- Rename stale MsgTrunk* references to MsgPeer* (wire IDs unchanged, per
18d92a2) across README, DEPLOYMENT_ITALY{,_IT}, WW_DEPLOYMENT,
JAY-additions, and DESIGN_SATELLITE_AND_CLUSTER. PEER_PROTOCOL.md keeps
its two MsgTrunk* mentions — they document the rename itself.
This commit is contained in:
1 parent
f1d4afd032
commit
e3b0b6f3df
8 files changed
+126
-74
No files matched your search
@@ -277,7 +277,7 @@ All reflectors in the mesh must list the same `CLUSTER_TGS` value.
|
||||
|
||||
There is **no hardcoded limit** on concurrent QSOs over the trunk. The trunk
|
||||
between each pair of reflectors is a single TCP connection that multiplexes all
|
||||
active TGs simultaneously — each `MsgTrunkAudio` frame is tagged with the TG
|
||||
active TGs simultaneously — each `MsgPeerAudio` frame is tagged with the TG
|
||||
number, so any number of TGs can carry audio at the same time.
|
||||
|
||||
The only per-TG rule is that **one talker is allowed per TG at a time**
|
||||
|
||||
@@ -284,7 +284,7 @@ Tutti i reflector nella mesh devono avere lo stesso valore di `CLUSTER_TGS`.
|
||||
|
||||
Non esiste **nessun limite fisso** al numero di QSO simultanei sul trunk. Il trunk
|
||||
tra ogni coppia di reflector è una singola connessione TCP che multiplexa tutti i
|
||||
TG attivi contemporaneamente — ogni frame `MsgTrunkAudio` è etichettato con il
|
||||
TG attivi contemporaneamente — ogni frame `MsgPeerAudio` è etichettato con il
|
||||
numero di TG, quindi qualsiasi numero di TG può trasmettere audio nello stesso momento.
|
||||
|
||||
L'unica regola per TG è che **un solo operatore alla volta può trasmettere su un
|
||||
|
||||
@@ -88,7 +88,7 @@ Similar to `TrunkLink` but with different semantics:
|
||||
| Aspect | TrunkLink (peer-to-peer) | SatelliteLink |
|
||||
|--------|-------------------------|---------------|
|
||||
| Topology | Symmetric mesh peers | Asymmetric — parent is authority |
|
||||
| TG routing | Prefix-based (`isSharedTG`/`isOwnedTG`) + cluster (`isClusterTG`) | Unfiltered by default; optional `SATELLITE_FILTER` (bidirectional, advertised via `MsgTrunkFilter`) |
|
||||
| TG routing | Prefix-based (`isSharedTG`/`isOwnedTG`) + cluster (`isClusterTG`) | Unfiltered by default; optional `SATELLITE_FILTER` (bidirectional, advertised via `MsgPeerFilter`) |
|
||||
| Talker arbitration | Nonce tie-break | Parent always wins |
|
||||
| Who initiates | Both sides connect to each other | Satellite connects to parent |
|
||||
| Audio path | Only prefix-matched + cluster TGs | All TGs active on either side |
|
||||
@@ -104,7 +104,7 @@ Similar to `TrunkLink` but with different semantics:
|
||||
(dynamically on accept, like `ReflectorClient`).
|
||||
|
||||
3. **Audio forwarding**: when a local client or trunk peer starts talking on any
|
||||
TG, the parent also sends `MsgTrunkTalkerStart` + `MsgTrunkAudio` to all
|
||||
TG, the parent also sends `MsgPeerTalkerStart` + `MsgPeerAudio` to all
|
||||
connected satellites. When a satellite client talks, the parent treats it
|
||||
identically to a local client — forwards to trunk peers via `isSharedTG` as
|
||||
normal.
|
||||
@@ -127,10 +127,10 @@ The satellite is a **thin relay**:
|
||||
#### Wire protocol
|
||||
|
||||
Reuse the existing trunk message types (115-120). The satellite handshake
|
||||
(`MsgTrunkHello`) includes a flag field so the parent knows to treat the
|
||||
(`MsgPeerHello`) includes a flag field so the parent knows to treat the
|
||||
connection as a satellite rather than a mesh peer.
|
||||
|
||||
Add one field to `MsgTrunkHello`:
|
||||
Add one field to `MsgPeerHello`:
|
||||
|
||||
```cpp
|
||||
uint8_t m_role; // 0 = PEER (default, backward-compatible), 1 = SATELLITE
|
||||
@@ -143,7 +143,7 @@ uint8_t m_role; // 0 = PEER (default, backward-compatible), 1 = SATELLITE
|
||||
| `Reflector.cpp` | Add satellite TCP server, accept satellite connections |
|
||||
| `SatelliteLink.cpp` (new) | Parent-side satellite connection handler |
|
||||
| `SatelliteClient.cpp` (new) | Satellite-side parent connection + local relay |
|
||||
| `ReflectorMsg.h` | Add `m_role` to `MsgTrunkHello` |
|
||||
| `ReflectorMsg.h` | Add `m_role` to `MsgPeerHello` |
|
||||
| `TrunkLink.cpp` | No changes — mesh unchanged |
|
||||
| `svxreflector.conf.in` | Add `[SATELLITE]`, `SATELLITE_OF` settings |
|
||||
|
||||
@@ -265,11 +265,11 @@ void TrunkLink::onLocalTalkerStart(uint32_t tg, const std::string& callsign)
|
||||
{
|
||||
return;
|
||||
}
|
||||
sendMsg(MsgTrunkTalkerStart(tg, callsign));
|
||||
sendMsg(MsgPeerTalkerStart(tg, callsign));
|
||||
}
|
||||
```
|
||||
|
||||
Similarly for inbound: `handleMsgTrunkTalkerStart` and the other receive
|
||||
Similarly for inbound: `handleMsgPeerTalkerStart` and the other receive
|
||||
handlers use `isOwnedTG` (checks both local and remote prefix) instead of
|
||||
`isSharedTG`, combined with `|| isClusterTG`:
|
||||
|
||||
@@ -306,7 +306,7 @@ The `onTalkerUpdated` callback currently iterates all trunk links and calls
|
||||
individually decides whether to forward based on `isSharedTG || isClusterTG`.
|
||||
|
||||
Audio forwarding in `Reflector::onTalkerUpdated` already loops all links. Same
|
||||
for `handleMsgTrunkAudio` -> `broadcastUdpMsg` on the receiving side.
|
||||
for `handleMsgPeerAudio` -> `broadcastUdpMsg` on the receiving side.
|
||||
|
||||
#### Cluster TG validation at startup
|
||||
|
||||
@@ -368,7 +368,7 @@ No new message types. No wire protocol changes. No new classes.
|
||||
|---|---|---|
|
||||
| **Solves** | Mesh scaling for large deployments | Shared nationwide channels |
|
||||
| **Complexity** | New class + new TCP listener | ~50 lines of routing logic changes |
|
||||
| **Wire protocol** | 1 new field in MsgTrunkHello | No changes |
|
||||
| **Wire protocol** | 1 new field in MsgPeerHello | No changes |
|
||||
| **Config** | `[SATELLITE]`, `SATELLITE_OF` | `CLUSTER_TGS=222,91` |
|
||||
| **Risk** | Medium — new connection type | Low — additive routing check |
|
||||
| **Recommended order** | Second | **First** (simpler, high value) |
|
||||
|
||||
@@ -25,8 +25,8 @@ material that was not merged here.
|
||||
| Per-trunk config | `TG_MAP=peer:local,...` | Bidirectional TG remap; mapped TGs bypass the prefix routing check on this link |
|
||||
| Per-trunk config | `PEER_ID` | Stable identifier advertised in the trunk hello (defaults to section name); used as the MQTT topic component on the receiving side |
|
||||
| Global config | `MQTT_NAME` (in `[MQTT]`) | Appended to `TOPIC_PREFIX` so each reflector publishes under a unique sub-tree (`<TOPIC_PREFIX>/<MQTT_NAME>/...`) |
|
||||
| Wire protocol | `MsgTrunkNodeList` (type **121**) | Periodic node list (callsign + current TG, plus optional lat/lon/QTH) sent peer-to-peer when the local client list changes; receiver re-publishes it via MQTT |
|
||||
| Wire protocol | `MsgTrunkFilter` (type **122**) | Optional satellite-side TG-filter advertisement so a satellite can subscribe to only a subset of the parent's TGs |
|
||||
| Wire protocol | `MsgPeerNodeList` (type **121**) | Periodic node list (callsign + current TG, plus optional lat/lon/QTH) sent peer-to-peer when the local client list changes; receiver re-publishes it via MQTT |
|
||||
| Wire protocol | `MsgPeerFilter` (type **122**) | Optional satellite-side TG-filter advertisement so a satellite can subscribe to only a subset of the parent's TGs |
|
||||
| PTY commands | `TRUNK MUTE \| UNMUTE <section> <callsign>` | Live mute of a callsign per trunk link; muted callsigns' inbound audio is dropped |
|
||||
| PTY commands | `TRUNK RELOAD [<section>]` | Re-reads `BLACKLIST_TGS`, `ALLOW_TGS`, `TG_MAP` from the live config without restarting |
|
||||
| PTY commands | `TRUNK STATUS [<section>]` | Dumps a one-line status summary per trunk link to the PTY |
|
||||
@@ -77,8 +77,8 @@ linked above and open an issue or PR on this repository.
|
||||
| File | What to look for |
|
||||
|------|------------------|
|
||||
| `src/svxlink/reflector/TgFilter.h` | Filter parser |
|
||||
| `src/svxlink/reflector/ReflectorMsg.h` | `MsgTrunkNodeList` (121), `MsgTrunkFilter` (122) |
|
||||
| `src/svxlink/reflector/TrunkLink.{h,cpp}` | Per-link filters, mapping, mute, `reloadConfig`, `statusLine`, `sendNodeList`, `handleMsgTrunkNodeList`, `peerId()` |
|
||||
| `src/svxlink/reflector/ReflectorMsg.h` | `MsgPeerNodeList` (121), `MsgPeerFilter` (122) |
|
||||
| `src/svxlink/reflector/TrunkLink.{h,cpp}` | Per-link filters, mapping, mute, `reloadConfig`, `statusLine`, `sendNodeList`, `handleMsgPeerNodeList`, `peerId()` |
|
||||
| `src/svxlink/reflector/Reflector.{h,cpp}` | `scheduleNodeListUpdate`, `sendNodeListToAllPeers`, `onPeerNodeList`, PTY `TRUNK` command branch, `MQTT_NAME` topic prefix |
|
||||
| `src/svxlink/reflector/MqttPublisher.{h,cpp}` | `publishLocalNodes`, `publishPeerNodes` |
|
||||
| `src/svxlink/reflector/svxreflector.conf.in` | Config-template documentation for every new key |
|
||||
|
||||
+30
-24
@@ -2,7 +2,7 @@
|
||||
|
||||
> **Status:** Implemented in v1.3.x+twin2. See §Implementation for
|
||||
> what shipped and `tests/test_twin.py` for integration test coverage
|
||||
> (11 tests including end-to-end V2-client audio mirroring and
|
||||
> (17 tests including end-to-end V2-client audio mirroring and
|
||||
> partner-roster propagation into `/status.twin.nodes`).
|
||||
|
||||
## Motivation
|
||||
@@ -61,7 +61,7 @@ connect to either physical node.
|
||||
failure. This gives zero-holdoff failover at the cost of external
|
||||
peers needing to understand "paired hosts" in their trunk config.
|
||||
- Cross-twin talker arbitration reuses the existing priority-nonce
|
||||
tie-break: the same 32-bit `priority` field from `MsgTrunkHello`
|
||||
tie-break: the same 32-bit `priority` field from `MsgPeerHello`
|
||||
decides who wins when both twins' clients PTT the same TG at the same
|
||||
instant.
|
||||
- During a twin-link outage both twins keep operating fully and
|
||||
@@ -91,7 +91,7 @@ symmetric (like a trunk) and strictly 1:1 (unlike either).
|
||||
|
||||
### Handshake
|
||||
|
||||
Reuse `MsgTrunkHello` (type 115) with a new role value:
|
||||
Reuse `MsgPeerHello` (type 115) with a new role value:
|
||||
|
||||
```cpp
|
||||
static const uint8_t ROLE_PEER = 0; // existing
|
||||
@@ -99,7 +99,7 @@ static const uint8_t ROLE_SATELLITE = 1; // existing
|
||||
static const uint8_t ROLE_TWIN = 2; // NEW
|
||||
```
|
||||
|
||||
Both sides send `MsgTrunkHello` with `role=ROLE_TWIN`, the shared
|
||||
Both sides send `MsgPeerHello` with `role=ROLE_TWIN`, the shared
|
||||
`[TWIN]` section name as `id`, the common `LOCAL_PREFIX` as
|
||||
`local_prefix`, an HMAC over `secret`, and a fresh 32-bit `priority`
|
||||
nonce.
|
||||
@@ -124,14 +124,14 @@ filtering:
|
||||
|
||||
| Type | Name | Purpose on twin link |
|
||||
|------|----------------------------|---------------------------------------------------|
|
||||
| 115 | `MsgTrunkHello` | Handshake (role=ROLE_TWIN) |
|
||||
| 116 | `MsgTrunkTalkerStart` | Mirror local-client talker start |
|
||||
| 117 | `MsgTrunkTalkerStop` | Mirror local-client talker stop |
|
||||
| 118 | `MsgTrunkAudio` | Mirror local-client audio |
|
||||
| 119 | `MsgTrunkFlush` | Mirror end-of-stream |
|
||||
| 120 | `MsgTrunkHeartbeat` | Keepalive (**2s TX / 5s RX** on twin links) |
|
||||
| 121 | `MsgTrunkNodeList` | Mirror node roster so `/status` is consistent on both twins |
|
||||
| 122 | `MsgTrunkFilter` | **Not used on twin links** — twins mirror every TG unconditionally. Reserved for satellite use. |
|
||||
| 115 | `MsgPeerHello` | Handshake (role=ROLE_TWIN) |
|
||||
| 116 | `MsgPeerTalkerStart` | Mirror local-client talker start |
|
||||
| 117 | `MsgPeerTalkerStop` | Mirror local-client talker stop |
|
||||
| 118 | `MsgPeerAudio` | Mirror local-client audio |
|
||||
| 119 | `MsgPeerFlush` | Mirror end-of-stream |
|
||||
| 120 | `MsgPeerHeartbeat` | Keepalive (**2s TX / 5s RX** on twin links) |
|
||||
| 121 | `MsgPeerNodeList` | Mirror node roster so `/status` is consistent on both twins |
|
||||
| 122 | `MsgPeerFilter` | **Not used on twin links** — twins mirror every TG unconditionally. Reserved for satellite use. |
|
||||
| 123 | `MsgTwinExtTalkerStart` | **NEW** — "my external trunk peer `<peer_id>` has claimed TG X with callsign Y"; receiver updates its `TGHandler` trunk-talker map so local clients on the partner twin cannot key up that TG |
|
||||
| 124 | `MsgTwinExtTalkerStop` | **NEW** — clears the corresponding external-talker state |
|
||||
|
||||
@@ -145,7 +145,7 @@ to the correct external peer on reconnect/cleanup.
|
||||
|
||||
### Cross-twin talker arbitration
|
||||
|
||||
When `handleMsgTrunkTalkerStart` fires on a twin link, the receiver
|
||||
When `handleMsgPeerTalkerStart` fires on a twin link, the receiver
|
||||
treats it like a trunk talker-start **with prefix filtering disabled**:
|
||||
any TG is accepted, and `TGHandler::setTrunkTalkerForTG(tg, callsign)`
|
||||
is called so local clients on the receiving twin cannot grab the talker
|
||||
@@ -155,9 +155,14 @@ priority-nonce rule (lower wins, loser yields via the existing
|
||||
|
||||
### Audio replication
|
||||
|
||||
`MsgTrunkAudio` on a twin link is broadcast to local clients on the
|
||||
`MsgPeerAudio` on a twin link is broadcast to local clients on the
|
||||
matching TG via `Reflector::broadcastUdpMsg` — same as the trunk path,
|
||||
but without the `isOwnedTG` gate. The twin does *not* re-forward the
|
||||
but without the `isOwnedTG` gate. As on the trunk and satellite paths,
|
||||
the broadcast reaches both clients with the TG **selected** and passive
|
||||
**monitors** of it (the composite selected-OR-monitor filter, preserving
|
||||
the passive-observer / earliest-monitor-talker arbitration); a plain
|
||||
selected-only filter would silently drop monitor-only listeners on the
|
||||
non-sticky twin (see `test_X5`). The twin does *not* re-forward the
|
||||
audio to its own external trunks (that would duplicate — external
|
||||
trunks are only held by the primary; see below).
|
||||
|
||||
@@ -223,7 +228,7 @@ only on which twin the local client is physically connected to.
|
||||
|
||||
### Cross-twin external-talker state propagation
|
||||
|
||||
When a twin receives `MsgTrunkTalkerStart(tg=262xx, callsign=IW0ABC)`
|
||||
When a twin receives `MsgPeerTalkerStart(tg=262xx, callsign=IW0ABC)`
|
||||
from refA on its sticky socket, it:
|
||||
|
||||
1. Updates its own `TGHandler` trunk-talker state as usual.
|
||||
@@ -245,9 +250,10 @@ forwards the audio across the twin link via
|
||||
satellite-to-twin mirror), reusing `MsgPeerAudio` on the [TWIN] socket.
|
||||
`TrunkLink::handleMsgPeerFlush` mirrors the matching flush. The
|
||||
receiving partner's `TwinLink::handleMsgPeerAudio` broadcasts to its
|
||||
local clients on the TG and fans the audio out to its own satellites;
|
||||
it does *not* re-forward to trunk peers, so there is no echo back to
|
||||
refA.
|
||||
local clients on the TG — both selected and passive-monitoring, using
|
||||
the same composite filter as the trunk path (see `test_X5`) — and fans
|
||||
the audio out to its own satellites; it does *not* re-forward to trunk
|
||||
peers, so there is no echo back to refA.
|
||||
|
||||
### refA-side socket selection policy
|
||||
|
||||
@@ -371,7 +377,7 @@ Where the pieces live in the source tree:
|
||||
the twin link can be cleaned up per-peer on disconnect without
|
||||
clobbering other peers' claims.
|
||||
- **`ReflectorMsg.h`** adds types 123 / 124 (`MsgTwinExtTalkerStart`
|
||||
/ `Stop`) and a new `ROLE_TWIN = 2` value on `MsgTrunkHello`.
|
||||
/ `Stop`) and a new `ROLE_TWIN = 2` value on `MsgPeerHello`.
|
||||
- **`svxreflector.conf.in`** includes commented-out `[TWIN]` and
|
||||
`PAIRED=1` examples.
|
||||
- **`tests/test_twin.py`** covers handshake, PAIRED trunk wiring,
|
||||
@@ -393,19 +399,19 @@ Artifacts that can occur while the twin link is down:
|
||||
|
||||
- A German client on ref1 and a different German client on ref2 can
|
||||
both PTT TG 262xx at the same time. Each twin is unaware of the
|
||||
other's talker and both forward `MsgTrunkTalkerStart` to refA over
|
||||
other's talker and both forward `MsgPeerTalkerStart` to refA over
|
||||
their own external sockets. refA will receive conflicting
|
||||
talker-starts on its two endpoints for the same logical trunk.
|
||||
Resolution: refA's sticky routing means it accepts whichever it
|
||||
sees first and the other twin's forwarded audio lands on the
|
||||
non-sticky socket; the non-sticky-side audio is dropped by refA's
|
||||
"audio only from the peer that claimed the TG" check (same rule
|
||||
already used inside `handleMsgTrunkAudio` today).
|
||||
already used inside `handleMsgPeerAudio` today).
|
||||
- External-talker state set on one twin is not mirrored to the other,
|
||||
so the partner twin may accept a local-client PTT that would
|
||||
otherwise have been blocked. The resulting audio flows to refA and
|
||||
may compete with the existing conversation. Outcome depends on
|
||||
refA's sticky choice and the `handleMsgTrunkAudio` talker check.
|
||||
refA's sticky choice and the `handleMsgPeerAudio` talker check.
|
||||
|
||||
These artifacts are bounded to the duration of the twin-link outage
|
||||
and heal automatically on reconnection: once the twin link is back,
|
||||
@@ -435,7 +441,7 @@ Summary of the key design choices and why they were made:
|
||||
| External-talker state sync | **Full `TGHandler` state mirrored** via `MsgTwinExtTalkerStart/Stop` | Unified view on both twins so local PTT is blocked when external peer holds a TG |
|
||||
| Audio transport twin↔twin | **TCP relay**, same framing as trunk | Works anywhere, no new cipher/auth story, bandwidth fine for 1:1 |
|
||||
| Heartbeat cadence on twin link | **2s TX / 5s RX** | Twins LAN-close, fast `/status` convergence |
|
||||
| `MsgTrunkNodeList` | Each twin advertises **only its own local clients** externally; twin link mirrors the roster internally for consistent `/status` on both twins | Connection identity on the external peer provides origin; no additive schema change to `MsgTrunkNodeList` needed |
|
||||
| `MsgPeerNodeList` | Each twin advertises **only its own local clients** externally; twin link mirrors the roster internally for consistent `/status` on both twins | Connection identity on the external peer provides origin; no additive schema change to `MsgPeerNodeList` needed |
|
||||
| Redis config store | **No changes** | Role is runtime state, not config; shared config already syncs via Redis |
|
||||
| Naming | **`[TWIN]`** | Short, clear, orthogonal to `[TRUNK_x]` / `[SATELLITE]` |
|
||||
|
||||
|
||||
@@ -333,7 +333,7 @@ will broadcast it to all of its trunk peers.
|
||||
|
||||
There is **no hardcoded limit** on concurrent QSOs over the trunk. The trunk
|
||||
between each pair of reflectors is a single TCP connection that multiplexes
|
||||
all active TGs simultaneously — each `MsgTrunkAudio` frame is tagged with the
|
||||
all active TGs simultaneously — each `MsgPeerAudio` frame is tagged with the
|
||||
TG number, so any number of TGs can carry audio at the same time.
|
||||
|
||||
The only per-TG rule is that **one talker is allowed per TG at a time**
|
||||
|
||||
Reference in new issue
Block a user