online

Crates.ioonline
lib.rsonline
version4.0.2
sourcesrc
created_at2019-05-18 21:35:35.47974
updated_at2024-02-14 21:50:51.188055
description📶 Library to check your Internet connectivity
homepage
repositoryhttps://github.com/jesusprubio/online.git
max_upload_size
id135151
size15,837
Jesús Rubio (jesusprubio)

documentation

https://docs.rs/online

README

online

📶 Library to check your Internet connectivity

Logo

Workflow status Latest version

Features

  • Both asynchronous and blocking implementations.
  • IPv4 and IPv6 support.

How it works

  • Tries to connect to Chrome captive portal (using its domain name).
  • If fails, tries the Firefox one.
  • If both fail, the second error is returned to help with diagnostics.

Install

The library is available on crates.io. In example, through cargo-edit:

cargo add online

Async

online = { version = "4.0.0",  default-features = false, features = ["tokio"] }

Use

📝 Please visit the examples and documentation to check the details.

use online::check;

println!("Online? {}", check(None).is_ok());
println!("Online (timeout)? {}", check(Some(5)).is_ok());

Examples

cargo run --example sync
cargo run --features="tokio-runtime" --example tokio
Commit count: 87

cargo fmt