cloud-detect
A Rust library to detect the cloud service provider of a host.
This library is inspired by the Python-based cloud-detect and the Go-based satellite modules.
Like these modules, cloud-detect uses a combination of checking vendor files and metadata endpoints to accurately
determine the cloud provider of a host.
License
This crate is dual-licensed under the GPL 3.0 (see LICENSE-GPL-3.0) or MIT (see LICENSE-MIT).
You can choose between them if you use this crate.
SPDX-License-Identifier: GPL-3.0 OR MIT
Features
- Currently, this module supports the identification of the following providers:
- Akamai Cloud (
akamai) - Amazon Web Services (
aws) - Microsoft Azure (
azure) - Google Cloud Platform (
gcp) - Alibaba Cloud (
alibaba) - OpenStack (
openstack) - DigitalOcean (
digitalocean) - Oracle Cloud Infrastructure (
oci) - Vultr (
vultr)
- Akamai Cloud (
- Fast, simple and extensible.
- Real-time console logging using the
tracingcrate.
Usage
First, add the library to your project by adding the following to your Cargo.toml file:
[]
# ...
= "2"
= { = "1", = ["full"] }
= { = "0.3", = ["env-filter"] } # Optional; for logging.
To use the non-async blocking API instead, enable the blocking feature:
[]
# ...
= { = "2", = ["blocking"] }
= { = "0.3", = ["env-filter"] } # Optional; for logging.
Detect the cloud provider and print the result (with default timeout; async).
use detect;
async
Detect the cloud provider and print the result (with default timeout; blocking).
use detect;
Detect the cloud provider and print the result (with custom timeout; async).
use detect;
async
Detect the cloud provider and print the result (with custom timeout; blocking).
use detect;
You can also check the list of currently supported cloud providers.
Async:
use supported_providers;
async
Blocking:
use supported_providers;
For more detailed documentation, please refer to the Crate Documentation.
Contributing
Contributions are welcome and greatly appreciated! If you’d like to contribute to cloud-detect, here’s how you can help.
1. Report Issues
If you encounter a bug, unexpected behavior, or have a feature request, please open an issue. Be sure to include:
- A clear description of the issue.
- Steps to reproduce, if applicable.
- Details about your environment.
2. Submit Pull Requests
If you're submitting a pull request, please ensure the following.
- Your code is formatted using
cargo fmt(the Rustnightlychannel is required, as a few unstable features are used).
- Code lints pass with:
- Your code contains sufficient unit tests and that all tests pass.
3. Improve Documentation
If you find areas in the documentation that are unclear or incomplete, feel free to update the README or crate-level documentation. Open a pull request with your improvements.
4. Review Pull Requests
You can also contribute by reviewing open pull requests. Providing constructive feedback helps maintain a high-quality codebase.