righ-dm-rs

Crates.iorigh-dm-rs
lib.rsrigh-dm-rs
version0.5.0
created_at2025-10-24 11:22:18.423702+00
updated_at2025-10-24 11:22:18.423702+00
descriptionRigh Data Model Library
homepagehttps://www.righ.com
repository
max_upload_size
id1898310
size120,086
Xavier Qian (FancyQian)

documentation

README

Righ Data Model (righ-dm-rs)

A comprehensive Rust data model library for distributed mesh networking systems, providing strongly-typed data structures for network management, device configuration, and Wi-Fi operations.

Overview

This library defines the core data models used in the Righ distributed mesh networking platform. It provides type-safe representations of network entities, configurations, and operational data with comprehensive validation and serialization support.

Features

  • Strong Type System: Leverages Rust's type system for compile-time safety
  • Comprehensive Wi-Fi Support: Full support for Wi-Fi 4-7 standards, DFS, band steering, and security configurations
  • Network Management: MAC/IP address handling, interface management, and device categorization
  • Time Utilities: RFC 3339 timestamp handling with validation and comparison
  • Serialization Ready: Full serde support for JSON/YAML serialization
  • OpenAPI Integration: Schema generation for API documentation
  • Extensive Documentation: Comprehensive docs with examples and usage patterns

Core Modules

📡 Network (network.rs)

  • MAC Address Management: Validation, formatting, and utility functions
  • IP Address Handling: IPv4/IPv6 support with network validation
  • Network Utilities: Broadcast, unicast, and multicast detection

🆔 Identifiers (id.rs)

  • Node IDs: Unique identifiers for mesh network nodes
  • Model Names: Device model identification
  • Location IDs: Geographic and logical location tracking

📶 Wi-Fi Management (wifi.rs)

  • SSID Handling: Network name validation and management
  • Channel Management: DFS compliance, channel availability, and bandwidth
  • Security Configuration: WPA/WPA2/WPA3 support with key management
  • Band Steering: Client optimization across frequency bands
  • Neighbor Discovery: Access point scanning and reporting
  • Wi-Fi Standards: Support for 802.11n/ac/ax/be (Wi-Fi 4-7)

🔧 Device Management (common.rs)

  • Interface Configuration: Network interface management
  • Device Categories: Router, access point, client classification
  • Connection States: Link status and connectivity tracking
  • Uplink Management: WAN connection configuration

⏰ Time Utilities (time.rs)

  • RFC 3339 Timestamps: Standardized time representation
  • Time Validation: Format verification and range checking
  • Time Comparison: Before/after operations with epoch support

Quick Start

Add this to your Cargo.toml:

[dependencies]
righ-dm-rs = "0.1.0"

Basic Usage

use righ_dm_rs::*;

// Create a mesh node identifier
let node_id = RighNodeID::new("mesh-node-001");
println!("Node ID: {}", node_id);

// Configure a Wi-Fi network
let mut wifi_config = RighWifiConfig::default();
wifi_config.ssid = RighSSID::new("MyMeshNetwork".to_string());
wifi_config.id = Some(1);
println!("Is primary SSID: {}", wifi_config.is_primary_ssid());

// Create a network interface
let interface = RighIfName::new("wlan0");
println!("Interface: {}", interface);

// Handle MAC addresses
let mac = RighMacAddr::broadcast();
println!("Broadcast MAC: {}", mac);

Wi-Fi Channel Management

use righ_dm_rs::*;

// Create a 5GHz channel with 80MHz bandwidth
let channel = RighChannel::new(36);
let bandwidth = RighChannelWidth::RighChannel80Mhz;
let band = RighBand::RighBand5ghz;

// Check DFS requirements
if channel.is_dfs(&bandwidth) {
    println!("DFS monitoring required for channel {}", channel.id());
}

// Configure radio
let radio = RighRadio {
    name: RighIfName::new("radio0"),
    freq_band: band,
    channel,
    channel_width: bandwidth,
};

Architecture

The library follows a modular design with clear separation of concerns:

righ-dm-rs/
├── src/
│   ├── lib.rs          # Library root and re-exports
│   ├── id.rs           # Node and device identifiers
│   ├── network.rs      # Network address management
│   ├── common.rs       # Device and interface management
│   ├── time.rs         # Time utilities and validation
│   └── wifi.rs         # Wi-Fi configuration and management
└── examples/           # Usage examples

Data Model Highlights

Type Safety

  • All identifiers are strongly typed (no string confusion)
  • Compile-time validation of network configurations
  • Comprehensive error handling with anyhow

Wi-Fi Standards Support

  • Wi-Fi 4 (802.11n): 2.4/5GHz, up to 600 Mbps
  • Wi-Fi 5 (802.11ac): 5GHz, up to 3.5 Gbps
  • Wi-Fi 6 (802.11ax): 2.4/5GHz, up to 9.6 Gbps
  • Wi-Fi 6E (802.11ax): 6GHz support
  • Wi-Fi 7 (802.11be): 320MHz channels, up to 46 Gbps

Security Features

  • WPA3 SAE (Simultaneous Authentication of Equals)
  • WPA2/WPA3 transition modes
  • Protected Management Frames (PMF)
  • Multiple PSK support
  • Access Control Lists (ACL)

Development

Building

cargo build

Testing

# Run all tests
cargo test

# Run documentation tests
cargo test --doc

# Generate documentation
cargo doc --open

Code Quality

The project maintains high code quality standards:

  • Comprehensive documentation with examples
  • All public APIs documented
  • Rust idioms and best practices
  • Extensive test coverage

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Add tests for new functionality
  4. Ensure all tests pass
  5. Update documentation
  6. Submit a pull request

License

This project is licensed under the MIT License - see the LICENSE file for details.

About Righ

This library is part of the Righ distributed mesh networking platform. For more information about Righ's networking solutions, visit righ.com.


Note: This is a data model library focused on type safety and validation. For runtime mesh networking functionality, see the companion libraries in the Righ ecosystem.

Commit count: 0

cargo fmt