π xlink
π Table of Contents
- β¨ Features
- π― Use Cases
- π Quick Start
- π Documentation
- π¨ Examples
- ποΈ Architecture
- βοΈ Configuration
- π§ͺ Testing
- π Performance
- π Security
- πΊοΈ Roadmap
- π€ Contributing
- π License
- π Acknowledgments
β¨ Features
π― Core Features
- β Multi-Channel Communication - Supports LAN, WiFi, Bluetooth, Mesh, Memory, and Remote channels
- β End-to-End Encryption - X25519 key exchange with ChaCha20Poly1305 encryption
- β Group Messaging - Secure group chat with broadcast capabilities and TreeKem support
- β Stream Management - Handle large file transmission with automatic chunking and reassembly
β‘ Advanced Features
- π Smart Channel Routing - Intelligent channel selection based on device capabilities and network conditions
- π DoS Protection - Built-in rate limiting and abuse prevention
- π Metrics Collection - Real-time performance monitoring and diagnostics
- π§ Device Discovery - mDNS and BLE-based background device discovery
π‘ Communication Features
- Heartbeat Mechanism - Maintain connection health with periodic heartbeat messages
- Capability Detection - Automatic discovery of remote device capabilities
- Stream Handling - Automatic chunking and reassembly for large messages (>32KB)
- Priority Messaging - Support for high-priority message delivery
π‘οΈ Security Features
- X25519 Key Exchange - Secure key agreement protocol
- ChaCha20Poly1305 - Authenticated encryption for all messages
- Ed25519 Signatures - Message signing and verification
- HMAC/HKDF - Key derivation and message authentication
- Device Migration - Export and import SDK state for device transfer
π Channel Architecture
graph LR
A[Application] --> B[UnifiedPush SDK]
B --> C[Channel Router]
C --> D[LAN Channel]
C --> E[WiFi Channel]
C --> F[Bluetooth Channel]
C --> G[Mesh Channel]
C --> H[Memory Channel]
C --> I[Remote Channel]
D --> J[Network Layer]
E --> J
F --> J
G --> J
H --> J
I --> J
π― Use Cases
Perfect for office, home, or industrial environments where devices communicate over local networks without internet dependency.
use Arc;
use LanChannel;
use xLink;
let lan_channel: = new;
let sdk = new.await?;
sdk.start.await?;
Ideal for ad-hoc networks, IoT deployments, and scenarios where devices form peer-to-peer mesh networks.
use Arc;
use MeshChannel;
let mesh_channel: = new;
let sdk = new.await?;
Enterprise-grade encrypted group messaging with TreeKem forward secrecy and efficient broadcast.
use ;
let group_manager = sdk.group_manager;
group_manager.create_group.await?;
group_manager.broadcast_message.await?;
Automatic stream handling for large files and video streams with chunking and reassembly.
use MessagePayload;
let large_data = read?;
sdk.send.await?;
// Automatically uses stream transmission for data > 32KB
π Quick Start
Installation
π¦ Rust
[]
= "0.1"
π Required Features
[]
= { = "0.1", = ["full"] }
Basic Usage
π¬ 5-Minute Quick Start
Step 1: Define Device Capabilities
use ;
use HashSet;
let device_id = new;
let capabilities = DeviceCapabilities ;
Step 2: Create SDK Instance
use xLink;
use MemoryChannel;
let channel = new;
let sdk = new.await?;
sdk.start.await?;
use HashSet;
use Arc;
use MemoryChannel;
use ;
use xLink;
async
π Documentation
π Additional Resources
- π Tutorials - Step-by-step learning
- π§ Advanced Topics - Deep dive guides
- β FAQ - Frequently asked questions
- π Troubleshooting - Common issues
π¨ Examples
π‘ Real-world Examples
π Example 1: Simple Chat
Basic point-to-point messaging between two devices.
File: examples/simple_chat.rs
use MemoryChannel;
use ;
use xLink;
let sdk = new.await?;
sdk.start.await?;
sdk.send.await?;
π₯ Example 2: Group Chat
Secure group messaging with multiple participants.
File: examples/group_chat.rs
use GroupManager;
let group_manager = sdk.group_manager;
let group_id = group_manager.create_group.await?;
group_manager.broadcast_message.await?;
π Example 3: Channel Switching
Dynamic channel management and switching.
File: examples/channel_switching.rs
use WifiChannel;
use BluetoothChannel;
let wifi = new;
let bluetooth = new;
let sdk = new.await?;
π‘ Example 4: Background Discovery
Device discovery in background mode.
File: examples/background_discovery.rs
sdk.start.await?;
// Discovery runs automatically in background
// mDNS and BLE discovery are enabled by default
π± Example 5: Device Migration
Export and import SDK state for device transfer.
File: examples/device_migration.rs
let state = sdk.export_sdk_state?;
write?;
// On new device
let data = read?;
sdk.import_sdk_state?;
ποΈ Architecture
System Overview
graph TB
subgraph Application Layer
A[Application]
end
subgraph SDK Core
B[UnifiedPush SDK]
C[Channel Router]
D[Capability Manager]
E[Metrics Collector]
end
subgraph Communication Layer
F[LAN Channel]
G[WiFi Channel]
H[Bluetooth Channel]
I[Mesh Channel]
J[Memory Channel]
K[Remote Channel]
end
subgraph Security Layer
L[Crypto Engine]
M[TreeKem]
end
subgraph Services
N[Group Manager]
O[Heartbeat Manager]
P[Discovery Manager]
Q[Stream Manager]
end
subgraph Storage Layer
R[File Storage]
S[Memory Storage]
T[Distributed Storage]
end
A --> B
B --> C
B --> D
B --> E
C --> F
C --> G
C --> H
C --> I
C --> J
C --> K
C --> L
C --> M
B --> N
B --> O
B --> P
B --> Q
C --> R
C --> S
C --> T
| Component | Description | Status |
|---|---|---|
| UnifiedPush SDK | Main SDK entry point managing all components | β Stable |
| Channel Router | Intelligent routing based on capabilities and network | β Stable |
| Capability Manager | Device and channel capability detection and management | β Stable |
| Crypto Engine | X25519 key exchange, ChaCha20Poly1305 encryption | β Stable |
| TreeKem | Group key management with forward secrecy | β Stable |
| Group Manager | Group creation, membership, and broadcast | β Stable |
| Heartbeat Manager | Connection health monitoring | β Stable |
| Discovery Manager | mDNS and BLE device discovery | β Stable |
| Stream Manager | Large file chunking and reassembly | β Stable |
| Metrics Collector | Performance monitoring and diagnostics | β Stable |
βοΈ Configuration
ποΈ Configuration Options
Device Capabilities Configuration
use ;
let capabilities = DeviceCapabilities ;
Channel Configuration
| Channel Type | Description | Use Case |
|---|---|---|
Lan |
Local Area Network communication | Office, home networks |
WiFiDirect |
WiFi direct communication | Wireless direct connection |
BluetoothLE |
Bluetooth Low Energy | Short-range, low power |
BluetoothMesh |
Bluetooth Mesh networking | Multi-hop mesh, IoT |
Internet |
Cloud/Internet communication | Remote messaging |
Memory |
In-memory channel (testing) | Testing, IPC |
| Option | Type | Default | Description |
|---|---|---|---|
device_id |
UUID | Auto-generated | Unique device identifier |
device_type |
Enum | Required | Device type (Smartphone, Laptop, etc.) |
device_name |
String | Required | Human-readable device name |
supported_channels |
Set | Required | Set of supported channel types |
battery_level |
Option | None | Current battery percentage |
is_charging |
bool | false | Whether device is charging |
data_cost_sensitive |
bool | false | Optimize for data usage |
Compliance Configuration
use ComplianceConfig;
let compliance = ComplianceConfig ;
π§ͺ Testing
π― Test Coverage
# Run all tests
# Run specific test categories
# Run with coverage
# Run benchmarks
# Run specific test
| Category | Description | Files |
|---|---|---|
| Unit Tests | Core functionality tests | tests/unit_core.rs |
| Integration Tests | System integration tests | tests/integration_*.rs |
| Performance Tests | Benchmark tests | benches/performance.rs |
| DoS Protection | Security tests | tests/dos_protection_tests.rs |
| Memory Tests | Memory management tests | tests/test_memory_*.rs |
| Large File Tests | Stream handling tests | tests/large_file_transmission_tests.rs |
π Performance
β‘ Benchmark Results
Message Processing
Small messages (<1KB): ~10,000 ops/sec
Medium messages (1-32KB): ~5,000 ops/sec
Large messages (>32KB): ~1,000 ops/sec (streamed)
Latency (Memory Channel)
P50: 0.5ms
P95: 1.2ms
P99: 2.5ms
# Run benchmarks
# Available benchmarks:
# - bench_message_send: Message sending performance
# - bench_channel_router: Routing decision performance
# - bench_encryption: Encryption/decryption performance
# - bench_group_broadcast: Group broadcast performance
π Security
π‘οΈ Security Features
Cryptographic Primitives
| Operation | Algorithm | Purpose |
|---|---|---|
| Key Exchange | X25519 | Secure key agreement |
| Encryption | ChaCha20Poly1305 | Authenticated encryption |
| Signatures | Ed25519 | Message authentication |
| Key Derivation | HKDF-SHA256 | Key material derivation |
| Hashing | SHA-256 | Integrity verification |
Security Measures
- β Rate Limiting - 100 messages/second per device
- β Memory Safety - Zero-copy operations where possible
- β Session Management - Automatic session cleanup on drop
- β Device Migration - Encrypted state export/import
Reporting Security Issues
Please report security vulnerabilities to: security@example.com
πΊοΈ Roadmap
π― Development Timeline
gantt
title xlink Roadmap
dateFormat YYYY-MM
section Core Features
Multi-Channel Support :done, 2024-01, 2024-06
E2E Encryption :done, 2024-02, 2024-07
Group Messaging :active, 2024-05, 2024-10
section Advanced Features
Stream Management :active, 2024-06, 2024-11
Device Discovery :done, 2024-04, 2024-09
Performance Optimization :2024-10, 2025-02
section Platform Support
FFI Bindings :2024-08, 2025-01
Mobile Platform Support :2025-01, 2025-06
β Completed
- Core SDK architecture
- Multi-channel support (LAN, WiFi, Bluetooth, Mesh, Memory, Remote)
- End-to-end encryption (X25519, ChaCha20Poly1305)
- Device discovery (mDNS, BLE)
- Heartbeat mechanism
- DoS protection
- Metrics collection
- Unit and integration tests
π§ In Progress
- TreeKem group key management
- Stream optimization for large files
- Performance benchmarks
- FFI bindings for other languages
- Platform-specific optimizations
π Planned
- Mobile SDK (iOS, Android)
- Cloud relay service
- Admin dashboard
- Enterprise features
- Plugin system
π‘ Future Ideas
- Quantum-resistant encryption
- [] AI-powered channel selection
- Edge computing integration
- Blockchain-based identity
- Decentralized messaging
π€ Contributing
π We Love Contributors!
π Report Bugs
Found a bug? Create an Issue
π‘ Request Features
Have an idea? Start a Discussion
π§ Submit PRs
Want to contribute? Fork & PR
How to Contribute
- Fork the repository
- Clone your fork:
git clone https://github.com/yourusername/xlink.git - Create a branch:
git checkout -b feature/amazing-feature - Make your changes
- Test your changes:
cargo test --all-features - Commit your changes:
git commit -m 'Add amazing feature' - Push to branch:
git push origin feature/amazing-feature - Create a Pull Request
Code Style
- Follow Rust standard coding conventions (
cargo fmt) - Write comprehensive tests for new features
- Update documentation for API changes
- Add examples for new features
- Ensure all tests pass before submitting
π License
This project is licensed under the MIT License.
π Acknowledgments
Built With Amazing Tools
Special Thanks
-
π Dependencies - Built on these amazing projects:
- tokio - Async runtime
- dashmap - Concurrent HashMap
- x25519-dalek - X25519 key exchange
- chacha20poly1305 - Authenticated encryption
- serde - Serialization framework
-
π₯ Contributors - Thanks to all our amazing contributors!
-
π¬ Community - Special thanks to our community members
π Contact & Support
Stay Connected
π Support This Project
If you find this project useful, please consider giving it a βοΈ!
Built with β€οΈ by Kirky.X Kirky-X@outlook.com
Β© 2024 xlink. All rights reserved.