Add trunk TCP server for bidirectional peer connections
Previously TrunkLink only connected outbound — there was no server listening on port 5302, so both reflectors got "Connection refused." Changes: - Reflector: add trunk TcpServer (default port 5302, configurable via TRUNK_LISTEN_PORT) that accepts inbound peer connections, authenticates via HMAC, and matches by secret + prefix - TrunkLink: support both outbound and inbound directions with automatic conflict resolution (lower priority keeps outbound) - Security: pre-auth frame size cap (4KB), max 5 pending connections, 10s hello timeout, log-injection sanitization - Docs: updated TRUNK_PROTOCOL.md, README.md, CLAUDE.md
This commit is contained in:
1 parent
53a9a6fc75
commit
b8d0dd19af
7 files changed
+563
-38
No files matched your search
@@ -299,6 +299,13 @@ class Reflector : public sigc::trackable
|
||||
|
||||
std::vector<TrunkLink*> m_trunk_links;
|
||||
std::set<uint32_t> m_cluster_tgs;
|
||||
static const size_t TRUNK_MAX_PENDING_CONS = 5;
|
||||
|
||||
FramedTcpServer* m_trunk_srv = nullptr;
|
||||
// Inbound trunk connections waiting for MsgTrunkHello identification
|
||||
std::map<Async::FramedTcpConnection*, Async::Timer*> m_trunk_pending_cons;
|
||||
// Handed-off inbound trunk connections mapped to their TrunkLink
|
||||
std::map<Async::FramedTcpConnection*, TrunkLink*> m_trunk_inbound_map;
|
||||
|
||||
// Satellite support
|
||||
bool m_is_satellite = false;
|
||||
@@ -332,6 +339,13 @@ class Reflector : public sigc::trackable
|
||||
void onTrunkTalkerUpdated(uint32_t tg, std::string old_cs,
|
||||
std::string new_cs);
|
||||
void initTrunkLinks(void);
|
||||
void initTrunkServer(void);
|
||||
void trunkClientConnected(Async::FramedTcpConnection* con);
|
||||
void trunkClientDisconnected(Async::FramedTcpConnection* con,
|
||||
Async::FramedTcpConnection::DisconnectReason reason);
|
||||
void trunkPendingFrameReceived(Async::FramedTcpConnection* con,
|
||||
std::vector<uint8_t>& data);
|
||||
void trunkPendingTimeout(Async::Timer* t);
|
||||
void initSatelliteServer(void);
|
||||
void satelliteConnected(Async::FramedTcpConnection* con);
|
||||
void satelliteDisconnected(Async::FramedTcpConnection* con,
|
||||
|
||||
Reference in new issue
Block a user