A fast, custom encrypted transport protocol written in Rust.
Go to file
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
.github/workflows refactor: professionalize all scripts and CI workflow 2026-05-17 03:41:40 +03:00
docs fix: resolve critical ARQ bugs causing Speedtest tunnel drops + docs overhaul 2026-05-17 03:20:50 +03:00
ostp polish: professionalize all user-facing log output and UX 2026-05-17 03:26:15 +03:00
ostp-client feat: comprehensive diagnostic logging across all modules 2026-05-17 14:31:21 +03:00
ostp-core feat: comprehensive diagnostic logging across all modules 2026-05-17 14:31:21 +03:00
ostp-gui fix: GUI, JNI SDK, and TUN handler audit fixes 2026-05-17 03:31:48 +03:00
ostp-jni fix: GUI, JNI SDK, and TUN handler audit fixes 2026-05-17 03:31:48 +03:00
ostp-server feat: comprehensive diagnostic logging across all modules 2026-05-17 14:31:21 +03:00
ostp-tun-helper fix: resolve KeyExchange import error and clean compiler warnings 2026-05-17 03:35:39 +03:00
scripts refactor: professionalize all scripts and CI workflow 2026-05-17 03:41:40 +03:00
.gitattributes chore: enforce LF line endings on bash scripts via gitattributes to fix 'bad interpreter' on Linux 2026-05-15 19:08:03 +03:00
.gitignore fix: resolve build errors and remove GUI from main release; docs: improve READMEs 2026-05-16 19:15:04 +03:00
Cargo.lock CI/CD: release version v0.1.62 2026-05-17 14:23:08 +03:00
Cargo.toml CI/CD: release version v0.1.62 2026-05-17 14:23:08 +03:00
Cross.toml CI/CD: Resolve MIPS Tier-3 compilation by instructing Cross to dynamically build-std library from source 2026-05-14 23:57:19 +03:00
LICENSE Initial public release: Ospab Stealth Transport Protocol v0.1.0 2026-05-14 21:41:54 +03:00
README.md fix: resolve critical ARQ bugs causing Speedtest tunnel drops + docs overhaul 2026-05-17 03:20:50 +03:00
README.ru.md fix: resolve critical ARQ bugs causing Speedtest tunnel drops + docs overhaul 2026-05-17 03:20:50 +03:00

README.md

OSTP — Ospab Stealth Transport Protocol

Русский язык

GitHub Release License: BSL 1.1 Platform: Windows | Linux | macOS | Android

OSTP is a high-performance, censorship-resistant transport protocol designed to tunnel TCP traffic over UDP with full traffic obfuscation. It is resistant to Deep Packet Inspection (DPI), active probing, and statistical traffic analysis.


Key Features

Feature Description
Traffic Obfuscation Every packet — including headers — is indistinguishable from random noise on the wire. Session IDs and nonces are masked with per-packet HMAC-derived keys.
Noise Protocol Handshake Noise_NNpsk0_25519_ChaChaPoly_BLAKE2s — pre-shared key authenticated, forward-secret key exchange with no static identity exposure.
Reliable UDP (ARQ) Selective ACK/NACK with rate-limited retransmission, configurable reorder buffer, and exponential backoff. Designed for 10 Gbps throughput.
Multiplexed Streams Multiple logical TCP streams over a single encrypted UDP session, with per-stream flow control.
Seamless Roaming Clients can switch networks (WiFi ↔ 4G) without session interruption — the server tracks session-ID, not IP address.
TUN Mode Full-system VPN via tun2socks integration on Windows and Linux. All traffic is transparently routed through the tunnel.
TURN Relay RFC 5766 TURN support for environments where direct UDP is blocked.
Hot-Reload Runtime config reload without restarting the process (access keys, exclusions, mux settings, TURN).
Cross-Platform Windows, Linux, macOS, Android. Single binary, no runtime dependencies.

Architecture

