online
📶 Library to check your Internet connectivity
_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](https://crates.io/crates/online). In example,
through [cargo-edit](https://github.com/killercup/cargo-edit):
```sh
cargo add online
```
### Async
```toml
online = { version = "4.0.0", default-features = false, features = ["tokio"] }
```
## Use
📝 Please visit the [examples](examples) and [documentation](https://docs.rs/online)
to check the details.
```rust
use online::check;
println!("Online? {}", check(None).is_ok());
println!("Online (timeout)? {}", check(Some(5)).is_ok());
```
### Examples
```sh
cargo run --example sync
cargo run --features="tokio-runtime" --example tokio
```