Skip to content

ZMQ Rework + ADB Port forwarding + Tests - #417

Merged
e-khalilov merged 4 commits into
developfrom
e.khalilov/zmq-rework/TAP-3679
Aug 11, 2026
Merged

ZMQ Rework + ADB Port forwarding + Tests#417
e-khalilov merged 4 commits into
developfrom
e.khalilov/zmq-rework/TAP-3679

Conversation

@e-khalilov

Copy link
Copy Markdown
Collaborator

Changes:

1. ZMQ Layer – PUB/PULL ↔ SUB/PUSH to Dealer ↔ Router ↔ Dealer

  - New network topology: instead of a single node for device + provider + processor + reaper (triproxy-dev) and a separate single node for the remaining app-side units (triproxy-app) — one shared node for all app-side units and processor units (without the dev side); provider + device connect only to their respective processor

  - Instead of separate I/O channels (SUB & PUSH sockets), app & dev peers now have a single dealer socket each

  - Processor can now scale horizontally — each instance is responsible for the devices connected to it (message routing and state synchronization with the DB)

  - The reaper unit has been removed — the processor now tracks device heartbeats itself and no longer acts as a dumb intermediary

  - The device unit is no longer the source of truth for its current owner — it now defers to GroupMessage/UngroupMessage messages

  - The WebSocket unit no longer drops a user's devices on reconnect

  - Messages are now delivered ONLY to their intended recipients — previously, each peer individually filtered the entire message stream via a SUB socket

2. ADB Reverse – full support for adb port forwarding

  - Users can now use adb reverse/forward commands natively, just as with a USB-connected device. The behavior was designed based on the adb source code and AOSP.

  - Insecure port forwarding from the provider unit's host ports has been removed

3. Tests

All new code is covered by unit tests; a new GitHub Actions workflow has been added.
To run:

npm run test:unit

A significant part of the project has been refactored, message routing is now more predictable, the number of intermediaries between peers has been reduced, and a number of long-standing issues were quietly resolved along the way. Critical areas are covered by unit tests; both the new code and parts of the existing code have been rewritten in TypeScript.


Changes:

1. ZMQ Layer – PUB/SUB ↔ PUSH/PULL to Dealer ↔ Router ↔ Dealer
  • Новая сетевая топология: вместо единого узла для device + provider + processor + reaper (triproxy-dev) и отдельного единого узла для остальных app-side юнитов (triproxy-app) — один общий узел для всех app-side и processor юнитов (без dev-side); provider + device подключаются только к своему processor

  • Вместо раздельных I/O каналов (SUB & PUSH сокеты) у app & dev пиров теперь по одному dealer-сокету

  • Processor теперь может масштабироваться горизонтально — каждый экземпляр отвечает за подключённые к нему устройства (маршрутизация сообщений и синхронизация состояний с БД)

  • Reaper unit вырезан — processor сам отслеживает heartbeat устройств и больше не выступает в роли тупого посредника

  • Device unit больше не является источником истины о текущем владельце — теперь он подчиняется сообщениям GroupMessage/UngroupMessage

  • WebSocket unit больше не сбрасывает устройства пользователя при переподключении

  • Сообщения теперь доставляются ТОЛЬКО конечным адресатам — ранее каждый пир самостоятельно фильтровал весь поток сообщений через SUB-сокет

2. ADB Reverse – полная поддержка adb проброса портов
  • Пользователям теперь доступны команды adb reverse/forward нативно, как при USB-подключении устройства. Поведение разработано на основе исходников adb и AOSP.

  • Небезопасный проброс портов с хоста provider unit'а удалён

3. Тесты

Весь новый код покрыт unit-тестами; добавлен новый GitHub Actions workflow.
Для запуска:

npm run test:unit

Значительная часть проекта была отрефакторена, маршрутизация сообщений стала более предсказуемой, количество посредников между пирами сократилось, а ряд давних проблем был тихо устранён попутно. Критически важные места покрыты unit-тестами; новый код и часть существующего переписаны на TypeScript.

@e-khalilov
e-khalilov requested a review from a team as a code owner July 31, 2026 19:07
@e-khalilov
e-khalilov merged commit b9f282c into develop Aug 11, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants