Commit Graph

56 Commits

Author SHA1 Message Date
ospab 1bc63c4094 feat: add X-Ostp-Server validation to UoT handshake 2026-05-21 13:15:49 +03:00
ospab 92fc73756f fix: use POST and Content-Length in UoT to prevent nginx chunked encoding 2026-05-21 13:06:06 +03:00
ospab a81625d721 fix: correctly handle payload buffering during http handshake in uot 2026-05-21 12:43:47 +03:00
ospab 5fa110d962 fix: make uot check case-insensitive 2026-05-21 03:00:07 +03:00
ospab b87e87a7bd fix: correctly parse transport config section from json in CLI and GUI 2026-05-21 02:33:14 +03:00
ospab d9c3ba875c fix: disable aws-lc-rs backend in rustls for 32-bit musl compatibility 2026-05-21 02:28:28 +03:00
ospab ceb760e4ce feat: implement server-side UoT and MTU tuning 2026-05-21 02:23:49 +03:00
ospab 83f7ff2119 feat: UoT and xHTTP stealth 2026-05-21 02:11:02 +03:00
ospab 9329bcef45 feat: WSS transport mode selector in Flutter UI + TransportConfig in Rust 2026-05-21 00:39:12 +03:00
ospab 0cc5cf47ef feat: NetworkChanged command for instant mobile reconnect, lower stall threshold 25s->8s 2026-05-21 00:29:49 +03:00
ospab a0e38c462e fix: clamp padding size to prevent UDP fragmentation on LTE/cellular and dynamically report connection status 2026-05-18 22:03:33 +03:00
ospab 8a2af5d73d feat: implement robust multiplexing, high-latency timeouts, and dynamic background reconnects for mobile network stability 2026-05-18 21:04:51 +03:00
ospab 3a4b5a8c63 chore: fix cargo clippy warnings
- Boxed HandshakeState in NoiseSession to reduce enum variant sizes
- Used is_ok() instead of let Ok(_) pattern
- Applied automatic clippy fixes for minor warnings
2026-05-17 22:22:39 +03:00
ospab 05583e189e feat: v0.2.0 — BBR congestion control, 0-RTT session resumption, management REST API, fallback server, multi-listener
Architecture:
- BBR-inspired congestion controller (SlowStart/ProbeBandwidth/ProbeRTT phases)
- 0-RTT session resumption with anti-replay ticket validation
- Management REST API (axum): /api/users CRUD, /api/server/status, Bearer auth
- TCP fallback proxy for anti-DPI camouflage (nginx/caddy passthrough)
- Multi-listener: bind to multiple UDP addresses simultaneously
- Per-user traffic stats with atomic counters and limit enforcement

Code quality:
- Structured logging: 0 eprintln in server/core/client, all tracing::{info,debug,warn,error}
- 35 unit tests across congestion, resumption, relay, outbound, obfuscation
- Removed dead code: kex.rs, unused dependencies (async-trait, x25519-dalek, rand_distr)
- Modular server: api.rs, fallback.rs, outbound.rs, relay.rs extracted from monolithic lib.rs

CLI:
- --check: config validation
- --generate-key: secure key generation (hex/base64, batch)
- --links: share link generation from server config
- --init: fallback section in server template

Documentation:
- README rewritten with architecture diagram, API examples, CLI reference
- Wiki: Management-API (EN+RU), Configuration (EN+RU), Home (EN+RU) updated
2026-05-17 21:05:44 +03:00
ospab 69e4426152 feat: release preparation — TUN fix, i18n, GUI CI/CD, speed improvements
TUN Interface:
- Fixed adapter name to always be 'ostp_tun' by cleaning up stale
  adapters before launch (prevents 'ostp_tun 2', 'ostp_tun 3', etc.)
- Parallelized route setup with tun2socks launch to save ~3 seconds
- Replaced fixed 2-second sleep with adapter readiness polling
- Added -NoProfile to all PowerShell calls for faster execution

Speed:
- Reduced handshake timeout from 10s to 5s
- Reduced tun2socks spawn buffer from 300ms to 0 (removed)

GUI:
- Added i18n support: English and Russian translations
- Language toggle button in header (EN/RU)
- Merged 'IP Ranges' field into 'Bypass IPs / CIDR Ranges'
- Removed separate IP ranges field
- All static text uses data-i18n attributes
- Status messages, labels, toasts all translated
- Replaced alert() calls with toast notifications

