Welcome to the RustRay developer ecosystem. This guide provides technical deep-dives for developers looking to integrate RustRay into mobile apps, extend the core logic, or contribute to the transport layer.
RustRay is structured as a modular proxy core with a high-performance transport layer.
src/app/: Core application logic, routing, and stats management.src/transport/: Implementation of various transport protocols (TCP, QUIC, Flow-J, mDNS).src/protocols/: Application layer protocols (VLESS, VMess, Trojan).src/ffi/: UniFFI-based bindings for Android, iOS, and Desktop.src/api/: gRPC service implementations for remote management.
RustRay uses UniFFI to generate bindings for Kotlin (Android) and Swift (iOS).
EngineManager: The primary singleton for starting and stopping the engine.ConnectConfig: A simplified configuration structure used by mobile apps to initiate a connection without writing full JSON.SharedStatsBuffer: A C-compatible memory region where real-time stats are stored, allowing mobile UIs to read data without expensive string serialization.
let manager = EngineManager()
let config = ConnectConfig(
address: "1.2.3.4",
port: 443,
uuid: "...",
protocol: "flow-j"
)
let result = manager.startEngine(configJson: config.toJson(), callback: MyVpnCallback())To add a new transport (e.g., a new steganography method):
- Implement the
AsyncReadandAsyncWritetraits for your transport insrc/transport/. - Wrap it in a
TransportConnectorinsrc/transport/mod.rs. - Register the protocol tag in
src/config.rs.
RustRay uses eBPF for packet mutilation on Linux.
- The bytecode is located in
src/transport/ebpf/mutilator.c. - The loader logic is in
src/transport/ebpf/loader.rs. - Note: eBPF requires
CAP_NET_ADMINor root privileges.
Developers can manage a running RustRay instance via gRPC on port 10085 (default).
- HandlerService: Add/Remove users dynamically.
- StatsService: Query per-user or per-inbound bandwidth usage.
- LoggerService: Stream logs in real-time.
See GRPC_API_INTEGRATION.md for the full protobuf specification.
Always run the full suite before submitting PRs:
# Unit tests
cargo test
# Integration tests (requires network)
cargo test --test phase10_mesh_intelligence_test
# Smoke tests for gRPC
bash scripts/grpc_smoke_test.shFor more details, see TESTING_GUIDE.md.