7 releases

0.7.0-pre.1 Jan 28, 2024
0.6.1 Jan 28, 2024
0.5.3 Jan 28, 2024

#252 in Unix APIs

Download history 23/week @ 2024-01-25 1/week @ 2024-02-01 18/week @ 2024-02-15 107/week @ 2024-02-22 23/week @ 2024-02-29 6/week @ 2024-03-07 3/week @ 2024-03-14 10/week @ 2024-03-21 41/week @ 2024-03-28 28/week @ 2024-04-04 9/week @ 2024-04-11

89 downloads per month
Used in bestool

MIT/Apache

320KB
6.5K SLoC

NetworkManager bindings for Rust (fork)

Fork by @passcod to rewrite a few APIs to be more ergonomic.

NetworkManager bindings for Rust using the D-Bus message bus system

Status

This project is still under development. Currently implemented parts can be found in the docs.

  • NetworkManager D-Bus API >= v1.42.2

Usage

Add networkmanager to your Cargo.toml with:

[dependencies]
networkmanager = { package = "passcod-networkmanager", version = "=0.7.0-pre.1" }
tokio = { version = "1", features = ["full"] }

Example

use networkmanager::{Error, NetworkManager};

#[tokio::main]
async fn main() -> Result<(), Error> {
    let nm = NetworkManager::new().await?;

    for dev in nm.get_devices().await? {
        if let Some(wifi) = dev.to_wireless().await? {
            println!("Bitrate: {:?}", wifi.bitrate().await?);
            wifi.request_scan().await?;
            for ap in wifi.get_all_access_points().await? {
                let raw = ap.ssid().await?;
                println!("SSID: {} {raw:02x?}", String::from_utf8_lossy(&raw));
            }
        }
    }

    Ok(())
}

Build prerequisites

  • Debian and its derivatives (e.g. Ubuntu)

    • network-manager
    • libdbus-1-dev
    • pkg-config
  • Fedora

    • NetworkManager
    • dbus-devel
    • pkg-config

Todo

  • Implementations
    • Devices
      • Top level
      • Generic
      • Wireless
      • Wired
      • ADSL
      • Bluetooth
      • Bond
      • Bridge
      • Dummy
      • Infiniband
      • IpTunnel
      • Lowpan
      • Macsec
      • MacVLAN
      • Modem
      • OLPCMesh
      • OVSBridge
      • OVSInterface
      • OVSPort
      • PPP
      • Statistics
      • Team
      • TUN/TAP
      • VETH
      • VLAN
      • VRF
      • VXLAN
      • WifiP2P
      • WiMax
      • Wireguard
      • Wpan
    • Configs
      • IP4
      • IP6
      • DHCP4
      • DHCP6
    • Accesspoint
    • ConnectionActive
    • NetworkManager (partially implemented)
    • AgentManager
    • Checkpoint
    • DNSManager
    • PPP
    • SecretAgent
    • Settings
    • Settings Connection
    • VPN Connection
    • VPN Plugin
    • WifiP2P
    • Wimax NSP

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~12–26MB
~367K SLoC