CI/CD:
- Added separate GUI build job for Windows x64 and arm64
- Produces ostp-windows-gui-{arch}.zip with: ostp-gui.exe + wintun.dll + tun2socks.exe
- Uses Tauri CLI v2 for build
2026-05-17 16:25:30 +03:00
ospab a4d8da2460 security: Kerckhoffs's principle — all secrets derived from access key via HKDF
Applied Kerckhoffs's principle: the protocol's security and obfuscation
now depend SOLELY on the access key. An adversary who reverse-engineers
the binary cannot build a DPI filter without knowing the key.

Changes:
- Replaced hardcoded salt string ('-ostp-psk-salt') with HKDF-SHA256.
  The salt is now derived from the key hash itself — no protocol-specific
  strings remain in the binary.
- Unified all secret derivation into derive_all_secrets() which produces
  PSK, obfuscation key, and handshake padding range from a single HKDF
  invocation.
- Handshake padding range is now key-derived: different access keys
  produce different size distributions (min: 16-79, max: +48..+175).
  A universal size-based filter is impossible without the key.
- HKDF-SHA256 (RFC 5869) implemented inline using existing hmac+sha2
  dependencies — no new crate required.

What remains identifiable in the binary:
- 'Noise_NNpsk0_25519_ChaChaPoly_BLAKE2s' — standard Noise pattern
  string, shared with many other projects, NOT OSTP-specific.
- Generic HMAC/SHA-256/ChaCha20-Poly1305 code — standard crypto
  primitives used by millions of applications.
2026-05-17 15:32:07 +03:00
ospab 77ec0e3a44 fix: DPI resistance, GUI proxy/tunnel, and code quality
DPI/TSPU resistance:
- Handshake packets now padded with 32-128 random bytes (prevents size
  fingerprinting — previously every handshake was exactly 52 bytes)
- Frame header reserved bytes randomized instead of always 0 (prevents
  known-plaintext oracle inside encrypted payload)
- Padding jitter cap increased from 96 to 256 bytes for better traffic
  pattern masking

GUI Windows app (tunnel/proxy not starting):
- CRITICAL: Added CREATE_NO_WINDOW flag to all reg.exe calls in sysproxy.rs.
  In Tauri GUI context (no console window), Command::new('reg') was silently
  failing because there was no attached console. This prevented the Windows
  system proxy from being enabled.
- Added ProxyOverride bypass list (localhost;127.*;10.*;192.168.*;<local>)
  to prevent proxy loop for local traffic
- Added comprehensive logging for all registry operations
- Set initial connection_state to 1 (connecting) instead of 0 — prevents
  UI polling from immediately flipping back to 'disconnected' before the
  handshake has a chance to begin

Code quality:
- Fixed log file paths: log_to_core_file() and log_to_file() now write next
  to the executable instead of CWD. In GUI context, CWD could be
  C:\Windows\System32, causing write failures or misplaced log files.
2026-05-17 14:40:13 +03:00
ospab 032f694821 feat: comprehensive diagnostic logging across all modules
protocol.rs:
- Gap recovery logs: skipped frames count, delivered count, remaining buffer
- Duplicate frame detection with nonce values
- Max reorder window exceeded with gap width
- NACK handling: retransmit success vs frame evicted from history
- Reorder buffer overflow with capacity stats
- Close frame receipt
- Zombie frame eviction count
- sent_history overflow (the root cause of speedtest death)

dispatcher.rs:
- New session authentication with peer IP, session count, replay cache size
- Client roaming detection (old addr -> new addr)
- Handshake rejection reasons: timestamp drift, replay cache full, max sessions
- Protocol errors and tick errors with session context

bridge.rs:
- UDP socket buffer diagnostics (requested vs actual)
- Handshake response size and RTT
- Inbound protocol errors with session index
- Outbound packing errors with stream_id

signal.rs:
- Specific shutdown signal identification (SIGTERM/SIGINT/Ctrl+C/Close/Break)

server lib.rs:
- Startup banner with access key count and ARQ config
- UDP buffer diagnostics
- Relay CONNECT/CLOSE/error always visible (not gated by debug)
- All println! -> eprintln! for proper stderr logging
- Hot-reload prefix fixed [ostp-server] -> [ostp]
2026-05-17 14:31:21 +03:00
ospab dc6635e248 fix: tunnel death after speedtest — gap recovery and ARQ tuning 2026-05-17 14:22:50 +03:00
ospab 31f3fff187 fix: GUI, JNI SDK, and TUN handler audit fixes
ostp-gui:
- GUI-01: Config parsing now strips JSONC comments via json_comments
  crate, matching CLI behavior. Previously failed on any commented config.
