Project X originates from XTLS protocol, providing a set of network tools such as Xray-core and REALITY.
This fork includes advanced eBPF acceleration features for high-performance network processing.
- Zero-Copy/Splice Fast Forwarding (TCP): kernel-assisted direct copy when safe
- REALITY Handshake Optimization: intelligent session caching and 0-RTT acceleration
- XTLS Vision Acceleration: protocol-aware optimization, kernel-assisted hints
- TCP Options Orchestration: QUICKACK/NOTSENT_LOWAT/zerocopy (best-effort)
- DNS Accelerator: kernel/fast-path cache with userspace merge; short-TTL prefetch
- GeoIP/GeoSite Matching: kernel-assisted route hints
- Lightweight Connection Tracking: hot-path recognition & stats
- Single switch:
XRAY_EBPF=1
turns on all eBPF-related optimizations; unset to disable and fall back - Failure-tolerant: if kernel/programs unavailable, userspace fallback is automatic
- Transparent: no config-file changes are required
- TCP+REALITY Acceleration: Up to 40% latency reduction
- XTLS Vision Optimization: 30-50% throughput improvement
- DNS Kernel Cache: 90%+ DNS query acceleration
- Zero-Copy Forwarding: Eliminates memory copy overhead
- Smart Route Matching: Kernel-level GeoIP/GeoSite matching
# Build eBPF-enabled Xray
./build-and-deploy.sh
# Deploy to server
rsync -r build/ root@your-server:/root/xray-ebpf/
ssh root@your-server 'cd /root/xray-ebpf && bash deploy.sh'
# Enable all eBPF-related optimizations
export XRAY_EBPF=1
./xray-linux-amd64-ebpf run -config config.json
# Check eBPF programs
bpftool prog list | grep xdp
# Check eBPF maps
bpftool map list | grep xdp
# Check service status
systemctl status xray
- Linux Kernel: 5.8+ with BPF capabilities
- Dependencies: clang, llvm, bpftool, libbpf-dev
- Architecture: AMD64 (primary), ARM64 (experimental)
# Enable all eBPF optimizations
export XRAY_EBPF=1
# Optional: debug logs
export XRAY_EBPF_DEBUG=1
# Optional: TCP socket tuning (best-effort)
export XRAY_SO_ZEROCOPY=1
export XRAY_SO_ZEROCOPY_DRAIN=1
export XRAY_TCP_NOTSENT_LOWAT=65536
export XRAY_TCP_QUICKACK=1
The eBPF acceleration is transparent - no configuration changes required. All existing Xray configurations work unchanged.
# View program statistics
bpftool prog show
# View map contents
bpftool map dump name dns_cache
bpftool map dump name tcp_connections
- Connection acceleration rate
- DNS cache hit ratio
- Splice/zerocopy count
- Congestion control statistics
- Full Security Preservation: All Xray security features maintained
- REALITY Verification: Strict TLS handshake verification
- 0-RTT Support: Complete 0-RTT functionality preserved
- Transparent Operation: No security compromises
-
eBPF Program Load Failure
- Check kernel version:
uname -r
- Verify BPF support:
ls /sys/fs/bpf/
- Check dependencies:
which bpftool
- Check kernel version:
-
Permission Denied
- Run as root:
sudo bash deploy.sh
- Check capabilities:
getcap /usr/local/bin/xray
- Run as root:
-
Performance Issues
- Verify eBPF programs loaded:
bpftool prog list | grep xray
- Check system logs:
journalctl -u xray
- Verify eBPF programs loaded:
# Enable debug logging
export XRAY_EBPF_DEBUG=1
export XRAY_LOG_LEVEL=debug
├── app/
│ ├── dns/ebpf/ # DNS kernel cache
│ ├── router/ebpf/ # GeoIP/GeoSite matching
│ └── stats/ebpf/ # Statistics collection
├── transport/
│ └── internet/
│ ├── ebpf/ # General acceleration
│ └── tcp/ebpf/ # TCP optimizations
├── proxy/ebpf/ # Proxy layer acceleration
├── build-and-deploy.sh # Build script
└── build/ # Build output
├── mount-ebpf.sh # eBPF mounting script
├── deploy.sh # Deployment script
└── README.md # Deployment guide
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
Mozilla Public License Version 2.0
Note: This is an enhanced fork of Xray-core with eBPF acceleration. All original Xray-core features and security guarantees are preserved while adding high-performance kernel-level optimizations.