Introduction
Welcome to the nmrs documentation! This guide will help you understand and use nmrs, a powerful Rust library for managing network connections on Linux via NetworkManager.
What is nmrs?
nmrs is a high-level, async Rust API for NetworkManager over D-Bus. It provides:
- Simple WiFi Management - Scan, connect, and manage wireless networks
- VPN Support - WireGuard and OpenVPN VPN support
- Ethernet Control - Manage wired network connections
- Bluetooth - Connect to Bluetooth network devices
- Real-Time Monitoring - Event-driven network state updates
- Type Safety - Comprehensive error handling with specific failure reasons
- Async/Await - Built on modern async Rust with runtime flexibility
Why nmrs?
- Safe Abstractions - No unsafe code, leveraging Rust's type system
- Async-First - Built for modern async Rust applications
- Signal-Based - Efficient D-Bus signal monitoring instead of polling
- Well-Documented - Comprehensive docs with examples for every feature
- Runtime Agnostic - Works with Tokio, async-std, smol, and more
Quick Example
Here's a taste of what nmrs can do:
use nmrs::{NetworkManager, WifiSecurity}; #[tokio::main] async fn main() -> nmrs::Result<()> { let nm = NetworkManager::new().await?; // Scan for networks let networks = nm.list_networks(None).await?; for net in networks { println!("{} - {}%", net.ssid, net.strength.unwrap_or(0)); } // Connect to a network nm.connect("MyWiFi", None, WifiSecurity::WpaPsk { psk: "password123".into() }).await?; Ok(()) }
Community
- Discord: Join our Discord server to chat with developers and users
- GitHub: Report issues, contribute, or browse the code at github.com/cachebag/nmrs
- Crates.io: Install from crates.io/crates/nmrs
- API Docs: Full API reference at docs.rs/nmrs
License
nmrs is dual-licensed under MIT and Apache 2.0, giving you flexibility in how you use it.
Ready to get started? Head to the Installation guide!