diff --git a/README.md b/README.md index 9d8f112..1bf2326 100644 --- a/README.md +++ b/README.md @@ -191,8 +191,9 @@ exchange audio for it. Cluster TG numbers must not overlap with any `LOCAL_PREFIX` or `REMOTE_PREFIX`. -**Note:** Satellite links are unaffected by cluster TG configuration — they -forward all TGs unconditionally (see [Satellite reflectors](#satellite-reflectors)). +**Note:** Satellite links are unaffected by cluster TG configuration — by +default they forward all TGs in both directions. A satellite can narrow +that scope with `SATELLITE_FILTER` (see [Satellite reflectors](#satellite-reflectors)). ### 3. Trunk debug logging (optional) @@ -353,17 +354,27 @@ SATELLITE_OF=reflector-01.example.com SATELLITE_PORT=5303 SATELLITE_SECRET=regional_satellite_secret SATELLITE_ID=my-satellite +# Optional — restrict which TGs this satellite cares about (bidirectional). +# Syntax: exact "26200", prefix "24*", range "2427-2438", comma-separated. +#SATELLITE_FILTER=24*,262* ``` A satellite does not set `LOCAL_PREFIX`, `REMOTE_PREFIX`, `CLUSTER_TGS`, or any `[TRUNK_x]` sections. It inherits its parent's identity. Remote reflectors in the mesh see satellite clients as if they were connected directly to the parent. -**No TG filtering:** Unlike trunk links (which filter by prefix and cluster TG), -satellite links forward **all** audio and talker signaling in both directions -without any TG filtering. The satellite is a transparent relay — every TG active -on the parent is heard on the satellite and vice versa, regardless of -`CLUSTER_TGS` or prefix configuration. +**Default: no TG filtering.** Unlike trunk links (which filter by prefix and +cluster TG), a satellite link by default forwards **all** audio and talker +signaling in both directions — every TG active on the parent is heard on the +satellite and vice versa, regardless of `CLUSTER_TGS` or prefix configuration. + +**Opt-in TG scope via `SATELLITE_FILTER`.** Setting `SATELLITE_FILTER` on the +satellite side restricts the link to a chosen set of TGs in both directions: +the satellite suppresses its own outbound events for non-matching TGs, and +advertises the filter to the parent (via `MsgTrunkFilter`, type 122) so the +parent also stops forwarding non-matching TGs back. Empty or absent means no +filtering. The filter uses the shared TG-filter syntax (exact, `24*` prefix, +`2427-2438` range, comma-separated). Port `5303` is the default satellite port (separate from client port `5300` and trunk port `5302`). diff --git a/docs/DESIGN_SATELLITE_AND_CLUSTER.md b/docs/DESIGN_SATELLITE_AND_CLUSTER.md index 80f37b9..d25965d 100644 --- a/docs/DESIGN_SATELLITE_AND_CLUSTER.md +++ b/docs/DESIGN_SATELLITE_AND_CLUSTER.md @@ -80,7 +80,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`) | **No filtering** — all TGs forwarded unconditionally | +| TG routing | Prefix-based (`isSharedTG`/`isOwnedTG`) + cluster (`isClusterTG`) | Unfiltered by default; optional `SATELLITE_FILTER` (bidirectional, advertised via `MsgTrunkFilter`) | | 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 | diff --git a/docs/TRUNK_PROTOCOL.md b/docs/TRUNK_PROTOCOL.md index 1b6afe5..e44446c 100644 --- a/docs/TRUNK_PROTOCOL.md +++ b/docs/TRUNK_PROTOCOL.md @@ -340,9 +340,11 @@ or TG change, debounced to 500 ms, and broadcast to every trunk peer. Peers republish it via MQTT under `nodes/` so a central dashboard can see who is connected to each reflector. -`MsgTrunkFilter` is intended for satellite links to advertise TG interest to -the parent. The parent uses it to avoid forwarding TGs the satellite does not -want. Reserved for satellite use; trunk peers do not currently emit it. +`MsgTrunkFilter` is used by satellite links to advertise TG interest to the +parent. A satellite with `SATELLITE_FILTER` set sends one `MsgTrunkFilter` +right after authenticating; the parent stores the filter and skips forwarding +non-matching TGs to that satellite. Absent or empty filter means pass-all +(pre-existing behavior). Trunk peers do not emit it. Audio is transported over TCP (not UDP) — the trunk is a reliable server-to-server link, not a lossy radio gateway path, so TCP framing is appropriate and avoids diff --git a/tests/TESTS.md b/tests/TESTS.md index a7d13f5..420d3fb 100644 --- a/tests/TESTS.md +++ b/tests/TESTS.md @@ -5,7 +5,7 @@ The integration tests verify the trunk protocol, satellite links, twin (HA-pair) protocol, Redis-backed config store, and end-to-end audio routing by spinning up reflector meshes in Docker Compose and connecting fake peers and clients from a Python test harness. `run_tests.sh` runs in **two phases**: -1. A 3-reflector trunk mesh + a satellite-mode reflector exercising `test_trunk.py` (32 tests). +1. A 3-reflector trunk mesh + a satellite-mode reflector exercising `test_trunk.py` (33 tests). 2. A 4-reflector twin topology exercising `test_twin.py` (11 tests). A separate harness (`run_redis_tests.sh`) runs `test_redis.py` (13 tests) against a single-reflector + Redis stack. See [Redis Integration Tests](#redis-integration-tests) below. @@ -22,7 +22,7 @@ bash run_tests.sh This will: 1. Generate the default configs and `docker-compose.test.yml` from `topology.py` 2. Build and start the 3-reflector mesh -3. Run 32 automated trunk/satellite/MQTT tests (`test_trunk.py`) +3. Run 33 automated trunk/satellite/MQTT tests (`test_trunk.py`) 4. Enter an interactive prompt to manually test any TG number 5. Tear down the default mesh 6. Regenerate with `--topology twin` (4-reflector twin topology) @@ -172,6 +172,7 @@ Simulates a V2 SvxLink client. Performs the full TCP authentication handshake (P | 14 | Satellite receives from parent | Trunk talker audio on the parent is forwarded to the satellite | | 15 | Satellite audio to trunk peer | Satellite sends audio for a TG owned by another reflector; parent forwards via trunk | | 16 | Satellite disconnect cleanup | Abrupt satellite disconnect clears it from `/status` | +| 16b | Satellite TG filter honored by parent | Satellite sends `MsgTrunkFilter` (type 122) after hello; parent forwards the matching cluster TG but drops the non-matching one | ### Bidirectional Routing