An open API service indexing awesome lists of open source software.

https://github.com/gagansuie/oxidize

Deep Learning Driven Network Acceleration
https://github.com/gagansuie/oxidize

ai ml network quic

Last synced: 5 months ago
JSON representation

Deep Learning Driven Network Acceleration

Awesome Lists containing this project

README

          

# Oxidize

### Open Source Deep Learning Driven Network Acceleration

**Neural networks predict packet loss before it happens, optimize routing in real-time, and accelerate your network automatically.**

> ๐Ÿ”ฅ **0.7ยตs** per-packet processing โ€ข **44%** header compression โ€ข **Zero-copy** packet pipeline โ€ข **Pure Rust**

[![CI](https://github.com/gagansuie/oxidize/actions/workflows/ci.yml/badge.svg)](https://github.com/gagansuie/oxidize/actions/workflows/ci.yml)
[![Release](https://github.com/gagansuie/oxidize/actions/workflows/release.yml/badge.svg)](https://github.com/gagansuie/oxidize/actions/workflows/release.yml)
[![License](https://img.shields.io/badge/license-MIT%2FApache--2.0-blue.svg)](LICENSE)
[![Rust](https://img.shields.io/badge/rust-1.70%2B-orange.svg)](https://www.rust-lang.org/)

[Website](https://oxd.sh) ยท [Download](https://oxd.sh/download) ยท [Documentation](docs/) ยท [Speed Test](#speed-test)

---

## The Problem

Your ISP's routing is suboptimal:
- **Congested peering points** โ†’ packet loss
- **Cost-optimized routes** โ†’ unnecessary latency (+50-200ms)
- **No QoS guarantees** โ†’ inconsistent performance

## The Solution

```
โŒ Direct (Your ISP): You โ†’ Congested ISP routes โ†’ Destination (120ms, 2% loss)
โœ… Via Oxidize: You โ†’ QUIC tunnel โ†’ Premium edge โ†’ Destination (80ms, 0% loss)
```

## Architecture

```
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Your Device โ”‚ QUIC โ”‚ Relay Server โ”‚
โ”‚ oxidize-client โ”‚ โ”€โ”€โ”€โ”€โ”€โ”€โ–บ โ”‚ oxidize-server โ”‚ โ”€โ”€โ”€โ”€โ”€โ”€โ–บ Internet
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
โ†‘ โ†‘
TCP + UDP TCP + UDP
captured forwarded
```

- **Full traffic tunneling** โ€” ALL TCP and UDP traffic flows through the relay
- **Dedicated infrastructure** โ€” no peer-to-peer, no bandwidth sharing with strangers
- **Smart routing** โ€” gaming tunneled, streaming bypassed for zero latency

## Perfect For

| ๐ŸŽฎ Gamers | ๐Ÿ“ฑ Mobile Users | ๐Ÿข Remote Workers | ๐Ÿš€ Bad ISPs |
|-----------|-----------------|-------------------|-------------|
| Reduce jitter & packet loss | Better than carrier routing | VPN alternative, better perf | Bypass congestion |

## Features

### ๐Ÿš€ Core Performance
- **QUIC Protocol** - 0-RTT resumption, stream multiplexing, fast loss recovery
- **Smart Routing** - Bypass congested ISP routes with optimized paths
- **Adaptive FEC** - Dynamic Reed-Solomon redundancy based on packet loss rate
- **Multi-path Support** - WiFi + LTE bandwidth aggregation and seamless failover

### โšก High-Performance Pipeline (100x Optimization)
- **Kernel Bypass** - AF_XDP/XDP for bare metal (10-25 Gbps, no dedicated CPU cores)
- **Zero-Copy I/O** - Direct packet access via AF_XDP UMEM
- **UDP GSO/GRO Batching** - 64 packets per syscall, 5-10x throughput
- **Zero-Copy Buffers** - Buffer pooling eliminates allocation overhead
- **Ring Buffers** - Lock-free packet queuing
- **Connection Pooling** - QUIC connection reuse, 10x handshake reduction
- **SIMD Acceleration** - AVX-512/AVX2/NEON optimized operations (2x faster with AVX-512)
- **Lock-Free Streams** - No mutex contention on hot path
- **ACK Batching** - Configurable batching reduces round-trips
- **Latency Instrumentation** - Built-in ยตs-level timing for optimization
- **LZ4 DEFAULT Mode** - ~6 GB/s compression (30x faster than HIGH mode)
- **Zero-Allocation Hot Path** - Ownership transfer instead of cloning in packet pipeline

### ๐Ÿ“ฑ OxTunnel Protocol (Unified Cross-Platform)
Custom high-performance tunnel protocol replacing WireGuard with **unified architecture** for all platforms:

```
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ OxTunnel Protocol (TCP + UDP) โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ Linux: App โ†’ NFQUEUE โ†’ OxTunnel โ†’ QUIC Datagrams โ†’ Server โ”‚
โ”‚ macOS: App โ†’ PF/Utun โ†’ OxTunnel โ†’ QUIC Datagrams โ†’ Server โ”‚
โ”‚ Windows: App โ†’ WinDivert โ†’ OxTunnel โ†’ QUIC Datagrams โ†’ Server โ”‚
โ”‚ Android: App โ†’ VpnService โ†’ OxTunnel โ†’ QUIC Datagrams โ†’ Server โ”‚
โ”‚ iOS: App โ†’ NEPacketTunnel โ†’ OxTunnel โ†’ QUIC Datagrams โ†’ Serverโ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
All platforms: TCP + UDP tunneled, UDP fallback when QUIC blocked
```

- **Same protocol everywhere** - All platforms use identical OxTunnel encapsulation
- **Platform-specific capture** - NFQUEUE (Linux), PF (macOS), WinDivert (Windows), VpnService (Android)
- **QUIC primary transport** - Encrypted, multiplexed, 0-RTT for all platforms
- **UDP fallback** - For networks that block QUIC
- **V2 Variable Headers** - 2-7 byte headers (avg 4B) with varint encoding, 55% smaller than V1
- **64 packets/batch** - Reduces syscalls by 64x
- **Zero-copy buffer pools** - 128 pre-allocated buffers, no heap allocation per packet

| Feature | WireGuard | OxTunnel |
|---------|-----------|----------|
| Header size | 32+ bytes | **4 bytes avg** (V2) |
| Encryption | Double (WG + TLS) | Single (QUIC TLS 1.3) |
| Handshake | Multi-round Noise | Single round-trip |
| Buffer allocation | Per-packet malloc | Zero-copy pool |
| Batch processing | No | 64 packets/batch |
| Packet capture | TUN device | NFQUEUE/PF/WinDivert |
| Transport | UDP only | QUIC + UDP fallback |
| Cross-platform | Separate implementations | Unified protocol |

### ๐ŸŽญ MASQUE-Inspired Architecture
Inspired by [Cloudflare's MASQUE/WARP](https://blog.cloudflare.com/zero-trust-warp-with-a-masque/):
- **QUIC Datagrams** - Real-time traffic (gaming/VoIP) bypasses stream ordering, eliminating head-of-line blocking
- **0-RTT Session Resumption** - Instant reconnects via cached session tickets
- **Connection Migration** - Seamless WiFi โ†” cellular transitions without reconnecting
- **Dual-Path Architecture** - Streams for reliable traffic, datagrams for latency-sensitive traffic
- **Smart Traffic Detection** - Auto-detects gaming/VoIP ports for optimal routing

### ๐Ÿง  Smart Traffic Management
- **Adaptive ML Congestion Control** - Online learning with continuous improvement
- Lookup tables generated from trained ML model (<100ns decisions)
- Live ML inference for edge cases (~1ยตs)
- Automatic table refresh (hourly) from real traffic observations
- No restart needed - model improves continuously
- **ECN (Explicit Congestion Notification)** - RFC 9000 compliant
- DCTCP-style congestion response
- Better signals than loss-based detection
- **Multipath QUIC** - Aggregate bandwidth across paths
- Adaptive path selection (RTT + loss + bandwidth scoring)
- Seamless failover on path failure
- Round-robin, weighted, or lowest-RTT scheduling
- **Deep Packet Inspection** - Identifies Discord, Zoom, Valorant, Fortnite by protocol patterns
- **Application Fingerprinting** - Detect apps on non-standard ports (Discord on 443, etc.)
- **Traffic Classification** - Auto-detects gaming/streaming/VoIP for optimal handling
- **Smart Split-Tunneling** - Gaming tunneled for optimization, streaming bypassed for clean IP
- **Edge Caching** - LRU cache for static content at relay points

### ๐Ÿง  Deep Learning Engine (Pure Rust, 10x Optimized)
Self-improving network optimization using neural networks with **adaptive online learning**:

```
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ AdaptiveMlEngine (Production) โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚
โ”‚ โ”‚ ML Lookup Tables โ”‚ โ”‚ Live ML Inference โ”‚ โ”‚ Online Learning โ”‚ โ”‚
โ”‚ โ”‚ - From ML model โ”‚ โ”‚ - Candle/SafeTensorsโ”‚ โ”‚ - 100K obs bufferโ”‚ โ”‚
โ”‚ โ”‚ - <100ns lookup โ”‚ โ”‚ - <1ยตs inference โ”‚ โ”‚ - Hourly refresh โ”‚ โ”‚
โ”‚ โ”‚ - 90%+ hit rate โ”‚ โ”‚ - Edge cases only โ”‚ โ”‚ - No restart โ”‚ โ”‚
โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
```

**Core Models (Always Active):**
| Model | Architecture | Latency | Purpose |
|-------|--------------|---------|----------|
| **Loss Predictor** | Transformer | <10ยตs | Predicts packet loss 50-100ms ahead |
| **Congestion Control** | PPO (continuous) | <1ยตs | Optimal CWND via lookup + ML fallback |
| **Compression Oracle** | Entropy heuristics | <1ยตs | Skip already-compressed data |
| **Path Selector** | UCB1 bandit | <1ยตs | Learns best path per traffic type |
| **FEC Decision** | Lookup table | <100ns | Optimal redundancy ratio |

**Performance Benchmarks:**
```
โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—
โ•‘ ML ENGINE BENCHMARKS โ•‘
โ• โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•ฃ
โ•‘ Lookup Table Hit: <100ns (90%+ of decisions) โ•‘
โ•‘ Live ML Inference: <1ยตs (candle optimized) โ•‘
โ•‘ Transformer: <10ยตs (loss prediction) โ•‘
โ•‘ Online Learning: Continuous (no restart) โ•‘
โ•‘ Table Refresh: Hourly (from observations) โ•‘
โ•‘ Memory Footprint: <10MB (all models + tables) โ•‘
โ•‘ Observation Buffer: 100K samples (circular) โ•‘
โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
```

**Advanced ML Features (Scale-Ready):**
| Feature | Purpose | Latency Impact | When Needed |
|---------|---------|----------------|-------------|
| **Federated Learning** | Privacy-preserving aggregation with DP | Async | Multi-server |
| **Multi-agent RL** | Distributed congestion control | ~50ยตs/action | Multi-flow |
| **A/B Testing** | Statistical model deployment experiments | ~1ยตs | Always |

See [ADVANCED_ML.md](docs/ADVANCED_ML.md) and [DEEP_LEARNING.md](docs/DEEP_LEARNING.md) for detailed documentation.

**Gaming Ports (QUIC Datagrams):**
| Platform | Ports |
|----------|-------|
| Xbox Live | 3074, 3478-3480 |
| PlayStation | 3658-3659 |
| Steam/Valve | 27015-27017 |
| Unreal Engine | 7777-7779 |
| VoIP/SIP | 5060-5061 |

**Bypass Domains (Direct, Your IP):**
Netflix, Disney+, Hulu, Prime Video, HBO Max, Spotify - automatically bypassed so streaming services see your residential IP.

### ๐Ÿ“ฆ Compression (Pure Rust, Enabled by Default)
- **Parallel LZ4 Compression** - Multi-threaded compression scales with CPU cores (10+ Gbps)
- **Per-Connection Dictionaries** - Learns per-flow patterns for 20-40% better compression
- **ROHC Header Compression** - 44% size reduction for UDP/IP headers
- UDP, TCP, IP, RTP, ESP, IPv6 profiles
- Fast state transitions (IR โ†’ FO โ†’ SO in 5 packets vs standard 10)
- LRU context eviction for inactive flows
- W-LSB delta encoding for sequence numbers
- **Enabled by default** - no configuration needed
- **SIMD-Accelerated** - AVX2/NEON when available
- **Intelligent Selection** - Automatically chooses best compression per packet
- **Smart Entropy Detection** - Shannon entropy + magic byte detection skips encrypted/compressed data
- Detects gzip, ZIP, LZ4, Zstd, TLS records, JPEG, PNG, MP4
- Entropy threshold: >7.5 bits/byte = skip compression

**ROHC Performance Impact:**
| Traffic Type | Without ROHC | With ROHC | Savings |
|--------------|--------------|-----------|--------|
| UDP Gaming (64B) | 62% header overhead | 3% | **59%** |
| VoIP RTP (160B) | 25% header overhead | 1% | **24%** |
| SSH keystrokes (80B) | 75% header overhead | 10% | **65%** |

### ๐Ÿ”’ Security & DDoS Protection
- **TLS 1.3** - Real certificate support with Let's Encrypt
- **Per-IP Rate Limiting** - Connection, PPS, and bandwidth limits
- **Auto-blocking** - Automatic IP blocking after violations
- **QUIC Security** - Stateless retry, address validation, anti-amplification
- **Connection Multiplexing** - Thousands of concurrent flows

### ๐ŸŒ Infrastructure & Resilience
- **Connection Migration** - Seamless WiFi โ†” LTE handoff
- **Multi-Server Ready** - Relay mesh for scaling when needed
- **Predictive Prefetching** - DNS and connection pre-warming
- **Health Monitoring** - Automatic failover on relay issues

### ๐Ÿš€ Server-to-Internet Optimizations
The relay server optimizes traffic from server to destination (your game server, websites, etc.):

| Optimization | Benefit | Implementation |
|--------------|---------|----------------|
| **BBR Congestion Control** | 2-25x better throughput on lossy links | `tcp_congestion_control = bbr` |
| **TCP Fast Open** | -1 RTT on repeat connections | `tcp_fastopen = 3` |
| **UDP GSO/GRO** | 64 packets per syscall | Kernel 4.18+ |
| **ECN (RFC 9000)** | Congestion signals without loss | DCTCP-style response |
| **Jumbo Frames** | 9000 MTU on datacenter NICs | Reduces header overhead |
| **NUMA-Aware** | Memory close to CPU | <100ns memory access |
| **Peering** | Direct routes to game servers | Latitude.sh Chicago |

**Server Kernel Tuning (Applied Automatically):**
```
net.core.rmem_max = 268MB # Large receive buffers
net.core.wmem_max = 268MB # Large send buffers
net.core.netdev_max_backlog = 500K # Handle burst traffic
net.ipv4.tcp_congestion_control = bbr # Google BBR
net.ipv4.tcp_fastopen = 3 # Client + server TFO
```

**Why This Matters:**
```
Without optimization: Server โ†’ 5 hops โ†’ ISP peering โ†’ 8 hops โ†’ Game Server
With Oxidize: Server โ†’ 2 hops โ†’ Direct peering โ†’ Game Server
(Latitude.sh has direct peering with major gaming networks)
```

### ๐Ÿ“Š Observability
- **Prometheus Metrics** - Latency, throughput, compression ratios
- **Speed Test** - Built-in benchmarking with JSON output

## Speed Test

Test your connection improvement before committing:

```bash
# Human-readable results
oxidize-client --server SERVER_IP:4433 --speedtest

# JSON output for scripting
oxidize-client --server SERVER_IP:4433 --speedtest --json
```

Sample output:
```
โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—
โ•‘ Oxidize Speed Test Results โ•‘
โ• โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•ฃ
โ•‘ Direct Via Relay Improvement โ•‘
โ• โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•ฃ
โ•‘ Latency (ms): 45.2 38.1 +15.7% โ•‘
โ•‘ Download (Mbps): 85.2 92.4 +8.5% โ•‘
โ•‘ Upload (Mbps): 42.1 48.7 +15.7% โ•‘
โ•‘ Jitter (ms): 12.3 4.2 +65.9% โ•‘
โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•

โœจ Summary: Oxidize provides 16% better latency, 8% better download speed
```

## Quick Start

### One-Click Client Install

```bash
# Install and auto-start (defaults to relay.oxd.sh:4433)
curl -fsSL https://raw.githubusercontent.com/gagansuie/oxidize/main/install.sh | sudo bash
```

```bash
# Or specify a custom server
curl -fsSL https://raw.githubusercontent.com/gagansuie/oxidize/main/install.sh | sudo bash -s -- relay.oxd.sh:4433
```

The installer handles everything: downloads binary, configures service, and starts automatically.

> **Review the script:** [install.sh](install.sh)

### Build from Source

```bash
# Build
cargo build --release

# Run server (on your relay server)
./target/release/oxidize-server --listen 0.0.0.0:4433

# Run client (defaults to relay.oxd.sh:4433)
./target/release/oxidize-client

# Or specify a custom server
./target/release/oxidize-client --server relay.oxd.sh:4433

# Run speed test
./target/release/oxidize-client --speedtest
```

## Configuration

Create `config.toml`:

```toml
max_connections = 10000
enable_compression = true
enable_tcp_acceleration = true
rate_limit_per_ip = 100

# ROHC header compression (enabled by default)
enable_rohc = true
rohc_max_size = 1400

# Congestion control (adaptive_ml, cubic, gaming)
congestion_algorithm = "adaptive_ml"

# Priority scheduling
enable_priority_scheduler = true

# Performance optimizations are always enabled:
# - Zero-copy buffer pooling
# - Lock-free stream handling
# - ACK batching (8 per batch)
# - Latency instrumentation
```

### Feature Interactions

| Feature Combo | Interaction | Status |
|--------------|-------------|--------|
| FEC + Compression | FEC adds redundancy before compression | โœ… Auto-adapts |
| ROHC + Small Packets | ROHC best for <200B packets | โœ… Auto-selects per packet |
| Zero-copy + Compression | Compression into pooled buffer | โœ… No conflict |
| Priority Scheduler + ACK Batching | Real-time traffic prioritized | โœ… ACKs respect priority |

## Real-World Performance

### ๐ŸŽฏ Relay Overhead: 0.004%

```
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ PERFORMANCE BREAKDOWN โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ Per-packet processing: 0.7ยตs (with ML inference) โ”‚
โ”‚ Concurrent users: 10,000 - 50,000 per instance โ”‚
โ”‚ PPS capacity: ~100K packets/sec โ”‚
โ”‚ Memory footprint: <100 MB โ”‚
โ”‚ โ”‚
โ”‚ Verdict: PRODUCTION READY โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
```

### ๐ŸŽฎ Gaming Overhead Analysis

| Workload | Tick Rate | Tick Period | Oxidize Overhead |
|----------|-----------|-------------|------------------|
| Competitive FPS | 128 Hz | 7.8ms | **0.009%** |
| Standard Gaming | 64 Hz | 15.6ms | **0.004%** |
| VoIP (20ms frames) | 50 Hz | 20ms | **0.0035%** |
| Video Streaming | 60 Hz | 16.7ms | **0.004%** |

**Why it matters:** Batching and QUIC datagrams eliminate latency *spikes* - the micro-stutters from syscalls and head-of-line blocking that ruin gaming feel.

### When Oxidize Helps

- Mobile networks: +30-50% improvement (packet loss handling)
- Congested ISPs: +40-60% improvement (better routing)
- Gaming: +20-40% improvement (stable latency)
- API-heavy apps: +50-70% improvement (compression + multiplexing)

### When It Won't

- Already-optimal fiber connections
- Video streaming (already compressed)
- Local network traffic

**Honest benchmarks, no marketing BS.**

## Production Ready

โœ… TLS 1.3 ย ยทย  โœ… Rate limiting ย ยทย  โœ… Prometheus metrics ย ยทย  โœ… DDoS protection ย ยทย  โœ… 230+ tests ย ยทย  โœ… Zero external deps

### โœ… Implemented Features Summary

| Category | Feature | Status |
|----------|---------|--------|
| **Protocol** | OxTunnel (unified cross-platform) | โœ… Implemented |
| **Protocol** | V2 Variable Headers (4B avg) | โœ… Implemented |
| **Protocol** | QUIC Datagrams (gaming/VoIP) | โœ… Implemented |
| **Protocol** | 0-RTT Session Resumption | โœ… Implemented |
| **Transport** | QUIC Primary + UDP Fallback | โœ… Implemented |
| **Transport** | Connection Migration (WiFiโ†”LTE) | โœ… Implemented |
| **Transport** | Multi-path Aggregation | โœ… Implemented |
| **Kernel Bypass** | AF_XDP/XDP (10-25 Gbps) | โœ… Implemented |
| **Compression** | LZ4 (~4 GB/s) | โœ… Implemented |
| **Compression** | ROHC Headers (44% reduction) | โœ… Implemented |
| **Compression** | Per-Connection Dictionaries | โœ… Implemented |
| **ML Engine** | Transformer Loss Predictor | โœ… Implemented |
| **ML Engine** | PPO Congestion Controller | โœ… Implemented |
| **ML Engine** | Speculative Pre-computation | โœ… Implemented |
| **ML Engine** | UCB1 Path Selection | โœ… Implemented |
| **Congestion** | Adaptive ML (online learning) | โœ… Implemented |
| **Congestion** | ML-Augmented Pacing | โœ… Implemented |
| **Multipath** | MPTCP-style Redundancy | โœ… Implemented |
| **Multipath** | ML Handoff Prediction (WiFiโ†’LTE) | โœ… Implemented |
| **Traffic** | Deep Packet Inspection | โœ… Implemented |
| **Traffic** | Application Fingerprinting | โœ… Implemented |
| **Protocol** | Trusted Network Detection | โœ… Implemented |
| **Protocol** | Dynamic Buffer Pool | โœ… Implemented |
| **Protocol** | NUMA-Aware Allocation | โœ… Implemented |
| **SIMD** | AVX-512/AVX2 Packet Parsing | โœ… Implemented |
| **FEC** | Adaptive Reed-Solomon | โœ… Implemented |
| **Security** | TLS 1.3 / Let's Encrypt | โœ… Implemented |
| **Security** | Rate Limiting / DDoS Protection | โœ… Implemented |
| **Observability** | Prometheus Metrics | โœ… Implemented |
| **Apps** | Desktop (Linux/macOS/Windows) | โœ… Implemented |
| **Apps** | Mobile (Android/iOS) | ๐Ÿšง Coming Soon |

## Monitoring

```bash
# Metrics endpoint
curl http://localhost:9090/metrics
```

**Latency Metrics:**
```
โ•‘ Avg Process Latency: 0.7ยตs # Per-packet processing time
โ•‘ Avg Forward Latency: 12.3ยตs # Time to forward to destination
โ•‘ Avg Encode Latency: 0.2ยตs # Message encoding time
โ•‘ Avg Decode Latency: 0.3ยตs # Message decoding time
```

Use these metrics to identify bottlenecks and tune `ack_batch_size` for your workload.

## Desktop App

The Oxidize desktop app provides a modern GUI for managing connections.

> **โš ๏ธ Daemon Required**: The desktop app requires the daemon to be installed for full traffic tunneling and IP protection. Install via Settings โ†’ Install Daemon.

### Features
- **Full IP Protection** - All traffic tunneled through relay, your real IP is hidden
- **Auto-connect** - Automatically connects to closest region on launch (configurable)
- **Closest Region Detection** - Uses IP geolocation + haversine distance to find optimal server
- **Server List** - Browse all available regions with status, latency, and server count
- **Connection Stats** - Real-time bytes sent/received and uptime
- **Launch at Startup** - Optional system startup integration

### Settings
| Setting | Description |
|---------|-------------|
| Launch at Startup | Start Oxidize when your computer boots |
| Auto-connect | Automatically connect to closest region on launch |
| Install Daemon | Required for connection - installs system service |

### macOS Security Prompt

macOS may show a security warning when opening unsigned apps:

> "Oxidize.app cannot be opened because the developer cannot be verified"

**Workaround:** Right-click the app โ†’ Select "Open" โ†’ Click "Open" in the dialog.

Or via Terminal: `xattr -cr /Applications/Oxidize.app`

---

## Mobile Apps

Native iOS and Android apps with the same core functionality as desktop.

### Download

| Platform | Store | Status |
|----------|-------|--------|
| **Android** | [Google Play Store](https://play.google.com/store/apps/details?id=sh.oxd.app) | Coming Soon |
| **iOS** | [Apple App Store](https://apps.apple.com/app/oxidize/id0000000000) | Coming Soon |

### Features
- **Same OxTunnel protocol** - Identical to desktop, unified codebase
- **VpnService (Android)** / **NEPacketTunnel (iOS)** - Native packet capture
- **Auto-connect** - Connect on launch (configurable)
- **Region selection** - Browse and select optimal servers
- **Connection stats** - Real-time bandwidth and latency

### Mobile-Specific Notes
- **No daemon required** - Mobile uses native VPN APIs
- **Battery optimized** - Efficient QUIC transport
- **Background support** - Stays connected when app is backgrounded

### Development

Mobile apps are built with [Tauri](https://tauri.app/) and deploy via [Fastlane](https://fastlane.tools/):

```bash
# Android (requires Android SDK + NDK)
cd app && npx tauri android build

# iOS (requires macOS + Xcode)
cd app && npx tauri ios init && npx tauri ios build
```

For deployment setup, see [MOBILE_DEPLOYMENT.md](docs/MOBILE_DEPLOYMENT.md).

---

## Daemon Management

The daemon runs **OxTunnel** - our unified protocol that captures packets via NFQUEUE and tunnels them over QUIC:

### How OxTunnel Works (Linux)
```
App Traffic โ†’ NFQUEUE (kernel) โ†’ OxTunnel Batching โ†’ QUIC Datagrams โ†’ Relay Server
โ†“ โ†“
TCP + UDP TCP: Connection proxy
captured UDP: Direct forward
```

### Features
- **Full traffic capture** - Intercepts **both TCP and UDP** at kernel level via NFQUEUE
- **TCP connection pooling** - Server maintains persistent TCP connections to destinations
- **UDP direct forwarding** - Low-latency UDP packet forwarding
- **64 packets/batch** - Reduces syscalls, improves throughput
- **QUIC datagrams** - Zero head-of-line blocking for gaming/VoIP
- **Pure userspace** - No kernel modules, no TUN devices
- **Same protocol as mobile** - Unified OxTunnel on all platforms

### Commands
```bash
# Check status
sudo systemctl status oxidize-daemon

# Start/Stop/Restart
sudo systemctl start oxidize-daemon
sudo systemctl stop oxidize-daemon
sudo systemctl restart oxidize-daemon

# View logs
sudo journalctl -u oxidize-daemon -f

# Manual run (for debugging)
sudo ./target/release/oxidize-daemon
```

### NFQUEUE iptables Rules
When connected, the daemon automatically configures rules for **both TCP and UDP**:
```bash
# Check active rules
sudo iptables -L OUTPUT -v -n --line-numbers

# Expected output shows both protocols captured:
# NFQUEUE udp -- 0.0.0.0/0 0.0.0.0/0 NFQUEUE num 0 bypass
# NFQUEUE tcp -- 0.0.0.0/0 0.0.0.0/0 NFQUEUE num 0 bypass
```

## Documentation

- [CHANGELOG.md](docs/CHANGELOG.md) - **Recent changes and removed modules**
- [OXTUNNEL.md](docs/OXTUNNEL.md) - OxTunnel protocol specification (replaces WireGuard)
- [DEEP_LEARNING.md](docs/DEEP_LEARNING.md) - Deep learning engine (Transformer, PPO, UCB1)
- [ADVANCED_ML.md](docs/ADVANCED_ML.md) - Scale-ready ML features (Federated Learning, Multi-agent RL, A/B Testing)
- [SECURITY.md](docs/SECURITY.md) - Security hardening & DDoS protection
- [VULTR_DEPLOYMENT.md](docs/vultr/VULTR_DEPLOYMENT.md) - Bare metal deployment guide
- [LATITUDE_DEPLOYMENT.md](docs/latitude/LATITUDE_DEPLOYMENT.md) - Latitude.sh deployment guide
- [ZERO-DOWNTIME.md](docs/ZERO-DOWNTIME.md) - Zero-downtime deployment

## Testing

```bash
cargo test --all
```

## Benchmarks

```bash
# Run performance benchmarks
cargo bench --package oxidize-common
```

**Sample Results:**
```
โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—
โ•‘ KEY BENCHMARKS โ•‘
โ• โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•ฃ
โ•‘ E2E Pipeline: 0.7ยตs per packet โ•‘
โ•‘ LZ4 Throughput: ~4 GB/s (native LZ4, 10+ Gbps) โ•‘
โ•‘ FEC Throughput: ~4321 MB/s (never a bottleneck) โ•‘
โ•‘ ROHC Compression: 44% size reduction โ•‘
โ•‘ Buffer Pool: 100% hit rate (zero allocs) โ•‘
โ•‘ Batch Efficiency: 2.6x speedup (fewer syscalls) โ•‘
โ•‘ Multipath Select: 9M ops/sec โ•‘
โ•‘ Sustained Load: 3M+ ops/sec (no degradation) โ•‘
โ•‘ Concurrent Users: 10,000 - 50,000 per instance โ•‘
โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
```

**ML Engine Benchmarks:**
```
โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—
โ•‘ ML INFERENCE BENCHMARKS โ•‘
โ• โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•ฃ
โ•‘ Transformer: <10ยตs inference (loss prediction) โ•‘
โ•‘ PPO Controller: <10ยตs inference (CWND optimization) โ•‘
โ•‘ Speculative Cache: <1ยตs hit (100 decisions pre-computed) โ•‘
โ•‘ Compression Oracle: <1ยตs (entropy-based heuristics) โ•‘
โ•‘ Path Selection: <1ยตs (UCB1 bandit) โ•‘
โ•‘ Cache Hit Rate: >95% (speculative pre-computation) โ•‘
โ•‘ Memory Footprint: <10MB (all models embedded) โ•‘
โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
```

**Kernel Bypass Mode (Bare Metal):**
```
โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—
โ•‘ KERNEL BYPASS BENCHMARKS (AF_XDP) โ•‘
โ• โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•ฃ
โ•‘ XDP Mode: 10-25 Gbps (event-driven, low power) โ•‘
โ•‘ Per-Packet Latency: <300ns (P99) โ•‘
โ•‘ Zero-Copy: No memcpy in hot path โ•‘
โ•‘ Lock-Free Rings: SPSC queues, no contention โ•‘
โ•‘ Batch Processing: 64 packets per burst โ•‘
โ•‘ CPU Pinning: Dedicated cores per queue โ•‘
โ•‘ NUMA Aware: Memory allocation close to CPU โ•‘
โ•‘ Huge Pages: 1GB/2MB pages for minimal TLB misses โ•‘
โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
```

> **Note:** AF_XDP kernel bypass requires the `xdp` feature and Linux kernel 5.4+.
> Event-driven architecture with no dedicated CPU cores needed. See deployment guides for setup.

## Uninstall

### Linux / macOS

```bash
curl -fsSL https://raw.githubusercontent.com/gagansuie/oxidize/main/scripts/uninstall.sh | sudo bash
```

### Windows (PowerShell as Admin)

```powershell
irm https://raw.githubusercontent.com/gagansuie/oxidize/main/scripts/uninstall-windows.ps1 | iex
```

### Options

```bash
# Linux/macOS
sudo ./scripts/uninstall.sh --repo /path/to/oxidize # Also clean local builds
./scripts/uninstall.sh --local-only # Only clean builds (no sudo)
```

```powershell
# Windows
.\scripts\uninstall-windows.ps1 -Repo C:\path\to\oxidize # Also clean local builds
.\scripts\uninstall-windows.ps1 -LocalOnly # Only clean builds
```

### What Gets Removed

| Component | Linux | macOS | Windows |
|-----------|-------|-------|---------|
| **Binaries** | `/usr/local/bin/oxidize-*` | Same | `%ProgramFiles%\Oxidize\` |
| **Services** | systemd units | launchd plist | Windows service |
| **Config** | `/etc/oxidize/` | Same | `%APPDATA%\Oxidize\` |
| **Desktop entries** | `.desktop` files | N/A | Start menu shortcuts |
| **App data** | `~/.local/share/com.oxidize.app` | `~/Library/Application Support/` | `%LOCALAPPDATA%\com.oxidize.app` |
| **Firewall** | iptables NFQUEUE | PF rules | Firewall rule + WinDivert |
| **Local builds** | `target/`, `node_modules/`, `gen/` | Same | Same |

> **Review the scripts:** [uninstall.sh](scripts/uninstall.sh) ยท [uninstall-windows.ps1](scripts/uninstall-windows.ps1)

## License

MIT OR Apache-2.0

---


Built with ๐Ÿฆ€ by gagansuie