A fast, custom encrypted transport protocol written in Rust.
Go to file
ospab 907d03ca38 fix(android): protect xhttp TCP socket from VPN routing loop
When using xhttp (UoT) mode on Android, the underlying TcpStream was
not protected with VpnService.protect(fd). This caused the TCP connection
to be routed back into the TUN interface, creating an infinite routing
loop and failing the connection immediately.

Added Android-specific socket protection to the TcpStream in connect_xhttp.
This fixes xhttp/UoT mode on mobile networks.
2026-05-29 17:27:50 +03:00
.github/workflows Upgrade Flutter to 3.41.6 in CI to support Kotlin DSL 2026-05-28 15:19:06 +03:00
docs docs: update obfuscation docs with XTLS-Reality 2026-05-29 15:02:39 +03:00
ostp feat: implement custom Reality protocol with ChaCha20Poly1305 and X25519 2026-05-29 15:00:17 +03:00
ostp-client fix(android): protect xhttp TCP socket from VPN routing loop 2026-05-29 17:27:50 +03:00
ostp-core fix(reality): fix TLS 1.3 handshake causing 1KB DPI cutoff on mobile 2026-05-29 16:21:59 +03:00
ostp-flutter fix(android): protect xhttp TCP socket from VPN routing loop 2026-05-29 17:27:50 +03:00
ostp-gui fix(android): protect xhttp TCP socket from VPN routing loop 2026-05-29 17:27:50 +03:00
ostp-jni feat: implement optional WSS framing for DPI bypass & extract framing logic 2026-05-29 13:59:59 +03:00
ostp-server fix(reality): fix TLS 1.3 handshake causing 1KB DPI cutoff on mobile 2026-05-29 16:21:59 +03:00
ostp-tun-helper feat: implement optional WSS framing for DPI bypass & extract framing logic 2026-05-29 13:59:59 +03:00
ostp-wiki Implement config management API, token generation, and update wiki 2026-05-26 19:33:45 +03:00
scripts fix: detect real public IP for panel URL output 2026-05-26 22:08:51 +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(reality): fix TLS 1.3 handshake causing 1KB DPI cutoff on mobile 2026-05-29 16:21:59 +03:00
.ostp_public_ip Fix STUN bug, improve DNS in TUN, fix config gen, add GHA for clients 2026-05-28 14:39:42 +03:00
CONTRIBUTING.md docs: add CONTRIBUTING guide in English and Russian, link in README 2026-05-29 00:25:40 +03:00
CONTRIBUTING.ru.md docs: add CONTRIBUTING guide in English and Russian, link in README 2026-05-29 00:25:40 +03:00
Cargo.lock CI/CD: release version v0.2.71 2026-05-29 16:42:05 +03:00
Cargo.toml CI/CD: release version v0.2.71 2026-05-29 16:42:05 +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 feat: implement custom Reality protocol with ChaCha20Poly1305 and X25519 2026-05-29 15:00:17 +03:00
README.ru.md feat: implement custom Reality protocol with ChaCha20Poly1305 and X25519 2026-05-29 15:00:17 +03:00
server.json Fix STUN bug, improve DNS in TUN, fix config gen, add GHA for clients 2026-05-28 14:39:42 +03:00
test.json Fix Tauri RealityConfig init 2026-05-28 15:30:48 +03:00

README.md

OSTP — Ospab Stealth Transport Protocol

Русский язык · Wiki · Contributing · Releases

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

OSTP 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.


Quick Install

Linux

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

Windows (PowerShell, run as Administrator)

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

Manual Download

Download pre-built binaries for your platform from GitHub Releases.


Key Features

