libdd-common 2.0.0

Shared utilities for Datadog libraries including HTTP/HTTPS connectors, container entity detection, tag validation, rate limiting, and Unix/Windows platform helpers
Documentation
# Copyright 2021-Present Datadog, Inc. https://www.datadoghq.com/
# SPDX-License-Identifier: Apache-2.0

[package]
name = "libdd-common"
version = "2.0.0"
description = "Shared utilities for Datadog libraries including HTTP/HTTPS connectors, container entity detection, tag validation, rate limiting, and Unix/Windows platform helpers"
homepage = "https://github.com/DataDog/libdatadog/tree/main/datadog-common"
repository = "https://github.com/DataDog/libdatadog/tree/main/datadog-common"
edition.workspace = true
rust-version.workspace = true
license.workspace = true

[lib]
crate-type = ["lib"]
bench = false

[dependencies]
anyhow = "1.0"
futures = "0.3"
futures-core = { version = "0.3.0", default-features = false }
futures-util = { version = "0.3.0", default-features = false }
hex = "0.4"
httparse = { version = "1.9", optional = true }
hyper = { workspace = true }
hyper-util = { workspace = true }
http = "1.1"
http-body = "1.0"
http-body-util = "0.1"
tower-service = "0.3"
cc = "1.1.31"
mime = { version = "0.3.16", optional = true }
multer = { version = "3.1", optional = true }
bytes = { version = "1.4" }
pin-project = "1"
rand = { version = "0.8", optional = true }
regex = "1.5"
# Use hickory-dns instead of the default system DNS resolver to avoid fork safety issues.
# The default resolver can hold locks or other global state that can cause deadlocks
# or corruption when the process forks (e.g., in PHP-FPM or other forking environments).
reqwest = { version = "0.13", features = ["rustls", "hickory-dns"], default-features = false, optional = true }
rustls-native-certs = { version = "0.8.1", optional = true }
thiserror = "1.0"
tokio = { version = "1.23", features = ["rt", "macros", "net", "io-util", "fs"] }
tokio-rustls = { version = "0.26", default-features = false, optional = true }
serde = { version = "1.0", features = ["derive"] }
static_assertions = "1.1.0"
libc = "0.2"
const_format = "0.2.34"
nix = { version = "0.29", features = ["process"] }
[target.'cfg(windows)'.dependencies.windows-sys]
version = "0.52"
features = [
    "Win32_Foundation",
    "Win32_System_Diagnostics_ToolHelp",
    "Win32_System_Performance",
    "Win32_System_Threading",
]

[target.'cfg(unix)'.dependencies]
rustls = { version = "0.23", default-features = false, optional = true, features = ["aws-lc-rs"] }
hyper-rustls = { version = "0.27", default-features = false, features = [
    "native-tokio",
    "http1",
    "tls12",
    "aws-lc-rs",
], optional = true }

[target.'cfg(not(unix))'.dependencies]
rustls = { version = "0.23", default-features = false, optional = true, features = ["ring"] }
hyper-rustls = { version = "0.27", default-features = false, features = [
    "native-tokio",
    "http1",
    "tls12",
    "ring",
], optional = true }

[dev-dependencies]
httparse = "1.9"
indexmap = "2.11"
maplit = "1.0"
mime = "0.3.16"
multer = "3.1"
bytes = "1.4"
rand = "0.8"
tempfile = "3.8"
tokio = { version = "1.23", features = ["rt", "macros", "time"] }

[features]
default = ["https"]
https = ["tokio-rustls", "rustls", "hyper-rustls", "rustls-native-certs"]
use_webpki_roots = ["hyper-rustls/webpki-roots"]
# Enable this feature to enable stubbing of cgroup
# php directly import this crate and uses functions gated by this feature for their test
cgroup_testing = []
# FIPS mode uses the FIPS-compliant cryptographic provider (Unix only)
fips = ["https", "hyper-rustls/fips"]
# Enable reqwest client builder support with file dump debugging
reqwest = ["dep:reqwest", "test-utils"]
# Enable test utilities for use in other crates
test-utils = ["dep:httparse", "dep:rand", "dep:mime", "dep:multer"]

[lints.rust]
# We run coverage checks in our github actions. These checks are run with
# --all-features which is incompatible with our fips feature. The crypto
# provider default needs to be set by the caller in fips mode. For now, we want
# to make sure that the coverage tests use the non-fips version of the crypto
# provider initialization logic, so we added a coverage cfg check on the
# function in src/connector/mod.rs. The coverage config is actually not used in
# normal environments, so we need to let the rust linter know that it is in
# fact a real thing, though one that shows up only in some situations.
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(coverage)'] }