ZMQ Rework + ADB Port forwarding + Tests - #417
Merged
Merged
Conversation
added 3 commits
August 11, 2026 15:09
Alk2017
approved these changes
Aug 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes:
1. ZMQ Layer –
PUB/PULL ↔ SUB/PUSHtoDealer ↔ 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:
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/PULLtoDealer ↔ 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.
Для запуска:
Значительная часть проекта была отрефакторена, маршрутизация сообщений стала более предсказуемой, количество посредников между пирами сократилось, а ряд давних проблем был тихо устранён попутно. Критически важные места покрыты unit-тестами; новый код и часть существующего переписаны на TypeScript.