#tokio #async #up #tcp

online

📶 Library to check your Internet connectivity

14 releases (8 stable)

4.0.2 Feb 14, 2024
4.0.1 Mar 10, 2023
4.0.0 Sep 20, 2022
3.0.2 Sep 4, 2022
0.2.0 May 21, 2019

#2022 in Network programming

Download history 1163/week @ 2025-12-25 1396/week @ 2026-01-01 1365/week @ 2026-01-08 2185/week @ 2026-01-15 1806/week @ 2026-01-22 1783/week @ 2026-01-29 1669/week @ 2026-02-05 2201/week @ 2026-02-12 2097/week @ 2026-02-19 2293/week @ 2026-02-26 2730/week @ 2026-03-05 2703/week @ 2026-03-12 2452/week @ 2026-03-19 5509/week @ 2026-03-26 2749/week @ 2026-04-02 3312/week @ 2026-04-09

14,728 downloads per month
Used in 9 crates

MIT license

8KB
87 lines

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

Dependencies

~0–2.4MB
~42K SLoC