Expand description
§Cloud Detect
A library to detect the cloud service provider of a host.
§Usage
Add the following to your Cargo.toml:
[dependencies]
# ...
cloud_detect = "2"
tokio = { version = "1", features = ["full"] }
tracing-subscriber = { version = "0.3", features = ["env-filter"] } # Optional; for logging§Examples
Detect the cloud provider and print the result (with default timeout).
use cloud_detect::detect;
#[tokio::main]
async fn main() {
    tracing_subscriber::fmt::init(); // Optional; for logging
    let provider = detect(None).await;
    println!("Detected provider: {}", provider);
}Detect the cloud provider and print the result (with custom timeout).
use cloud_detect::detect;
#[tokio::main]
async fn main() {
    tracing_subscriber::fmt::init(); // Optional; for logging
    let provider = detect(Some(10)).await;
    println!("Detected provider: {}", provider);
}Modules§
- blocking
- Blocking API for cloud provider detection.
Enums§
- ProviderId 
- Represents an identifier for a cloud service provider.
Constants§
- DEFAULT_DETECTION_ TIMEOUT 
- Maximum time allowed for detection.
Functions§
- detect
- Detects the host’s cloud provider.
- supported_providers 
- Returns a list of currently supported providers.