#connection #tcp #tokio #async #up

online

๐Ÿ“ถ Library to check your Internet connectivity

13 releases (7 stable)

4.0.1 Mar 10, 2023
4.0.0 Sep 20, 2022
3.0.2 Sep 4, 2022
3.0.1 Jun 26, 2021
0.2.0 May 21, 2019

#104 in Network programming

Download history 4068/week @ 2023-02-10 4102/week @ 2023-02-17 3011/week @ 2023-02-24 4500/week @ 2023-03-03 4889/week @ 2023-03-10 4809/week @ 2023-03-17 5241/week @ 2023-03-24 5509/week @ 2023-03-31 3493/week @ 2023-04-07 4686/week @ 2023-04-14 5784/week @ 2023-04-21 4638/week @ 2023-04-28 3687/week @ 2023-05-05 4658/week @ 2023-05-12 6303/week @ 2023-05-19 2939/week @ 2023-05-26

18,475 downloads per month
Used in 8 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());
cargo run --example sync
cargo run --features="tokio-runtime" --example tokio

Dependencies

~0โ€“5MB
~73K SLoC