Commit Graph

37 Commits

Author SHA1 Message Date
nineap c4be0174bf Circuit breaker + таймаут для BackendClient
5 подряд неудач (5xx/сетевой сбой, не 4xx-отказ авторизации) открывают
цепь на 10 секунд — fail-fast без похода в HTTP, пока control plane
недоступен. Таймаут запроса — 5 секунд (раньше не было вообще).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-09 16:37:25 +07:00
nineap 10d357b8ec Graceful shutdown (SIGTERM) + HTTP /health endpoint
Раньше shutdown_signal вообще не существовал — весь механизм graceful
shutdown в network.rs был мёртвым кодом, ничего его не вызывало. main.rs
теперь spawn'ит net.run() и последовательно ждёт сигнал, затем drain
(НЕ tokio::select! — select! убил бы run()-future на середине drain'а в
момент, когда shutdown-future резолвится). /health на 127.0.0.1 отдаёт
активные соединения — для systemd/LB health-check.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-09 16:37:25 +07:00
nineap 72246f986a Переключить дев-инстанс прокси на порт 8443
Локальный debug-server и задеплоенный на DEV_IP systemd-сервис раньше
использовали 4443/443 соответственно — развели их на общий 8443, чтобы не
пересекаться с портами, занятыми другими дев-сервисами (например, Caddy на 443).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-07 18:17:20 +07:00
nineap 40ddb0a0f6 Добавить опциональную авторизацию клиента и динамические лимиты трафика
Сервер получает флаги --require-auth/--backend-url (по умолчанию выключено,
поведение уже развёрнутых нод не меняется). Auth-кадр хендшейка расширен с
"session_id:leg_id" до "session_id:leg_id:token"; при включённом
--require-auth сервер валидирует токен через новый AuthValidator
(BackendClient к netrunner-backend, с кешем на 60с).

Muxer теперь ведёт монотонный учёт трафика сессии (переживает реконнект
ног — раньше total_bytes мог занижаться после переподключения) и раз в ~30с
отчитывается бэкенду; при превышении лимита сессия разрывается. Токен
клиента прокидывается через EngineConfig/TunnelConfig до Tauri-плагина
(desktop.rs + Android Kotlin-плагин).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-07 00:31:03 +07:00
nineap 820d23abd9 update of extensions and connections 2026-07-02 16:50:23 +07:00
nineap 8c9a9c7cc7 dev countour and off logs 2026-07-02 15:15:10 +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 47208853c9 diagnostics, recconections fix and bufferbloat fixes 2026-06-25 17:14:26 +07:00
nineap 6cd4d001ad refactor: update tunnel MTU, optimize Frame parsing, and improve connection stability 2026-06-02 16:26:02 +07:00
nineap ae557b4848 muxer cleaning update, head on line blocking fix 2026-05-03 13:41:46 +07:00
nineap 738fa8ca9b loggin update 2026-05-02 18:55:37 +07:00
nineap f0b6bf423e legs logs on server 2026-04-16 13:21:37 +07:00
nineap 2d70f33257 bufferbloat fixes, deadlocks and buf sizes change 2026-04-16 13:14:16 +07:00
Трапезников Кирилл Иванович 11d2b4e1d9 split codec and dynamic tcp sockers 2026-04-10 11:27:38 +10:00
nineap 1ab28cefcf update connection quality speed 2026-04-03 19:34:03 +07: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 b90083539c fixes and upgrades. async remove, buf changes 2026-04-03 11:43:03 +07:00
nineap 71acb52386 logger creates file 2026-03-30 14:34:21 +07:00
nineap f4c6f2efdd sessions and muxer legs 2026-03-27 15:57:04 +07:00
nineap b9364e3e19 trying to fix udp telegram 2026-03-26 19:55:56 +07:00
nineap 3eb2df3a34 trying to fix udp telegram 2026-03-26 19:55:07 +07:00
nineap cb837c08f2 encapsulation of net logic in core 2026-03-26 12:13:43 +07:00
nineap a213c01158 global buf size mtu based config and protocol rename 2026-03-25 16:03:11 +07:00
nineap 7dbfaec60d 15 march works with app 2026-03-15 23:47:15 +07:00
nineap 0cc44d0037 clean project from comments 2026-03-13 21:39:29 +07:00
nineap 8d0eccdbc2 presave 2026-03-10 17:48:22 +07:00
nineap 6f4dd88a8e renames and tauri app 2026-03-09 17:51:01 +07:00
nineap 676683d29c makefile and service 2026-03-08 14:39:12 +07:00
nineap 8bad1b0162 close to final of fake ip resolving 2026-03-08 00:11:52 +07:00
nineap 322dc5b6b0 update processes and code style 2026-03-01 17:49:58 +07:00
nineap 3590d1a435 base proxy ready 2026-03-01 14:24:53 +07:00
nineap 2835108b7f big changes 2026-02-25 18:09:20 +07:00
nineap bf7d50bcef initial commit 2026-02-22 21:00:50 +07:00