Feature Description
Full Traffic Obfuscation Every packet — including headers — is indistinguishable from random noise. Session IDs and nonces are masked with per-packet HMAC-derived keys.
Noise Protocol Handshake Noise_NNpsk0_25519_ChaChaPoly_BLAKE2s — PSK-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.
Multiplexed Streams Multiple logical TCP streams over a single encrypted UDP session with per-stream flow control.
Seamless Roaming Clients can switch networks (WiFi ↔ LTE) without session interruption — tracked by session-ID, not IP.
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.
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.
Cross-Platform Windows, Linux, macOS, Android, FreeBSD, MIPS, RISC-V. 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, replay guard, per-user   │    │
│  │   traffic accounting, limit enforcement)            │    │
│  └──┬──────────────────────┬───────────────────────────┘    │
│     │                      │                                │
│  ┌──▾──────────────────┐ ┌─▾──────────────────────────┐     │
│  │ Relay Loop          │ │ Management API (REST)      │     │
│  │ (per-stream TCP)    │ │ /api/users, /api/stats     │     │
│  │ ──▸ Internet        │ │ Bearer token auth          │     │
│  └─────────────────────┘ └────────────────────────────┘     │
│                                                             │
│  ┌──────────────────────────────────────────────────────┐   │
│  │ Fallback TCP Proxy ──▸ nginx/caddy (anti-DPI)        │   │
│  └──────────────────────────────────────────────────────┘   │
└─────────────────────────────────────────────────────────────┘

Quick Start

1. Generate config

# On your VPS (server):
./ostp --init server

# On your machine (client):
./ostp --init client

2. Edit config

Server — set your access keys:

{
  "mode": "server",
  "listen": "0.0.0.0:50000",
  "access_keys": ["YOUR_SECRET_KEY"],
  "api": { "enabled": true, "bind": "127.0.0.1:9090", "token": "admin-token" },
  "fallback": { "enabled": false, "listen": "0.0.0.0:443", "target": "127.0.0.1:8080" }
}

Client — point to your server:

{
  "mode": "client",
  "server": "YOUR_SERVER_IP:50000",
  "access_key": "YOUR_SECRET_KEY",
  "socks5_bind": "127.0.0.1:1088",
  "transport": { "mode": "udp", "stealth_sni": "vk.com", "stealth_port": 443 },
  "tun": { "enable": false, "dns": "1.1.1.1" }
}

3. Run

./ostp                        # Uses config.json in current directory
./ostp --config /path/to.json # Custom config path
./ostp --check                # Validate config without running
./ostp --generate-key         # Generate a new access key
./ostp --links                # Print client share links
./ostp "ostp://ACCESS_KEY@server.com:50000?..."

Note: Always wrap the ostp://... link in quotes (") so your terminal doesn't misinterpret special characters like & or ?.


Management API

Built-in REST API for building panels and dashboards.

# Server status
curl -H "Authorization: Bearer mytoken" http://127.0.0.1:9090/api/server/status

# List all users with traffic stats  
curl -H "Authorization: Bearer mytoken" http://127.0.0.1:9090/api/users

# Create a user with 10GB traffic limit
curl -X POST -H "Authorization: Bearer mytoken" \
  -H "Content-Type: application/json" \
  -d '{"limit_bytes": 10737418240}' \
  http://127.0.0.1:9090/api/users

Full API reference: Management API


CLI Reference

ostp [OPTIONS] [URL]

Options:
  --config <PATH>        Config file path (default: config.json)
  --init <MODE>          Generate template config (server/client)
  --check                Validate configuration and exit
  -g, --generate-key     Generate a secure access key
  -c, --count <N>        Number of keys to generate (default: 1)
  --format <FMT>         Key format: hex, base64 (default: hex)
  --links                Print client share links from server config

Arguments:
  [URL]                  Connect via share link: ostp://KEY@HOST:PORT

Protocol Summary

Layer Mechanism
XTLS-Reality Spoofed TLS 1.3 ClientHello, X25519 Key Exchange, ChaCha20-Poly1305 AEAD
Key Exchange Noise NNpsk0 (X25519 + ChaChaPoly + BLAKE2s)
Encryption ChaCha20-Poly1305 AEAD per-packet
Header Obfuscation HMAC-SHA256 derived per-packet mask
Reliability Selective ACK with cumulative + SACK ranges
Retransmission Rate-limited NACK + exponential backoff RTO
Keepalive Ping/Pong with RTT measurement every 5s

Building from Source

# Prerequisites: Rust 1.75+
cargo build --release

# Cross-compile for Linux
cross build --release --target x86_64-unknown-linux-gnu

# Run tests
cargo test -p ostp-core -p ostp-server

Documentation


License

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


Contact