Module ashpd::desktop::network_monitor

source ·
Expand description

Check the status of the network on a user’s machine. Note This portal doesn’t work for sandboxed applications.

§Examples

use ashpd::desktop::network_monitor::NetworkMonitor;

async fn run() -> ashpd::Result<()> {
    let proxy = NetworkMonitor::new().await?;

    println!("{}", proxy.can_reach("www.google.com", 80).await?);
    println!("{}", proxy.is_available().await?);
    println!("{:#?}", proxy.connectivity().await?);
    println!("{}", proxy.is_metered().await?);
    println!("{:#?}", proxy.status().await?);

    Ok(())
}

Structs§

  • The interface provides network status information to sandboxed applications.
  • The network status, composed of the availability, metered & connectivity

Enums§