┌─────────────────────────────────────────────────────────────┐
│  Client                                                     │
│  ┌──────────┐   ┌──────────┐   ┌────────────────────────┐   │
│  │ Browser  │──▸│ SOCKS5/  │──▸│    Bridge (Mux)        │   │
│  │ / Apps   │   │ HTTP     │   │  ┌─────────────────┐   │   │
│  │          │   │ Proxy    │   │  │ ProtocolMachine │   │   │
│  └──────────┘   └──────────┘   │  │ (Noise + AEAD)  │   │   │
│                                │  └────────┬────────┘   │   │
│  ┌──────────┐                  │           │            │   │
│  │ TUN Mode │──────────────────┤      UDP Socket        │   │
│  │tun2socks │                  │  (32MB buffers,        │   │
│  └──────────┘                  │   obfuscated wire)     │   │
│                                └───────────┬────────────┘   │
└────────────────────────────────────────────┼────────────────┘
                                             │ UDP
┌────────────────────────────────────────────┼────────────────┐
│  Server                                    │                │
│  ┌─────────────────────────────────────────┴───────────┐    │
│  │              Dispatcher                             │    │
│  │  (Session lookup, roaming detection, replay guard)  │    │
│  └──────────────┬──────────────────────────────────────┘    │
│                 │                                           │
│  ┌──────────────▾──────────────────┐                        │
│  │   Relay Loop (per-stream TCP)   │──▸ Internet / Backend  │
│  └─────────────────────────────────┘                        │
└─────────────────────────────────────────────────────────────┘

Installation

Linux

bash <(curl -Ls https://raw.githubusercontent.com/ospab/ostp/master/scripts/install.sh)

Windows (PowerShell, Administrator)

irm https://raw.githubusercontent.com/ospab/ostp/master/scripts/install.ps1 | iex

Configuration

Generate a default config:

./ostp --init server   # VPS
./ostp --init client   # Local machine

Server (config.json)

{
  "mode": "server",
  "listen": "0.0.0.0:50000",
  "access_keys": ["YOUR_SECRET_KEY"],
  "debug": false,
  // Optional: forward traffic through an upstream proxy
  "outbound": {
    "enabled": false,
    "protocol": "socks5",    // "socks5" or "http"
    "address": "127.0.0.1",
    "port": 9050,
    "default_action": "proxy"
  }
}

Client (config.json)

{
  "mode": "client",
  "server": "YOUR_SERVER_IP:50000",
  "access_key": "YOUR_SECRET_KEY",
  "socks5_bind": "127.0.0.1:1088",
  "debug": false,
  // TUN mode (full-system VPN)
  "tun": {
    "enable": false,
    "dns": "1.1.1.1"
  },
  // Multiplexing: spread traffic across multiple UDP sessions
  "mux": {
    "enabled": false,
    "sessions": 2
  },
  // TURN relay for restricted networks
  "turn": {
    "enabled": false,
    "server_addr": "turn.example.com:3478",
    "username": "user",
    "access_key": "pass"
  },
  // Traffic exclusions (bypassed directly)
  "exclude": {
    "domains": ["example.local"],
    "ips": ["192.168.0.0/16"]
  }
}

Usage

# Start with config
./ostp --config config.json

# Or just run (looks for config.json in current/binary directory)
./ostp

TUN Mode (Windows)

Requires tun2socks.exe in the same directory. Automatically requests Administrator privileges.

TUN Mode (Linux)

Requires root. Uses tun2socks binary (same directory or in $PATH).


Protocol Specification

See docs/en/specification.md for the full wire format, handshake flow, and ARQ semantics.

Quick Summary

Layer Mechanism
Key Exchange Noise NNpsk0 (X25519 + ChaChaPoly + BLAKE2s)
Encryption ChaCha20-Poly1305 AEAD per-packet
Header Obfuscation HMAC-SHA256 derived per-packet mask over session_id + nonce
Reliability Selective ACK with cumulative + SACK ranges
Retransmission Rate-limited NACK (30ms cooldown) + exponential backoff RTO
Flow Control In-flight window (retransmittable frames only)
Keepalive Ping/Pong with RTT measurement every 5s
Session Timeout 60s inactivity on client, 300s on server

Building from Source

# Prerequisites: Rust toolchain (1.75+)
cargo build --release

# Cross-compile for Linux (from Windows/macOS)
cross build --release --target x86_64-unknown-linux-gnu

Documentation


License

Business Source License 1.1. Free for personal and non-commercial use.
Converts to MIT License on May 14, 2030.