From c7bca416166c78dbdab9e3b6d8fc49d875a4e104 Mon Sep 17 00:00:00 2001 From: ospab Date: Sun, 14 Jun 2026 01:04:50 +0300 Subject: [PATCH] chore: fix JNI UoT handler args, center Flutter home screen metrics, update READMEs --- README.md | 11 +++++------ README.ru.md | 15 +++++++-------- ostp-client/src/tunnel/native_handler.rs | 9 ++++++--- ostp-client/src/tunnel/udp_nat.rs | 17 +++++++++++++---- ostp-flutter/lib/ui/home_screen.dart | 2 +- 5 files changed, 32 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index fbca816..6a6a401 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ ![Crypto](https://img.shields.io/badge/Crypto-Noise__NNpsk0-blueviolet?style=for-the-badge) ![Transport](https://img.shields.io/badge/Transport-UDP%20ARQ-informational?style=for-the-badge) -**OSTP** (Ospab Stealth Transport Protocol) is a high-performance, censorship-resistant transport protocol designed to tunnel TCP traffic over UDP with full traffic obfuscation. Every byte on the wire — including packet headers — is cryptographically indistinguishable from random noise. Resistant to Deep Packet Inspection (DPI), active probing, and statistical traffic analysis. +**OSTP** (Ospab Stealth Transport Protocol) is a high-performance, censorship-resistant zero-signature transport protocol. It implements a custom, reliable ARQ transport over UDP, as well as a UoT (UDP-over-TCP) mode. Every byte on the wire — including packet headers — is cryptographically indistinguishable from random noise, making it highly resistant to Deep Packet Inspection (DPI), active probing, and statistical traffic analysis. --- @@ -41,9 +41,9 @@ Download pre-built binaries for your platform from [GitHub Releases](https://git | **Management API** | Built-in REST API for third-party panels (3x-ui, custom dashboards). Per-user stats, traffic limits, key CRUD. | | **Fallback Server** | TCP fallback proxy to a web server — makes OSTP indistinguishable from nginx during active probing. | | **Multi-Listener** | Bind to multiple addresses simultaneously (dual-stack IPv4/IPv6, multi-port). | -| **TUN Mode** | Full-system VPN via `tun2socks` integration. All traffic transparently routed through the tunnel. | -| **xHTTP Stealth (UoT)** | UDP-over-TCP tunnel disguised as standard HTTP/1.1 or TLS traffic to bypass Level 1 Deep Packet Inspection (DPI) whitelists. | -| **XTLS-Reality** | Custom, dependency-free implementation of the Reality protocol using ChaCha20Poly1305 and X25519 for perfect TLS 1.3 impersonation. | +| **TUN Mode** | Full-system VPN via native `smoltcp` network stack without external dependencies. All traffic transparently routed through the tunnel. | +| **xHTTP Stealth (UoT)** | UDP-over-TCP tunnel that completely hides traffic. Since all data is fully encrypted and length-prefixed, it bypasses DPI filters that block unknown UDP traffic by riding over a plain TCP connection. | +| **Mobile & Web Apps** | Beautiful cross-platform mobile client (Flutter) and a modern Web Control Panel (React/Vite) for effortless server and client management. | | **TURN Relay** | RFC 5766 TURN support for environments where direct UDP is blocked. | | **Hot-Reload** | Runtime config reload without restart (access keys, exclusions, mux settings). | | **Structured Logging** | `tracing`-based logging with `RUST_LOG` filtering. JSON/file/syslog output support. | @@ -190,8 +190,7 @@ Arguments: | Layer | Mechanism | |-------|-----------| -| XTLS-Reality | Spoofed TLS 1.3 ClientHello, X25519 Key Exchange, ChaCha20-Poly1305 AEAD | -| Key Exchange | Noise NNpsk0 (X25519 + ChaChaPoly + BLAKE2s) | +| Key Exchange | Noise NNpsk0 (X25519 + ChaChaPoly + BLAKE2s) zero-RTT | | Encryption | ChaCha20-Poly1305 AEAD per-packet | | Header Obfuscation | HMAC-SHA256 derived per-packet mask | | Reliability | Selective ACK with cumulative + SACK ranges | diff --git a/README.ru.md b/README.ru.md index a0be641..8d9912a 100644 --- a/README.ru.md +++ b/README.ru.md @@ -8,7 +8,7 @@ ![Crypto](https://img.shields.io/badge/Crypto-Noise__NNpsk0-blueviolet?style=for-the-badge) ![Transport](https://img.shields.io/badge/Transport-UDP%20ARQ-informational?style=for-the-badge) -**OSTP** (Ospab Stealth Transport Protocol) — высокопроизводительный транспортный протокол, устойчивый к цензуре. Туннелирует TCP-трафик поверх UDP с полной обфускацией. Устойчив к Deep Packet Inspection (DPI), активному зондированию и статистическому анализу трафика. +**OSTP** (Ospab Stealth Transport Protocol) — высокопроизводительный, устойчивый к цензуре zero-signature транспортный протокол. Реализует собственный надёжный ARQ-транспорт поверх UDP, а также режим UoT (UDP-over-TCP). Каждый байт, включая заголовки пакетов, криптографически неотличим от случайного шума. Полностью устойчив к Deep Packet Inspection (DPI), активному зондированию и статистическому анализу трафика. --- @@ -21,9 +21,9 @@ | **Reliable UDP (ARQ)** | Selective ACK/NACK с rate-limited ретрансмиссией, настраиваемым reorder-буфером и exponential backoff. Разработан для 10 Гбит/с. | | **Мультиплексирование** | Несколько логических TCP-потоков поверх одной зашифрованной UDP-сессии с per-stream flow control. | | **Бесшовный роуминг** | Клиент может менять сети (WiFi ↔ 4G) без разрыва сессии — сервер отслеживает session-ID, а не IP-адрес. | -| **TUN-режим** | Полносистемный VPN через интеграцию с `tun2socks` на Windows и Linux. | -| **xHTTP Стелс (UoT)** | Туннель UDP-over-TCP, замаскированный под обычный HTTP/1.1 или TLS трафик для обхода белых списков ТСПУ (DPI). | -| **XTLS-Reality** | Собственная реализация протокола Reality (без зависимостей) с использованием ChaCha20Poly1305 и X25519 для идеальной маскировки под TLS 1.3. | +| **TUN-режим** | Полносистемный VPN без внешних зависимостей (встроенный network stack на базе `smoltcp`). | +| **xHTTP Стелс (UoT)** | Туннель UDP-over-TCP, который полностью скрывает трафик. Поскольку все данные полностью зашифрованы и имеют префикс длины, он обходит DPI фильтры, блокирующие неизвестный UDP трафик, передавая всё по обычному TCP соединению. | +| **Мобильные и Web приложения** | Красивый кроссплатформенный мобильный клиент (Flutter) и современная Web панель управления (React/Vite) для удобного администрирования. | | **TURN Relay** | RFC 5766 TURN для окружений, где прямой UDP заблокирован. | | **Hot-Reload** | Перезагрузка конфига в рантайме без перезапуска (ключи, исключения, mux, TURN). | | **Кросс-платформа** | Windows, Linux, macOS, Android. Один бинарник, без зависимостей. | @@ -155,10 +155,10 @@ irm https://raw.githubusercontent.com/ospab/ostp/master/scripts/install.ps1 | ie ``` ### TUN-режим (Windows) -Требуется `tun2socks.exe` в той же директории. Автоматически запрашивает права Администратора. +Использует встроенный сетевой стек `smoltcp` и виртуальный адаптер `wintun` (необходима `wintun.dll`). Требует запуска с правами Администратора. ### TUN-режим (Linux) -Требуется root. Нужен бинарник `tun2socks` (рядом или в `$PATH`). +Использует встроенный сетевой стек `smoltcp` и `/dev/net/tun`. Требует запуска от имени `root` (или наличия `CAP_NET_ADMIN`). --- @@ -166,8 +166,7 @@ irm https://raw.githubusercontent.com/ospab/ostp/master/scripts/install.ps1 | ie | Уровень | Механизм | |---------|----------| -| XTLS-Reality | Поддельный TLS 1.3 ClientHello, X25519 обмен ключами, ChaCha20-Poly1305 AEAD | -| Обмен ключами | Noise NNpsk0 (X25519 + ChaChaPoly + BLAKE2s) | +| Обмен ключами | Noise NNpsk0 (X25519 + ChaChaPoly + BLAKE2s) zero-RTT | | Шифрование | ChaCha20-Poly1305 AEAD на каждый пакет | | Обфускация заголовков | HMAC-SHA256 маска session_id + nonce, уникальная для каждого пакета | | Надёжность | Selective ACK с cumulative + SACK диапазонами | diff --git a/ostp-client/src/tunnel/native_handler.rs b/ostp-client/src/tunnel/native_handler.rs index d5844d2..9de2649 100644 --- a/ostp-client/src/tunnel/native_handler.rs +++ b/ostp-client/src/tunnel/native_handler.rs @@ -254,12 +254,15 @@ pub async fn run_native_tunnel( #[cfg(target_os = "windows")] if !should_bypass { if let Some(proc_name) = crate::tunnel::process_lookup::get_process_name_from_port(local.port()) { + tracing::info!("TUN TCP lookup: port {} -> process {}", local.port(), proc_name); if matcher.match_process(&proc_name) { if true { - tracing::debug!("TUN BYPASS (Process match): {} → {remote}", proc_name); + tracing::info!("TUN TCP BYPASS (Process match): {} → {remote}", proc_name); } should_bypass = true; } + } else { + tracing::info!("TUN TCP lookup: port {} -> no process found", local.port()); } } @@ -273,7 +276,7 @@ pub async fn run_native_tunnel( } if matcher.match_domain(&sni) { if true { - tracing::debug!("TUN BYPASS (SNI domain): {sni} → {remote}"); + tracing::info!("TUN TCP BYPASS (SNI domain): {sni} → {remote}"); } should_bypass = true; } @@ -283,7 +286,7 @@ pub async fn run_native_tunnel( // 3. Destination IP CIDR check (for IPs not in routing table / IPv6) if !should_bypass && matcher.match_ip(&remote.ip()) { if true { - tracing::debug!("TUN BYPASS (IP match): {remote}"); + tracing::info!("TUN TCP BYPASS (IP match): {remote}"); } should_bypass = true; } diff --git a/ostp-client/src/tunnel/udp_nat.rs b/ostp-client/src/tunnel/udp_nat.rs index bc24953..6749814 100644 --- a/ostp-client/src/tunnel/udp_nat.rs +++ b/ostp-client/src/tunnel/udp_nat.rs @@ -41,16 +41,19 @@ pub async fn run_udp_nat( let matcher_guard = matcher.read().await; if matcher_guard.match_ip(&dst.ip()) { should_bypass = true; - tracing::debug!("TUN UDP BYPASS (IP match): {} → {}", src, dst); + tracing::info!("TUN UDP BYPASS (IP match): {} → {}", src, dst); } #[cfg(target_os = "windows")] if !should_bypass { if let Some(proc_name) = crate::tunnel::process_lookup::get_process_name_from_port_udp(src.port()) { + tracing::info!("TUN UDP lookup: port {} -> process {}", src.port(), proc_name); if matcher_guard.match_process(&proc_name) { should_bypass = true; - tracing::debug!("TUN UDP BYPASS (Process match): {} ({} → {})", proc_name, src, dst); + tracing::info!("TUN UDP BYPASS (Process match): {} ({} → {})", proc_name, src, dst); } + } else { + tracing::info!("TUN UDP lookup: port {} -> no process found", src.port()); } } } @@ -60,7 +63,7 @@ pub async fn run_udp_nat( tokio::spawn(async move { if should_bypass { - tracing::debug!("Starting UDP BYPASS session for {}", src); + tracing::info!("Starting UDP BYPASS session for {}", src); let res = start_udp_bypass_session(src, p_if_idx, p_if_name, &mut session_rx, tx_clone).await; if res.is_err() { tracing::debug!("UDP BYPASS session for {} ended: {:?}", src, res.err()); @@ -105,7 +108,13 @@ async fn start_udp_bypass_session( #[cfg(target_os = "windows")] if let Some(idx) = phys_if_index { - let _ = crate::tunnel::proxy::bind_socket_to_interface(&socket, client_src.is_ipv6(), idx); + if let Err(e) = crate::tunnel::proxy::bind_socket_to_interface(&socket, client_src.is_ipv6(), idx) { + tracing::error!("TUN UDP BYPASS failed to bind to physical interface {}: {}", idx, e); + } else { + tracing::info!("TUN UDP BYPASS bound to physical interface {}", idx); + } + } else { + tracing::warn!("TUN UDP BYPASS has no physical interface index!"); } #[cfg(target_os = "linux")] diff --git a/ostp-flutter/lib/ui/home_screen.dart b/ostp-flutter/lib/ui/home_screen.dart index 67c02d6..3d880bc 100644 --- a/ostp-flutter/lib/ui/home_screen.dart +++ b/ostp-flutter/lib/ui/home_screen.dart @@ -885,7 +885,7 @@ class _HomeScreenState extends State with TickerProviderStateMixin { child: Icon(icon, size: 20, color: color), ), const SizedBox(width: 12), - Expanded( + Flexible( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [