Merge jayReflector additions: per-trunk filters, node-list, PTY mute

Ports DJ1JAY / FM-Funknetz' jayReflector features (https://github.com/dj1jay/jayReflector)
into GeuReflector while keeping the in-process MqttPublisher.

Per-trunk config (TrunkLink): BLACKLIST_TGS, ALLOW_TGS, TG_MAP (with
explicit-route bypass of the prefix routing check), PEER_ID. New helpers
TgFilter.h provide exact / "24*" / "10-20" syntax shared across keys.

Wire protocol (additive, backward compatible — older peers ignore unknown
types): MsgTrunkNodeList (type 121) carries callsign + current_tg + optional
lat/lon/QTH; MsgTrunkFilter (type 122) reserved for satellite TG filters.

Reflector emits debounced (500 ms) MsgTrunkNodeList to all trunk peers on
local client login/logout/TG change. Inbound lists are republished via MQTT
under nodes/<peer_id>; the local list under nodes/local. New MQTT_NAME global
key inserts a path component so several reflectors can share a TOPIC_PREFIX.

PTY commands (Reflector): TRUNK MUTE|UNMUTE <section> <callsign>,
TRUNK RELOAD [<section>] re-reads BLACKLIST_TGS/ALLOW_TGS/TG_MAP without
restart, TRUNK STATUS [<section>] dumps a one-line summary per link.
Mute is applied on the inbound audio path.

Tests: 8 new integration tests (19-27) plus a TEST_PEER_FILTER fixture in
topology.py. Tests cover PEER_ID hello, BLACKLIST/ALLOW/TG_MAP semantics,
PTY MUTE/RELOAD/STATUS via docker exec, MQTT_NAME topic namespacing, and
node-list emission. Total now 27 tests.

Docs: docs/JAY-additions.md credits DJ1JAY / FM-Funknetz and lists every
merged feature with file pointers and the filter-evaluation order.
README.md links it. svxreflector.conf.in documents every new key.

Bumps SVXREFLECTOR to 1.3.99.13+trunk.
This commit is contained in:
Audric committed 2026-04-14 23:48:03 +02:00
1 parent 6f5138cd11
commit 5708e2d0e8
17 files changed
+1287 -58

No files matched your search

+85
View File
@@ -0,0 +1,85 @@
# jayReflector Additions
This document describes features merged into GeuReflector from
[**jayReflector**](https://github.com/dj1jay/jayReflector) by
**DJ1JAY / FM-Funknetz**.
## Credits
All design and original implementation of the features below is the work of
DJ1JAY. They were ported into this repository with light adaptation to fit the
GeuReflector code paths (in particular: the in-process `MqttPublisher` is
retained instead of the external `jay-mqtt-daemon.py`).
If you build on these features, please credit DJ1JAY / FM-Funknetz and
consult the upstream jayReflector repository for context and additional
material that was not merged here.
## What was merged
| Area | Key / Message | Purpose |
|------|---------------|---------|
| Filter syntax | `TgFilter` (header-only, `src/svxlink/reflector/TgFilter.h`) | Flexible TG matching: exact (`26200`), prefix (`24*`), range (`2427-2438`), comma-separated |
| Per-trunk config | `BLACKLIST_TGS` | TGs never carried in either direction on this link |
| Per-trunk config | `ALLOW_TGS` | If non-empty, only these TGs are exchanged on this link |
| 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 |
| 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 |
## Backward compatibility
- New message types (121, 122) are silently ignored by reflector instances that
don't know about them. Mixed deployments (jayReflector ↔ this branch ↔
upstream GeuReflector v3) continue to interoperate for the legacy message
set (115–120).
- All new config keys are optional. Reflectors with no `BLACKLIST_TGS`,
`ALLOW_TGS`, `TG_MAP`, `PEER_ID`, or `MQTT_NAME` behave exactly as before.
## Filter semantics
For a given TG on a given trunk link, traffic is allowed only if:
```
not isBlacklisted(tg) // blacklist applies in both directions
and isAllowed(tg) // empty allow filter = allow all
and (
explicit TG_MAP entry // mapped TGs always pass
or isSharedTG(tg) // standard prefix-based ownership routing
or isClusterTG(tg) // cluster TG broadcast
or isPeerInterestedTG(tg) // peer recently advertised interest
)
```
For incoming messages the reflector applies `TG_MAP` first (peer wire TG →
local TG) and then performs all subsequent checks against both the wire and
local TG so the operator can blacklist either form.
## Differences from upstream jayReflector
The following jayReflector items were **not** merged on request:
- **External MQTT daemon (`jay-mqtt-daemon.py`)** — this branch keeps the
existing in-process `MqttPublisher`. As a result, some MQTT topics differ
in suffix (this branch publishes node lists as `nodes/local` and
`nodes/<peer_id>`; jayReflector's external daemon uses a slightly different
layout). The `MQTT_NAME` and `PEER_ID` keys behave identically.
If you want any of the deferred items merged, see the upstream repository
linked above and open an issue or PR on this repository.
## Where to look in the code
| 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/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 |
| `tests/test_trunk.py` | Tests 19–27 cover the merged features |