Remnawave Rust SDK
A 🚀 blazingly fast high-performance Rust SDK for interacting with the Remnawave API. This library provides a type-safe, async interface for managing and monitoring your Remnawave server, including user management, subscription handling, node monitoring, and comprehensive statistics.
Features
- Type-safe Rust API - Leveraging Rust's type system for compile-time guarantees
- Async/Await Support - Built on
tokioandreqwestfor high-performance async operations - Controller-based Architecture - Organized API endpoints into logical controllers
- Comprehensive Management - Users, subscriptions, nodes, hosts, billing, and more
- Error Handling - Detailed error types with context and debugging information
- Rich Type Definitions - Complete request/response DTOs with serde support
Installation
Add this to your Cargo.toml:
[]
= "2.2.4" # or { version = "2.2.4", features = ["native-tls"] }
= { = "1.0", = ["full"] }
Or install via cargo:
Quick Start
use RemnawaveApiClient;
use Result;
async
Core Features
User Management
use ;
use Uuid;
// Create a new user
let new_user = CreateUserRequestDto ;
let user = client.users.create_user.await?;
// Get user by UUID
let user_uuid = parse_str?;
let user = client.users.get_user_by_uuid.await?;
// Update user
let update_data = UpdateUserRequestDto ;
let updated_user = client.users.update_user.await?;
// Bulk operations
let bulk_delete = client.users.bulk_delete_users.await?;
let bulk_update = client.users.bulk_update_users.await?;
Subscription Management
// Get all subscriptions
let subscriptions = client.subscriptions.get_all_subscriptions.await?;
// Get subscription by username
let subscription = client.subscriptions.get_subscription_by_username.await?;
// Get subscription settings
let settings = client.subscription_settings.get_subscription_settings.await?;
// Update subscription settings
let new_settings = UpdateSubscriptionSettingsRequestDto ;
client.subscription_settings.update_subscription_settings.await?;
Node and Host Management
// Get all nodes
let nodes = client.nodes.get_all_nodes.await?;
// Get node statistics
let node_stats = client.nodes.get_nodes_statistics.await?;
// Get real-time usage
let realtime_usage = client.nodes.get_nodes_realtime_usage.await?;
// Restart a node
let node_uuid = parse_str?;
client.nodes.restart_node.await?;
// Host management
let hosts = client.hosts.get_all_hosts.await?;
let host = client.hosts.get_one_host.await?;
Authentication
use ;
// Login
let login_request = LoginRequestDto ;
let login_response = client.auth.login.await?;
// Register (if enabled)
let register_request = RegisterRequestDto ;
let register_response = client.auth.register.await?;
API Reference
RemnawaveApiClient
Main client struct for interacting with the Remnawave API.
Available Controllers
| Controller | Description |
|---|---|
auth |
Authentication operations |
users |
User management |
subscriptions |
Subscription handling |
subscription_templates |
Subscription template management |
subscription_settings |
Subscription settings |
nodes |
Node management |
nodes_usage |
Node usage statistics |
hosts |
Host management |
system |
System operations |
tokens |
API token management |
config_profiles |
Configuration profiles |
internal_squads |
Internal squad management |
hwid |
Hardware ID devices |
billing |
Infrastructure billing |
keygen |
Key generation |
Bulk Operations
The SDK supports efficient bulk operations for user management:
// Bulk delete users by status
let bulk_delete_request = BulkDeleteUsersByStatusRequestDto ;
client.users.bulk_delete_users_by_status.await?;
// Bulk update users
let bulk_update_request = BulkUpdateUsersRequestDto ;
client.users.bulk_update_users.await?;
// Bulk reset traffic
let reset_request = BulkResetTrafficUsersRequestDto ;
client.users.bulk_reset_user_traffic.await?;
Usage Statistics
use ;
// Required: RFC3339 DateTime strings (seconds precision, Z suffix)
let end = now.to_rfc3339_opts;
let start = .to_rfc3339_opts;
// Nodes usage by range
let usage = client
.nodes_usage
.get_usage_by_range
.await?;
// Node user usage by range
let node_user_usage = client
.nodes_usage
.get_user_usage
.await?;
// User usage by range
let user_usage = client
.users
.get_usage_by_range
.await?;
Subscription links (raw text)
Some subscription endpoints return plaintext (not JSON). The SDK exposes these as String:
use SubscriptionClientType;
let short_uuid = "abc123".to_string;
let all_clients_text = client.subscriptions.get.await?; // String
let clash_text = client
.subscriptions
.get_by_client_type
.await?; // String
Error Handling
The SDK provides comprehensive error handling through the ApiError type:
use ApiError;
match client.users.get_user_by_uuid.await
Configuration
Client Configuration
// With token
let client = new?;
// Without token
let client = new?;
// With token and Caddy API key
let client = with_caddy_token?;
// Update token later
client.set_token;
// Update Caddy token later
client.set_caddy_token;
Contributors
We ❤️🔥 contributors! If you'd like to contribute, feel free to submit a pull request or open an issue.
Check open issues to help the progress of this project.
License
MIT License