Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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. Simply add the next line to your project's Cargo.toml.

online = "3.0.1"

Synchronous

The async-std runtime is supported by default. But you can explicitly choose the blocking alternative.

online = { version = "3.0.1",  default-features = false, features = ["sync"] }

Use

๐Ÿ“ Please visit the examples and the full documentation if you want to learn the details.

use online::check;

#[async_std::main]
async fn main() {
    println!("Online? {}", check(None).await.is_ok());
    println!("Online (timeout)? {}", check(Some(5)).await.is_ok());
    println!("Online (`Result`)? {:?}", check(None).await.unwrap());
}

About

๐Ÿ“ถ Library to check your Internet connectivity

Resources

License

Packages

No packages published

Languages