Commit Graph

21 Commits

Author SHA1 Message Date
nineap 99a9eee908 Улучшить TLS-маскировку, ввести версионирование протокола, добавить тесты и нагрузочный инструмент
Маскировка:
- ChangeCipherSpec middlebox-compat запись после ClientHello/ServerHello —
  без неё последовательность типов TLS-записей отличала нас от настоящего
  браузера даже при идеальном JA3/JA4-отпечатке.
- SNI-aware stealth fallback: невалидный клиент проксируется на запрошенный
  им хост, а не всегда на один и тот же decoy — иначе активное зондирование
  с разными SNI на одном IP получало одинаковый ответ. Резолв только в
  публичные IP (защита от SSRF на внутреннюю сеть ноды через подставной SNI).
- Профиль браузера привязан к session_id, а не к номеру попытки реконнекта:
  раньше при нескольких быстрых ретраях с одного IP летели ClientHello
  Chrome→Edge→Firefox подряд — сама по себе аномалия для DPI.
- Бакетный паддинг Data/UdpData кадров вместо полного отсутствия паддинга;
  джиттер перед ServerHello вместо мгновенного детерминированного ответа.

Версионирование:
- PROTOCOL_VERSION в session_id ClientHello — сервер узнаёт версию клиента
  до отправки чего-либо и может включать версионно-зависимое поведение
  (сейчас — CCS) только для тех, кто его понимает. Позволяет катить будущие
  несовместимые изменения протокола без синхронного flag-day релиза.

Тесты (core, было 0):
- Round-trip тесты TLS-записей/hello-сообщений/кадров/кодека.
- Полный цикл хендшейка с реальным выводом ключей на обеих сторонах.
- Вся SSRF-защита (hostname/IP валидация, v4/v6).
- Интеграционные тесты по настоящему TCP: легитимный хендшейк и
  stealth-fallback на мусорный ClientHello.

tools/loadtest — нагрузочный тест поверх настоящего скомпилированного
netrunner-server (реальный процесс, метрики RSS/CPU из /proc) и настоящего
публичного клиентского API. Попутно найден и обойдён гоночный баг:
Connect-кадр в ClientHandler::connect() уходит через try_send ещё до того,
как поднимется хоть одна нога тунеля, и молча теряется при синтетической
нагрузке.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-06 18:05:10 +07:00
nineap 820d23abd9 update of extensions and connections 2026-07-02 16:50:23 +07:00
Kirill 3b2296a6d9 fix: stabilize tunnel downloads (deadlock, stuck-consumer eviction, real diagnostics)
Downloads were dying and stalling under real network conditions. Root causes
fixed in the muxer's stream-delivery path:

- dispatch_to_local held a DashMap Ref across a nested remove_stream call,
  self-deadlocking the leg's reader task whenever a stream's backlog needed
  eviction — permanently losing a tokio worker thread per occurrence.
- Eviction now runs off the hot path entirely, in a periodic background
  reaper, and only fires when a stream is both over its byte budget AND has
  made no delivery progress for an RTT-adaptive grace window (was a flat
  300ms then 5s, which killed merely-slow-but-alive consumers).
- The server never told the client when a bridge ended normally (only on
  failed connect), leaving the client's virtual TCP socket stuck in
  CloseWait for a full idle timeout and slowing the whole engine loop.
- The client's upload path silently dropped in-flight chunks when all tunnel
  legs were briefly down instead of pausing and retrying like the server
  bridge already did.
- Tried end-to-end credit-based flow control for the download producer;
  reverted the enforcement (kept the dormant frame/API) after it proved
  worse than the pre-existing local channel backpressure — RTT-coupled
  pauses produced burst-then-stall downloads and jitter/ping spikes on the
  shared physical leg.
- Server-side diagnostics snapshot was a stub (always-empty tunnel state,
  misleading placeholder trigger); now aggregates real per-session Muxer
  metrics from the SessionManager.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-02 15:06:00 +07:00
nineap 582ad714ae client log sends to proxy 2026-06-30 19:49:50 +07:00
nineap f7a76353ea docs [AI] 2026-06-30 18:51:09 +07:00
nineap 38dfd588c1 warnings fix 2026-06-29 18:07:53 +07:00
nineap 47208853c9 diagnostics, recconections fix and bufferbloat fixes 2026-06-25 17:14:26 +07:00
nineap 30a843d8a6 fixes warnings and bufferbloat problems 2026-06-25 13:36:40 +07:00
nineap 05696a836a allocation optimization and in place crypt 2026-06-05 00:22:38 +07:00
nineap 6cd4d001ad refactor: update tunnel MTU, optimize Frame parsing, and improve connection stability 2026-06-02 16:26:02 +07:00
nineap 11b810ad65 all unbounded and remove AI hallucinations 2026-04-12 15:14:42 +07:00
Трапезников Кирилл Иванович 11d2b4e1d9 split codec and dynamic tcp sockers 2026-04-10 11:27:38 +10:00
nineap 2db4ba1e9d stable connection 2026-04-03 18:53:13 +07:00
nineap 780750171b buffers update, warning fixes, ghosts killed 2026-04-03 18:18:10 +07:00
nineap e53a95692e clean comments 2026-04-03 12:06:58 +07:00
nineap f4c6f2efdd sessions and muxer legs 2026-03-27 15:57:04 +07:00
nineap b0dc3fc0a4 buf sizes changes and socks5 remove to rawcast 2026-03-26 15:50:41 +07:00
nineap c51c086fbc modules encapsulate from each other 2026-03-26 13:19:59 +07:00
nineap 6a0eafd2f5 remove codec folder in nxrp 2026-03-26 11:52:04 +07:00
nineap 037edaa7cd project strucute refactoring 2026-03-25 20:08:13 +07:00
nineap a213c01158 global buf size mtu based config and protocol rename 2026-03-25 16:03:11 +07:00