- GUI-02: stop_tunnel now properly aborts the JoinHandle with a 2s
  timeout instead of silently dropping it.

ostp-jni (Android SDK):
- JNI-01: Replaced all .unwrap() calls in JNI functions with safe
  null_mut fallback. JNI functions must never panic.
- JNI-02: Added missing exclusions, multiplex, debug fields to
  Kotlin SDK Config.toNativeJson(). Without these, serde deserialization
  on the native side could fail or use wrong defaults.
- JNI-03: Replaced shutdown_background() with shutdown_timeout(3s)
  to allow proper task cleanup and port unbinding.
- JNI-04: Updated Kotlin log string matchers to match professionalized
  messages (Connection established, TUN tunnel established, etc.)

TUN handlers:
- TUN-01: Windows TUN cleanup guard now resets DNS via netsh. Previously
  the custom DNS server remained configured after disconnect, causing
  complete DNS resolution failure.
- Unified all remaining [ostp-client] log prefixes to [ostp] across
  wintun_handler.rs, linux_handler.rs, and proxy.rs.
2026-05-17 03:31:48 +03:00
ospab 8eb3fc72cb polish: professionalize all user-facing log output and UX
- Unified log prefix to [ostp] across all modules (was [OSTP Core],
  [ostp-server], [ostp-client], [client], [bridge])
- Removed informal/casual phrasing from all user-visible messages
- Startup messages are clean and concise (mode, server, status)
- Error messages are actionable without being alarming
- Essential server logs (client connect/disconnect) always visible
- Essential client logs (connection status, errors) always visible
- TUN tunnel messages consistent across Windows and Linux
- Removed noisy eprintln from UDP reader hot path
- Status format: [ostp] Status: Connected (rtt=12.3ms)
2026-05-17 03:26:15 +03:00
ospab 7424ccc0ff fix: resolve critical ARQ bugs causing Speedtest tunnel drops + docs overhaul
Critical fixes (6):
- protocol.rs: in_flight_count() now counts only retransmittable Data frames,
  not Ack/Nack control frames — eliminates false backpressure under load
- protocol.rs: NACK is now rate-limited to once per 30ms — prevents
  retransmission storm during normal UDP jitter
- protocol.rs: zombie frames exceeding max_retries+4 are evicted each tick —
  prevents unbounded memory growth and stale retransmits
- protocol.rs: Closing state now processes final in-flight packets instead
  of silently dropping them — prevents data loss at session teardown
- server/lib.rs: stream_tx changed from bounded(10000) to unbounded_channel —
  prevents TCP-reader collapse during Speedtest with 50+ streams
- bridge.rs: liveness timeout raised from 30s to 60s — prevents false
  reconnect during heavy Speedtest load

Medium fixes (8):
- protocol.rs: ACK range truncation preserves cumulative range (index 0)
- bridge.rs: Ping now uses send_datagram() for correct TURN wrapping
- dispatcher.rs: replay_cache hard-capped at 100k entries (DoS protection)
- dispatcher.rs: old addr cleaned from addr_to_session on roaming
- server/lib.rs: TCP connect_target() now has 10s timeout
- config.rs: TURN section parsed during hot-reload
- proxy.rs: HTTP header parsing uses 512-byte chunks instead of 1-byte reads
- proxy.rs: stream_id wrap-around skips active IDs to prevent collision
- runner.rs: is_essential_log matches actual log strings from bridge.rs

Other:
- kex.rs: clearly marked as dead PQ stub (not used by protocol)
- README.md + README.ru.md: complete rewrite with architecture diagram
- docs/en/specification.md: updated ARQ section with all new semantics
2026-05-17 03:20:50 +03:00
ospab f0a93b4161 perf: heavily tune UDP socket buffers via socket2 to support 10Gbps+ micro-burst resilience 2026-05-17 02:19:59 +03:00
ospab 4cc1f0079c fix: resolve packet drop & connection timeouts under high speed tests by reducing proxy event queue size and expanding sent history / reorder buffers 2026-05-17 01:35:24 +03:00
ospab bfa858ff93 fix: prevent premature Windows client shutdown due to empty/closed console event streams 2026-05-17 01:30:00 +03:00
ospab ec35769b9f fix: implement non-blocking unbounded channels and clean stream reset on reconnect 2026-05-16 23:41:04 +03:00
ospab e28a698e9b fix: resolve connection instability under load and refine logging 2026-05-16 20:55:11 +03:00
ospab 5c7a55f9e0 fix: restore server-only guard for link printing in init block 2026-05-16 19:30:15 +03:00
ospab 9982b8b94b fix: correct crate name to json_comments 2026-05-16 19:25:27 +03:00
ospab f419bfa4ee feat: switch to JSON with comments (JSONC) for config; docs: update READMEs 2026-05-16 19:23:17 +03:00
ospab 514bae94cd fix: resolve build errors and remove GUI from main release; docs: improve READMEs 2026-05-16 19:15:04 +03:00
ospab 4970b661db chore: implement keep-alive, config comments, validation and CI/CD improvements 2026-05-16 18:20:53 +03:00
ospab 57596143fa fix(gui): resolve ERR_CONNECTION_REFUSED by disabling automatic relaunch in Tauri context and surfacing Admin requirement as UI alert 2026-05-15 22:50:30 +03:00
ospab e21e612e5c feat(gui): implement real-time atomic status polling and multi-state UI feedback (Stopped/Handshaking/Established) and update JNI/core layers 2026-05-15 22:37:50 +03:00
ospab c26e63250c fix(win-tun): eliminate console window flashes and early SOCKS5 bind race conditions in tun2socks launcher 2026-05-15 22:37:33 +03:00
ospab b63979b014 feat: add custom DNS server & Exclusions config fields, simplify share link schema, introduce --links server helper 2026-05-15 22:17:55 +03:00
ospab 07b31cc3f3 fix: resolve infinite fatal tick log spam with auto-reconnect and centralize UAC elevation in run_client_core to protect GUI apps 2026-05-15 22:04:11 +03:00
ospab 609564fdd9 feat(gui): add fully native tauri windows gui with premium mobile layout, real-time statistics polling, in-app config editor, and graceful exit cleanup 2026-05-15 22:01:20 +03:00
ospab d34a1dd29a fix: resolve asymmetric packet loss (zero upload) by enforcing strict MTU caps and reducing TUN interface MTU to 1300 to prevent UDP fragmentation on outbound traffic 2026-05-15 19:54:07 +03:00
ospab a3c8b3a750 fix: address final analysis issues including Nonce exhaustion, TUN pre-flight checks, dead code, and proper TURN channel framing. Also fix CI packaging of tun2socks 2026-05-15 19:23:50 +03:00
ospab 0f81140f06 feat: resolve flow control, tun crash route cleanup, log pollution, padding caps 2026-05-15 18:34:32 +03:00
ospab 6e35609f42 perf: accelerate protocol via low-latency ACK windows and suppress high-velocity console spam logs 2026-05-15 17:44:06 +03:00
ospab 6ae43a8f41 refactor: pre-package Wintun and tun2socks into archives via CI/CD and purge runtime downloader 2026-05-15 17:07:18 +03:00
ospab 5ee8d5a470 fix: prevent PowerShell Invoke-WebRequest hangs by disabling ProgressPreference 2026-05-15 16:56:10 +03:00
ospab 92c044217f feat: absolute dynamic Windows elevation using native ShellExecuteW (runas) 2026-05-15 16:41:20 +03:00
ospab c2407f3637 fix: stabilize Windows dynamic UAC elevation by waiting for powershell handoff 2026-05-15 16:39:19 +03:00
ospab da50d2f15f feat: autonomous self-downloading dependencies inside TUN OS drivers 2026-05-15 15:58:35 +03:00
ospab 22fb9bb3d3 feat: unified cross-platform TUN support (Linux + Windows Firewall dynamic bypass) 2026-05-15 15:54:37 +03:00
ospab 31d61de939 Fix: Add physical network bypass routing for primary DNS (1.1.1.1) in Wintun handler to prevent UDP-over-TCP DNS resolution deadlock. 2026-05-15 01:23:13 +03:00
ospab e5062465d6 Fix: Integrate multi-architecture Wintun zip extractor filtering and upgrade tun2socks to v2.6.0 using the provided working release endpoint. 2026-05-15 01:20:56 +03:00