feat(alias): add LOCAL_ALIASES to re-home short local TGs under an owned prefix

Re-home a short local talk group (e.g. 8) under the reflector's own owned
prefix as a globally-unique number (e.g. 2620008) via a single [GLOBAL]
LOCAL_ALIASES entry, so it routes across the trunk mesh like any owned TG
while local users keep dialing the short number.

- Config: LOCAL_ALIASES=localTG:aliasTG[/dir] (dir in|out, omitted = two-way);
  aliasTG must be owned by a LOCAL_PREFIX. Rejects unowned alias, an owned
  short side, duplicate short keys, and numeric overflow.
- Boundary rewrite: prefix routing / owner-relay / peer-interest run on the
  long owned number; local delivery and talker arbitration run on the short
  number, bridged in the four inbound trunk handlers.
- Rewrite-on-select folds a client that dials the long number onto the short
  number (select + monitor), so the two are one conversation locally and on
  the mesh.
- Twin: external-talker notify uses the short number to match the audio
  mirror; disconnect cleanup folds to short so an aliased TG cannot wedge.
- /status exposes local_aliases; satellite nodes warn that the setting is
  ignored (a local alias belongs on the mesh parent that owns the prefix).
- Docs (PEER_PROTOCOL, CONCEPTS, conf template) and integration tests
  (tests/test_alias.py): two-way / in / out, rewrite-on-select, status,
  validation, disconnect-wedge, and duplicate-key coverage.
This commit is contained in:
Audric committed 2026-07-03 18:17:16 +02:00
1 parent 7e625dd514
commit 5da075f150
12 files changed
+1187 -64

No files matched your search

+29 -10
View File
@@ -934,7 +934,18 @@ void ReflectorClient::handleSelectTG(std::istream& is)
sendError("Illegal MsgSelectTG protocol message received");
return;
}
if (msg.tg() != m_current_tg)
uint32_t sel_tg = msg.tg();
if (m_reflector != nullptr)
{
uint32_t folded = m_reflector->aliasSelect(sel_tg);
if (folded != sel_tg)
{
geulog::info("client", m_callsign, ": alias-fold select TG #", sel_tg,
" -> #", folded);
sel_tg = folded;
}
}
if (sel_tg != m_current_tg)
{
auto talker = TGHandler::instance()->talkerForTG(m_current_tg);
if (talker == this)
@@ -949,7 +960,7 @@ void ReflectorClient::handleSelectTG(std::istream& is)
sendUdpMsg(MsgUdpFlushSamples());
}
setTg(msg.tg());
setTg(sel_tg);
}
} /* ReflectorClient::handleSelectTG */
@@ -964,18 +975,26 @@ void ReflectorClient::handleTgMonitor(std::istream& is)
sendError("Illegal MsgTgMonitor protocol message received");
return;
}
auto tgs = msg.tgs();
auto it = tgs.cbegin();
while (it != tgs.end())
std::set<uint32_t> tgs;
for (const auto& tg : msg.tgs())
{
const auto& tg = *it;
if (!TGHandler::instance()->allowTgMonitoring(this, tg) || (tg == 0))
uint32_t mon_tg = tg;
if (m_reflector != nullptr)
{
geulog::info("client", m_callsign, ": Not allowed to monitor TG #", tg);
tgs.erase(it++);
mon_tg = m_reflector->aliasSelect(mon_tg);
if (mon_tg != tg)
{
geulog::info("client", m_callsign, ": alias-fold monitor TG #", tg,
" -> #", mon_tg);
}
}
if (!TGHandler::instance()->allowTgMonitoring(this, mon_tg) || (mon_tg == 0))
{
geulog::info("client", m_callsign, ": Not allowed to monitor TG #",
mon_tg);
continue;
}
++it;
tgs.insert(mon_tg);
}
{
std::ostringstream tglist;