Module ashpd::desktop::network_monitor[][src]

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::NetworkMonitorProxy;

async fn run() -> Result<(), ashpd::Error> {
    let connection = zbus::azync::Connection::new_session().await?;
    let proxy = NetworkMonitorProxy::new(&connection).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

NetworkMonitorProxy

The interface provides network status information to sandboxed applications. It is not a portal in the strict sense, since it does not involve user interaction. Applications are expected to use this interface indirectly, via a library API such as the GLib GNetworkMonitor interface.

NetworkStatus

The network status, composed of the availability, metered & connectivity

Enums

Connectivity

Host’s network activity