From e9e4c0685854fb13388b0eff6573728e89eafc9d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 3 Dec 2024 09:13:24 +0000 Subject: [PATCH 01/13] Bump rustls from 0.23.16 to 0.23.18 (#773) * Bump rustls from 0.23.16 to 0.23.18 Bumps [rustls](https://github.com/rustls/rustls) from 0.23.16 to 0.23.18. - [Release notes](https://github.com/rustls/rustls/releases) - [Changelog](https://github.com/rustls/rustls/blob/main/CHANGELOG.md) - [Commits](https://github.com/rustls/rustls/compare/v/0.23.16...v/0.23.18) --- updated-dependencies: - dependency-name: rustls dependency-type: direct:production ... Signed-off-by: dependabot[bot] * Update LICENSE-3rdparty.yml with package version bump --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Ivo Anjo --- Cargo.lock | 16 ++++++++-------- LICENSE-3rdparty.yml | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7886b957d..6972046f2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1814,7 +1814,7 @@ dependencies = [ "maplit", "pin-project", "regex", - "rustls 0.23.16", + "rustls 0.23.18", "rustls-native-certs 0.7.3", "serde", "static_assertions", @@ -2805,7 +2805,7 @@ dependencies = [ "http 1.1.0", "hyper 1.5.0", "hyper-util", - "rustls 0.23.16", + "rustls 0.23.18", "rustls-native-certs 0.8.0", "rustls-pki-types", "tokio", @@ -4288,7 +4288,7 @@ dependencies = [ "quinn-proto", "quinn-udp", "rustc-hash 2.0.0", - "rustls 0.23.16", + "rustls 0.23.18", "socket2", "thiserror", "tokio", @@ -4305,7 +4305,7 @@ dependencies = [ "rand", "ring 0.17.8", "rustc-hash 2.0.0", - "rustls 0.23.16", + "rustls 0.23.18", "slab", "thiserror", "tinyvec", @@ -4503,7 +4503,7 @@ dependencies = [ "percent-encoding", "pin-project-lite", "quinn", - "rustls 0.23.16", + "rustls 0.23.18", "rustls-pemfile", "rustls-pki-types", "serde", @@ -4652,9 +4652,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.23.16" +version = "0.23.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eee87ff5d9b36712a58574e12e9f0ea80f915a5b0ac518d322b24a465617925e" +checksum = "9c9cc1d47e243d655ace55ed38201c19ae02c148ae56412ab8750e8f0166ab7f" dependencies = [ "aws-lc-rs", "once_cell", @@ -5708,7 +5708,7 @@ version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4" dependencies = [ - "rustls 0.23.16", + "rustls 0.23.18", "rustls-pki-types", "tokio", ] diff --git a/LICENSE-3rdparty.yml b/LICENSE-3rdparty.yml index 103f3821d..590b23a25 100644 --- a/LICENSE-3rdparty.yml +++ b/LICENSE-3rdparty.yml @@ -22948,7 +22948,7 @@ third_party_libraries: IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - package_name: rustls - package_version: 0.23.16 + package_version: 0.23.18 repository: https://github.com/rustls/rustls license: Apache-2.0 OR ISC OR MIT licenses: From 1776e5dd9c28dff3ec660a4d76d9b9ab5e37a761 Mon Sep 17 00:00:00 2001 From: Julio Gonzalez <107922352+hoolioh@users.noreply.github.com> Date: Tue, 3 Dec 2024 12:05:43 +0100 Subject: [PATCH 02/13] Fix builder cmake target directory. (#776) * Fix cmake target directory. --- builder/src/builder.rs | 7 ++++++- builder/src/crashtracker.rs | 7 +++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/builder/src/builder.rs b/builder/src/builder.rs index 92672adc6..08850dc78 100644 --- a/builder/src/builder.rs +++ b/builder/src/builder.rs @@ -139,7 +139,12 @@ impl Builder { pub fn add_cmake(&self) { let libs = arch::NATIVE_LIBS.to_owned(); - let cmake_path: PathBuf = [&self.target_dir, "DatadogConfig.cmake"].iter().collect(); + let cmake_dir: PathBuf = [&self.target_dir, "cmake"].iter().collect(); + fs::create_dir_all(cmake_dir).expect("Failed to create cmake dir"); + + let cmake_path: PathBuf = [&self.target_dir, "cmake", "DatadogConfig.cmake"] + .iter() + .collect(); let mut origin = project_root(); origin.push("cmake"); origin.push("DatadogConfig.cmake.in"); diff --git a/builder/src/crashtracker.rs b/builder/src/crashtracker.rs index be2c7603b..489e9c173 100644 --- a/builder/src/crashtracker.rs +++ b/builder/src/crashtracker.rs @@ -22,11 +22,14 @@ pub struct CrashTracker { impl CrashTracker { fn gen_binaries(&self) -> Result<()> { if arch::BUILD_CRASHTRACKER { + let mut datadog_root = project_root(); + datadog_root.push(self.target_dir.as_ref()); + let mut crashtracker_dir = project_root(); crashtracker_dir.push("crashtracker"); let _dst = cmake::Config::new(crashtracker_dir.to_str().unwrap()) - .define("Datadog_ROOT", self.target_dir.as_ref()) - .define("CMAKE_INSTALL_PREFIX", self.target_dir.as_ref()) + .define("Datadog_ROOT", datadog_root.to_str().unwrap()) + .define("CMAKE_INSTALL_PREFIX", self.target_dir.to_string()) .build(); } From a3c1bd4a5debe6ad1598cb708ec557e89dd26015 Mon Sep 17 00:00:00 2001 From: Edmund Kump Date: Tue, 3 Dec 2024 15:07:21 -0500 Subject: [PATCH 03/13] Implement UnderlyingBytes for ByteSlice so it can be borrowed as underlying for TinyBytes::Bytes (#764) Update data-pipeline's send function to accept a tinybytes::Bytes for the payload type. Also update the data-pipeline-ffi ddog_trace_exporter_send function to transmute the incoming ByteSlice to static. The ByteSlice is expected to live for the length of the function call, but it is technically possible to borrow the underlying data for longer, leading to stale references. This will be addressed as part of APMSP-1621. --- Cargo.lock | 3 +- data-pipeline-ffi/Cargo.toml | 3 +- data-pipeline-ffi/src/trace_exporter.rs | 16 ++++++++-- .../examples/send-traces-with-stats.rs | 4 ++- data-pipeline/src/trace_exporter.rs | 31 +++++++++---------- 5 files changed, 33 insertions(+), 24 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6972046f2..f64bbfd1c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1324,10 +1324,9 @@ name = "data-pipeline-ffi" version = "14.3.1" dependencies = [ "build_common", - "bytes", "data-pipeline", "ddcommon-ffi", - "libc", + "tinybytes", ] [[package]] diff --git a/data-pipeline-ffi/Cargo.toml b/data-pipeline-ffi/Cargo.toml index 8d5f4b6a0..f3fb0bc63 100644 --- a/data-pipeline-ffi/Cargo.toml +++ b/data-pipeline-ffi/Cargo.toml @@ -24,5 +24,4 @@ build_common = { path = "../build-common" } [dependencies] data-pipeline = { path = "../data-pipeline" } ddcommon-ffi = { path = "../ddcommon-ffi", default-features = false } -bytes = "1.4" -libc = "0.2.153" +tinybytes = { path = "../tinybytes" } diff --git a/data-pipeline-ffi/src/trace_exporter.rs b/data-pipeline-ffi/src/trace_exporter.rs index b3cdbe365..0b1854f30 100644 --- a/data-pipeline-ffi/src/trace_exporter.rs +++ b/data-pipeline-ffi/src/trace_exporter.rs @@ -102,7 +102,8 @@ pub unsafe extern "C" fn ddog_trace_exporter_free(handle: Box) { /// /// * `handle` - The handle to the TraceExporter instance. /// * `trace` - The traces to send to the Datadog Agent in the input format used to create the -/// TraceExporter. +/// TraceExporter. The memory for the trace must be valid for the life of the call to this +/// function. /// * `trace_count` - The number of traces to send to the Datadog Agent. #[no_mangle] pub unsafe extern "C" fn ddog_trace_exporter_send( @@ -110,9 +111,18 @@ pub unsafe extern "C" fn ddog_trace_exporter_send( trace: ByteSlice, trace_count: usize, ) -> MaybeError { - // TODO - handle errors - https://datadoghq.atlassian.net/browse/APMSP-1095 + // necessary that the trace be static for the life of the FFI function call as the caller + // currently owns the memory. + //APMSP-1621 - Properly fix this sharp-edge by allocating memory on the Rust side + let static_trace: ByteSlice<'static> = std::mem::transmute(trace); + + // TODO: APMSP-1095 - properly handle errors from the send call handle - .send(trace.as_bytes(), trace_count) + .send( + tinybytes::Bytes::from_static(static_trace.as_slice()), + trace_count, + ) .unwrap_or(String::from("")); + MaybeError::None } diff --git a/data-pipeline/examples/send-traces-with-stats.rs b/data-pipeline/examples/send-traces-with-stats.rs index be58c1712..095c02528 100644 --- a/data-pipeline/examples/send-traces-with-stats.rs +++ b/data-pipeline/examples/send-traces-with-stats.rs @@ -55,6 +55,8 @@ fn main() { traces.push(trace); } let data = rmp_serde::to_vec_named(&traces).unwrap(); - exporter.send(&data, 100).unwrap(); + let data_as_bytes = tinybytes::Bytes::from(data); + + exporter.send(data_as_bytes, 100).unwrap(); exporter.shutdown(None).unwrap(); } diff --git a/data-pipeline/src/trace_exporter.rs b/data-pipeline/src/trace_exporter.rs index 90cdee829..36429e115 100644 --- a/data-pipeline/src/trace_exporter.rs +++ b/data-pipeline/src/trace_exporter.rs @@ -253,15 +253,11 @@ impl TraceExporter { /// Send msgpack serialized traces to the agent #[allow(missing_docs)] - pub fn send(&self, data: &[u8], trace_count: usize) -> Result { + pub fn send(&self, data: tinybytes::Bytes, trace_count: usize) -> Result { self.check_agent_info(); match self.input_format { - TraceExporterInputFormat::Proxy => self.send_proxy(data, trace_count), - TraceExporterInputFormat::V04 => { - self.send_deser_ser(tinybytes::Bytes::copy_from_slice(data)) - // TODO: APMSP-1582 - Refactor data-pipeline-ffi so we can leverage a type that - // implements tinybytes::UnderlyingBytes trait to avoid copying - } + TraceExporterInputFormat::Proxy => self.send_proxy(data.as_ref(), trace_count), + TraceExporterInputFormat::V04 => self.send_deser_ser(data), } } @@ -1187,7 +1183,7 @@ mod tests { ..Default::default() }]; - let data = rmp_serde::to_vec_named(&vec![trace_chunk]).unwrap(); + let data = tinybytes::Bytes::from(rmp_serde::to_vec_named(&vec![trace_chunk]).unwrap()); // Wait for the info fetcher to get the config while mock_info.hits() == 0 { @@ -1196,7 +1192,7 @@ mod tests { }) } - exporter.send(data.as_slice(), 1).unwrap(); + exporter.send(data, 1).unwrap(); exporter.shutdown(None).unwrap(); mock_traces.assert(); @@ -1314,8 +1310,10 @@ mod tests { ..Default::default() }], ]; - let bytes = rmp_serde::to_vec_named(&traces).expect("failed to serialize static trace"); - let _result = exporter.send(&bytes, 1).expect("failed to send trace"); + let bytes = tinybytes::Bytes::from( + rmp_serde::to_vec_named(&traces).expect("failed to serialize static trace"), + ); + let _result = exporter.send(bytes, 1).expect("failed to send trace"); assert_eq!( &format!( @@ -1346,9 +1344,8 @@ mod tests { stats_socket.local_addr().unwrap().to_string(), ); - let _result = exporter - .send(b"some_bad_payload", 1) - .expect("failed to send trace"); + let bad_payload = tinybytes::Bytes::copy_from_slice(b"some_bad_payload".as_ref()); + let _result = exporter.send(bad_payload, 1).expect("failed to send trace"); assert_eq!( &format!( @@ -1381,8 +1378,10 @@ mod tests { name: BytesString::from_slice(b"test").unwrap(), ..Default::default() }]]; - let bytes = rmp_serde::to_vec_named(&traces).expect("failed to serialize static trace"); - let _result = exporter.send(&bytes, 1).expect("failed to send trace"); + let bytes = tinybytes::Bytes::from( + rmp_serde::to_vec_named(&traces).expect("failed to serialize static trace"), + ); + let _result = exporter.send(bytes, 1).expect("failed to send trace"); assert_eq!( &format!( From c5e16f61f59aa140aae0ff86e72ef7ce40157f1d Mon Sep 17 00:00:00 2001 From: Levi Morrison Date: Mon, 2 Dec 2024 14:26:27 -0700 Subject: [PATCH 04/13] feature: ddcommon-net2 crate fix: install ring CyrptoProvider manually For some reason I do not yet understand, this used to happen automatically but is not happening, and it causes a crashtracker test `crash_tracking_empty_endpoint` to fail because it doesn't have a CryptoProvider. --- Cargo.lock | 136 +++++--- Cargo.toml | 1 + LICENSE-3rdparty.yml | 543 ++++++++++++++++++++++++++++- ddcommon-net1/src/connector/mod.rs | 11 + ddcommon-net2/Cargo.toml | 30 ++ ddcommon-net2/src/compat.rs | 134 +++++++ ddcommon-net2/src/http.rs | 348 ++++++++++++++++++ ddcommon-net2/src/lib.rs | 112 ++++++ profiling-ffi/Cargo.toml | 5 +- profiling-ffi/src/exporter.rs | 61 +++- profiling/Cargo.toml | 15 +- profiling/src/exporter/config.rs | 123 +++---- profiling/src/exporter/mod.rs | 127 ++----- profiling/tests/form.rs | 28 +- tools/docker/Dockerfile.build | 5 +- 15 files changed, 1435 insertions(+), 244 deletions(-) create mode 100644 ddcommon-net2/Cargo.toml create mode 100644 ddcommon-net2/src/compat.rs create mode 100644 ddcommon-net2/src/http.rs create mode 100644 ddcommon-net2/src/lib.rs diff --git a/Cargo.lock b/Cargo.lock index b08cdecae..7fa2aa147 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -725,7 +725,7 @@ dependencies = [ "serde_json", "serde_repr", "serde_urlencoded", - "thiserror", + "thiserror 1.0.68", "tokio", "tokio-util", "tower-service", @@ -824,7 +824,7 @@ dependencies = [ "semver", "serde", "serde_json", - "thiserror", + "thiserror 1.0.68", ] [[package]] @@ -1002,18 +1002,17 @@ checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990" [[package]] name = "common-multipart-rfc7578" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22328b3864f1d8dbe7036f3f2fdfdcb1f367af43dca418943d396fbf8c4b8021" +version = "0.6.0" +source = "git+https://github.com/jothan/rust-hyper-multipart-rfc7578.git?rev=4d3064a7a8c0062b485d50e4460cb7ad71c83d35#4d3064a7a8c0062b485d50e4460cb7ad71c83d35" dependencies = [ "bytes", "futures-core", "futures-util", - "http 0.2.12", + "http 1.1.0", "mime", "mime_guess", "rand", - "thiserror", + "thiserror 1.0.68", ] [[package]] @@ -1077,6 +1076,16 @@ dependencies = [ "libc", ] +[[package]] +name = "core-foundation" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b55271e5c8c478ad3f38ad24ef34923091e0548492a266d19b3c0b4d82574c63" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "core-foundation-sys" version = "0.8.7" @@ -1494,15 +1503,11 @@ dependencies = [ "criterion", "datadog-alloc", "ddcommon", - "ddcommon-net1", + "ddcommon-net2", "derivative", "futures", - "futures-core", - "futures-util", "hashbrown 0.14.5", - "http 0.2.12", - "http-body 0.4.6", - "hyper 0.14.31", + "http-body-util", "hyper-multipart-rfc7578", "indexmap 2.6.0", "libc", @@ -1512,6 +1517,7 @@ dependencies = [ "percent-encoding", "prost 0.12.6", "rustc-hash 1.1.0", + "rustls-native-certs 0.8.1", "serde", "serde_json", "tokio", @@ -1532,6 +1538,7 @@ dependencies = [ "ddcommon-net1", "ddtelemetry-ffi", "futures", + "http-body-util", "hyper 0.14.31", "libc", "serde_json", @@ -1859,6 +1866,23 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "ddcommon-net2" +version = "14.3.1" +dependencies = [ + "ddcommon", + "hex", + "hyper 1.5.0", + "hyper-util", + "rustls-native-certs 0.8.1", + "serde", + "thiserror 2.0.4", + "tokio", + "tokio-rustls 0.26.0", + "tokio-util", + "webpki-roots", +] + [[package]] name = "ddsketch-agent" version = "0.1.0" @@ -2037,7 +2061,7 @@ dependencies = [ "reqwest", "serde", "serde_json", - "thiserror", + "thiserror 1.0.68", "tokio", "tokio-util", "tracing", @@ -2739,15 +2763,14 @@ dependencies = [ [[package]] name = "hyper-multipart-rfc7578" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63ca8108ac0ae98d310d41cddb11c6b822e8aca865dbe421366934e6f7f72e10" +version = "0.8.0" +source = "git+https://github.com/jothan/rust-hyper-multipart-rfc7578.git?rev=4d3064a7a8c0062b485d50e4460cb7ad71c83d35#4d3064a7a8c0062b485d50e4460cb7ad71c83d35" dependencies = [ "bytes", "common-multipart-rfc7578", "futures-core", - "http 0.2.12", - "hyper 0.14.31", + "http 1.1.0", + "hyper 1.5.0", ] [[package]] @@ -2831,7 +2854,7 @@ dependencies = [ "hyper 1.5.0", "hyper-util", "rustls 0.23.18", - "rustls-native-certs 0.8.0", + "rustls-native-certs 0.8.1", "rustls-pki-types", "tokio", "tokio-rustls 0.26.0", @@ -3651,7 +3674,7 @@ dependencies = [ "percent-encoding", "pin-project", "rand", - "thiserror", + "thiserror 1.0.68", "tokio", "tokio-stream", ] @@ -3666,7 +3689,7 @@ dependencies = [ "lazy_static", "opentelemetry", "opentelemetry-semantic-conventions", - "thiserror", + "thiserror 1.0.68", "thrift", "tokio", ] @@ -4196,7 +4219,7 @@ dependencies = [ "bytes", "once_cell", "protobuf-support", - "thiserror", + "thiserror 1.0.68", ] [[package]] @@ -4211,7 +4234,7 @@ dependencies = [ "protobuf-parse", "regex", "tempfile", - "thiserror", + "thiserror 1.0.68", ] [[package]] @@ -4226,7 +4249,7 @@ dependencies = [ "protobuf", "protobuf-support", "tempfile", - "thiserror", + "thiserror 1.0.68", "which", ] @@ -4236,7 +4259,7 @@ version = "3.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b088fd20b938a875ea00843b6faf48579462630015c3788d397ad6a786663252" dependencies = [ - "thiserror", + "thiserror 1.0.68", ] [[package]] @@ -4315,7 +4338,7 @@ dependencies = [ "rustc-hash 2.0.0", "rustls 0.23.18", "socket2", - "thiserror", + "thiserror 1.0.68", "tokio", "tracing", ] @@ -4332,7 +4355,7 @@ dependencies = [ "rustc-hash 2.0.0", "rustls 0.23.18", "slab", - "thiserror", + "thiserror 1.0.68", "tinyvec", "tracing", ] @@ -4436,7 +4459,7 @@ checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43" dependencies = [ "getrandom", "libredox", - "thiserror", + "thiserror 1.0.68", ] [[package]] @@ -4682,6 +4705,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c9cc1d47e243d655ace55ed38201c19ae02c148ae56412ab8750e8f0166ab7f" dependencies = [ "aws-lc-rs", + "log", "once_cell", "ring 0.17.8", "rustls-pki-types", @@ -4699,7 +4723,7 @@ dependencies = [ "openssl-probe", "rustls 0.19.1", "schannel", - "security-framework", + "security-framework 2.11.1", ] [[package]] @@ -4712,20 +4736,19 @@ dependencies = [ "rustls-pemfile", "rustls-pki-types", "schannel", - "security-framework", + "security-framework 2.11.1", ] [[package]] name = "rustls-native-certs" -version = "0.8.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcaf18a4f2be7326cd874a5fa579fae794320a0f388d365dca7e480e55f83f8a" +checksum = "7fcff2dd52b58a8d98a70243663a0d234c4e2b79235637849d15913394a247d3" dependencies = [ "openssl-probe", - "rustls-pemfile", "rustls-pki-types", "schannel", - "security-framework", + "security-framework 3.0.1", ] [[package]] @@ -4780,7 +4803,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a15e661f0f9dac21f3494fe5d23a6338c0ac116a2d22c2b63010acd89467ffe" dependencies = [ "byteorder", - "thiserror", + "thiserror 1.0.68", "twox-hash", ] @@ -4855,7 +4878,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" dependencies = [ "bitflags 2.6.0", - "core-foundation", + "core-foundation 0.9.4", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework" +version = "3.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1415a607e92bec364ea2cf9264646dcce0f91e6d65281bd6f2819cca3bf39c8" +dependencies = [ + "bitflags 2.6.0", + "core-foundation 0.10.0", "core-foundation-sys", "libc", "security-framework-sys", @@ -5410,7 +5446,7 @@ dependencies = [ "serde_bytes", "static_assertions", "tarpc-plugins", - "thiserror", + "thiserror 1.0.68", "tokio", "tokio-serde", "tokio-util", @@ -5518,7 +5554,7 @@ dependencies = [ "serde", "serde_json", "serde_with", - "thiserror", + "thiserror 1.0.68", "tokio", "tokio-stream", "tokio-util", @@ -5531,7 +5567,16 @@ version = "1.0.68" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "02dd99dc800bbb97186339685293e1cc5d9df1f8fae2d0aecd9ff1c77efea892" dependencies = [ - "thiserror-impl", + "thiserror-impl 1.0.68", +] + +[[package]] +name = "thiserror" +version = "2.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f49a1853cf82743e3b7950f77e0f4d622ca36cf4317cba00c767838bac8d490" +dependencies = [ + "thiserror-impl 2.0.4", ] [[package]] @@ -5545,6 +5590,17 @@ dependencies = [ "syn 2.0.87", ] +[[package]] +name = "thiserror-impl" +version = "2.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8381894bb3efe0c4acac3ded651301ceee58a15d47c2e34885ed1908ad667061" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.87", +] + [[package]] name = "thread_local" version = "1.1.8" diff --git a/Cargo.toml b/Cargo.toml index 80d5ca4aa..c24b2ca45 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,6 +13,7 @@ members = [ "ddcommon", "ddcommon-ffi", "ddcommon-net1", + "ddcommon-net2", "ddtelemetry", "ddtelemetry-ffi", "dogstatsd", diff --git a/LICENSE-3rdparty.yml b/LICENSE-3rdparty.yml index 65832f248..c03ae5549 100644 --- a/LICENSE-3rdparty.yml +++ b/LICENSE-3rdparty.yml @@ -1,4 +1,4 @@ -root_name: datadog-alloc, builder, build_common, tools, datadog-crashtracker, ddcommon, ddcommon-net1, ddtelemetry, datadog-ddsketch, datadog-crashtracker-ffi, ddcommon-ffi, datadog-profiling, datadog-profiling-ffi, data-pipeline-ffi, data-pipeline, datadog-trace-normalization, datadog-trace-protobuf, datadog-trace-obfuscation, datadog-trace-utils, tinybytes, dogstatsd-client, ddtelemetry-ffi, symbolizer-ffi, datadog-profiling-replayer, dogstatsd, datadog-ipc, datadog-ipc-macros, tarpc, tarpc-plugins, spawn_worker, cc_utils, datadog-live-debugger, datadog-live-debugger-ffi, datadog-remote-config, datadog-dynamic-configuration, datadog-sidecar, datadog-sidecar-macros, datadog-sidecar-ffi, sidecar_mockgen, test_spawn_from_lib, datadog-serverless-trace-mini-agent, datadog-trace-mini-agent +root_name: datadog-alloc, builder, build_common, tools, datadog-crashtracker, ddcommon, ddcommon-net1, ddtelemetry, datadog-ddsketch, datadog-crashtracker-ffi, ddcommon-ffi, datadog-profiling, ddcommon-net2, datadog-profiling-ffi, data-pipeline-ffi, data-pipeline, datadog-trace-normalization, datadog-trace-protobuf, datadog-trace-obfuscation, datadog-trace-utils, tinybytes, dogstatsd-client, ddtelemetry-ffi, symbolizer-ffi, datadog-profiling-replayer, dogstatsd, datadog-ipc, datadog-ipc-macros, tarpc, tarpc-plugins, spawn_worker, cc_utils, datadog-live-debugger, datadog-live-debugger-ffi, datadog-remote-config, datadog-dynamic-configuration, datadog-sidecar, datadog-sidecar-macros, datadog-sidecar-ffi, sidecar_mockgen, test_spawn_from_lib, datadog-serverless-trace-mini-agent, datadog-trace-mini-agent third_party_libraries: - package_name: addr2line package_version: 0.24.2 @@ -7006,14 +7006,37 @@ third_party_libraries: limitations under the License. - package_name: common-multipart-rfc7578 - package_version: 0.5.0 + package_version: 0.6.0 repository: https://github.com/ferristseng/rust-multipart-rfc7578 license: MIT OR Apache-2.0 licenses: - license: MIT - text: NOT FOUND + text: | + Permission is hereby granted, free of charge, to any + person obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the + Software without restriction, including without + limitation the rights to use, copy, modify, merge, + publish, distribute, sublicense, and/or sell copies of + the Software, and to permit persons to whom the Software + is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice + shall be included in all copies or substantial portions + of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF + ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED + TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A + PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT + SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR + IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. - license: Apache-2.0 - text: NOT FOUND + text: " Apache License\n Version 2.0, January 2004\n http://www.apache.org/licenses/\n\nTERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n1. Definitions.\n\n \"License\" shall mean the terms and conditions for use, reproduction,\n and distribution as defined by Sections 1 through 9 of this document.\n\n \"Licensor\" shall mean the copyright owner or entity authorized by\n the copyright owner that is granting the License.\n\n \"Legal Entity\" shall mean the union of the acting entity and all\n other entities that control, are controlled by, or are under common\n control with that entity. For the purposes of this definition,\n \"control\" means (i) the power, direct or indirect, to cause the\n direction or management of such entity, whether by contract or\n otherwise, or (ii) ownership of fifty percent (50%) or more of the\n outstanding shares, or (iii) beneficial ownership of such entity.\n\n \"You\" (or \"Your\") shall mean an individual or Legal Entity\n exercising permissions granted by this License.\n\n \"Source\" form shall mean the preferred form for making modifications,\n including but not limited to software source code, documentation\n source, and configuration files.\n\n \"Object\" form shall mean any form resulting from mechanical\n transformation or translation of a Source form, including but\n not limited to compiled object code, generated documentation,\n and conversions to other media types.\n\n \"Work\" shall mean the work of authorship, whether in Source or\n Object form, made available under the License, as indicated by a\n copyright notice that is included in or attached to the work\n (an example is provided in the Appendix below).\n\n \"Derivative Works\" shall mean any work, whether in Source or Object\n form, that is based on (or derived from) the Work and for which the\n editorial revisions, annotations, elaborations, or other modifications\n represent, as a whole, an original work of authorship. For the purposes\n of this License, Derivative Works shall not include works that remain\n separable from, or merely link (or bind by name) to the interfaces of,\n the Work and Derivative Works thereof.\n\n \"Contribution\" shall mean any work of authorship, including\n the original version of the Work and any modifications or additions\n to that Work or Derivative Works thereof, that is intentionally\n submitted to Licensor for inclusion in the Work by the copyright owner\n or by an individual or Legal Entity authorized to submit on behalf of\n the copyright owner. For the purposes of this definition, \"submitted\"\n means any form of electronic, verbal, or written communication sent\n to the Licensor or its representatives, including but not limited to\n communication on electronic mailing lists, source code control systems,\n and issue tracking systems that are managed by, or on behalf of, the\n Licensor for the purpose of discussing and improving the Work, but\n excluding communication that is conspicuously marked or otherwise\n designated in writing by the copyright owner as \"Not a Contribution.\"\n\n \"Contributor\" shall mean Licensor and any individual or Legal Entity\n on behalf of whom a Contribution has been received by Licensor and\n subsequently incorporated within the Work.\n\n2. Grant of Copyright License. Subject to the terms and conditions of\n this License, each Contributor hereby grants to You a perpetual,\n worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n copyright license to reproduce, prepare Derivative Works of,\n publicly display, publicly perform, sublicense, and distribute the\n Work and such Derivative Works in Source or Object form.\n\n3. Grant of Patent License. Subject to the terms and conditions of\n this License, each Contributor hereby grants to You a perpetual,\n worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n (except as stated in this section) patent license to make, have made,\n use, offer to sell, sell, import, and otherwise transfer the Work,\n where such license applies only to those patent claims licensable\n by such Contributor that are necessarily infringed by their\n Contribution(s) alone or by combination of their Contribution(s)\n with the Work to which such Contribution(s) was submitted. If You\n institute patent litigation against any entity (including a\n cross-claim or counterclaim in a lawsuit) alleging that the Work\n or a Contribution incorporated within the Work constitutes direct\n or contributory patent infringement, then any patent licenses\n granted to You under this License for that Work shall terminate\n as of the date such litigation is filed.\n\n4. Redistribution. You may reproduce and distribute copies of the\n Work or Derivative Works thereof in any medium, with or without\n modifications, and in Source or Object form, provided that You\n meet the following conditions:\n\n (a) You must give any other recipients of the Work or\n Derivative Works a copy of this License; and\n\n (b) You must cause any modified files to carry prominent notices\n stating that You changed the files; and\n\n (c) You must retain, in the Source form of any Derivative Works\n that You distribute, all copyright, patent, trademark, and\n attribution notices from the Source form of the Work,\n excluding those notices that do not pertain to any part of\n the Derivative Works; and\n\n (d) If the Work includes a \"NOTICE\" text file as part of its\n distribution, then any Derivative Works that You distribute must\n include a readable copy of the attribution notices contained\n within such NOTICE file, excluding those notices that do not\n pertain to any part of the Derivative Works, in at least one\n of the following places: within a NOTICE text file distributed\n as part of the Derivative Works; within the Source form or\n documentation, if provided along with the Derivative Works; or,\n within a display generated by the Derivative Works, if and\n wherever such third-party notices normally appear. The contents\n of the NOTICE file are for informational purposes only and\n do not modify the License. You may add Your own attribution\n notices within Derivative Works that You distribute, alongside\n or as an addendum to the NOTICE text from the Work, provided\n that such additional attribution notices cannot be construed\n as modifying the License.\n\n You may add Your own copyright statement to Your modifications and\n may provide additional or different license terms and conditions\n for use, reproduction, or distribution of Your modifications, or\n for any such Derivative Works as a whole, provided Your use,\n reproduction, and distribution of the Work otherwise complies with\n the conditions stated in this License.\n\n5. Submission of Contributions. Unless You explicitly state otherwise,\n any Contribution intentionally submitted for inclusion in the Work\n by You to the Licensor shall be under the terms and conditions of\n this License, without any additional terms or conditions.\n Notwithstanding the above, nothing herein shall supersede or modify\n the terms of any separate license agreement you may have executed\n with Licensor regarding such Contributions.\n\n6. Trademarks. This License does not grant permission to use the trade\n names, trademarks, service marks, or product names of the Licensor,\n except as required for reasonable and customary use in describing the\n origin of the Work and reproducing the content of the NOTICE file.\n\n7. Disclaimer of Warranty. Unless required by applicable law or\n agreed to in writing, Licensor provides the Work (and each\n Contributor provides its Contributions) on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n implied, including, without limitation, any warranties or conditions\n of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n PARTICULAR PURPOSE. You are solely responsible for determining the\n appropriateness of using or redistributing the Work and assume any\n risks associated with Your exercise of permissions under this License.\n\n8. Limitation of Liability. In no event and under no legal theory,\n whether in tort (including negligence), contract, or otherwise,\n unless required by applicable law (such as deliberate and grossly\n negligent acts) or agreed to in writing, shall any Contributor be\n liable to You for damages, including any direct, indirect, special,\n incidental, or consequential damages of any character arising as a\n result of this License or out of the use or inability to use the\n Work (including but not limited to damages for loss of goodwill,\n work stoppage, computer failure or malfunction, or any and all\n other commercial damages or losses), even if such Contributor\n has been advised of the possibility of such damages.\n\n9. Accepting Warranty or Additional Liability. While redistributing\n the Work or Derivative Works thereof, You may choose to offer,\n and charge a fee for, acceptance of support, warranty, indemnity,\n or other liability obligations and/or rights consistent with this\n License. However, in accepting such obligations, You may act only\n on Your own behalf and on Your sole responsibility, not on behalf\n of any other Contributor, and only if You agree to indemnify,\n defend, and hold each Contributor harmless for any liability\n incurred by, or claims asserted against, such Contributor by reason\n of your accepting any such warranty or additional liability.\n\nEND OF TERMS AND CONDITIONS\n\nAPPENDIX: How to apply the Apache License to your work.\n\n To apply the Apache License to your work, attach the following\n boilerplate notice, with the fields enclosed by brackets \"[]\"\n replaced with your own identifying information. (Don't include\n the brackets!) The text should be enclosed in the appropriate\n comment syntax for the file format. We also recommend that a\n file or class name and description of purpose be included on the\n same \"printed page\" as the copyright notice for easier\n identification within third-party archives.\n\nCopyright [yyyy] [name of copyright owner]\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n\thttp://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n" - package_name: concurrent-queue package_version: 2.5.0 repository: https://github.com/smol-rs/concurrent-queue @@ -7307,6 +7330,40 @@ third_party_libraries: DEALINGS IN THE SOFTWARE. - license: Apache-2.0 text: " Apache License\n Version 2.0, January 2004\n http://www.apache.org/licenses/\n\nTERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n1. Definitions.\n\n \"License\" shall mean the terms and conditions for use, reproduction,\n and distribution as defined by Sections 1 through 9 of this document.\n\n \"Licensor\" shall mean the copyright owner or entity authorized by\n the copyright owner that is granting the License.\n\n \"Legal Entity\" shall mean the union of the acting entity and all\n other entities that control, are controlled by, or are under common\n control with that entity. For the purposes of this definition,\n \"control\" means (i) the power, direct or indirect, to cause the\n direction or management of such entity, whether by contract or\n otherwise, or (ii) ownership of fifty percent (50%) or more of the\n outstanding shares, or (iii) beneficial ownership of such entity.\n\n \"You\" (or \"Your\") shall mean an individual or Legal Entity\n exercising permissions granted by this License.\n\n \"Source\" form shall mean the preferred form for making modifications,\n including but not limited to software source code, documentation\n source, and configuration files.\n\n \"Object\" form shall mean any form resulting from mechanical\n transformation or translation of a Source form, including but\n not limited to compiled object code, generated documentation,\n and conversions to other media types.\n\n \"Work\" shall mean the work of authorship, whether in Source or\n Object form, made available under the License, as indicated by a\n copyright notice that is included in or attached to the work\n (an example is provided in the Appendix below).\n\n \"Derivative Works\" shall mean any work, whether in Source or Object\n form, that is based on (or derived from) the Work and for which the\n editorial revisions, annotations, elaborations, or other modifications\n represent, as a whole, an original work of authorship. For the purposes\n of this License, Derivative Works shall not include works that remain\n separable from, or merely link (or bind by name) to the interfaces of,\n the Work and Derivative Works thereof.\n\n \"Contribution\" shall mean any work of authorship, including\n the original version of the Work and any modifications or additions\n to that Work or Derivative Works thereof, that is intentionally\n submitted to Licensor for inclusion in the Work by the copyright owner\n or by an individual or Legal Entity authorized to submit on behalf of\n the copyright owner. For the purposes of this definition, \"submitted\"\n means any form of electronic, verbal, or written communication sent\n to the Licensor or its representatives, including but not limited to\n communication on electronic mailing lists, source code control systems,\n and issue tracking systems that are managed by, or on behalf of, the\n Licensor for the purpose of discussing and improving the Work, but\n excluding communication that is conspicuously marked or otherwise\n designated in writing by the copyright owner as \"Not a Contribution.\"\n\n \"Contributor\" shall mean Licensor and any individual or Legal Entity\n on behalf of whom a Contribution has been received by Licensor and\n subsequently incorporated within the Work.\n\n2. Grant of Copyright License. Subject to the terms and conditions of\n this License, each Contributor hereby grants to You a perpetual,\n worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n copyright license to reproduce, prepare Derivative Works of,\n publicly display, publicly perform, sublicense, and distribute the\n Work and such Derivative Works in Source or Object form.\n\n3. Grant of Patent License. Subject to the terms and conditions of\n this License, each Contributor hereby grants to You a perpetual,\n worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n (except as stated in this section) patent license to make, have made,\n use, offer to sell, sell, import, and otherwise transfer the Work,\n where such license applies only to those patent claims licensable\n by such Contributor that are necessarily infringed by their\n Contribution(s) alone or by combination of their Contribution(s)\n with the Work to which such Contribution(s) was submitted. If You\n institute patent litigation against any entity (including a\n cross-claim or counterclaim in a lawsuit) alleging that the Work\n or a Contribution incorporated within the Work constitutes direct\n or contributory patent infringement, then any patent licenses\n granted to You under this License for that Work shall terminate\n as of the date such litigation is filed.\n\n4. Redistribution. You may reproduce and distribute copies of the\n Work or Derivative Works thereof in any medium, with or without\n modifications, and in Source or Object form, provided that You\n meet the following conditions:\n\n (a) You must give any other recipients of the Work or\n Derivative Works a copy of this License; and\n\n (b) You must cause any modified files to carry prominent notices\n stating that You changed the files; and\n\n (c) You must retain, in the Source form of any Derivative Works\n that You distribute, all copyright, patent, trademark, and\n attribution notices from the Source form of the Work,\n excluding those notices that do not pertain to any part of\n the Derivative Works; and\n\n (d) If the Work includes a \"NOTICE\" text file as part of its\n distribution, then any Derivative Works that You distribute must\n include a readable copy of the attribution notices contained\n within such NOTICE file, excluding those notices that do not\n pertain to any part of the Derivative Works, in at least one\n of the following places: within a NOTICE text file distributed\n as part of the Derivative Works; within the Source form or\n documentation, if provided along with the Derivative Works; or,\n within a display generated by the Derivative Works, if and\n wherever such third-party notices normally appear. The contents\n of the NOTICE file are for informational purposes only and\n do not modify the License. You may add Your own attribution\n notices within Derivative Works that You distribute, alongside\n or as an addendum to the NOTICE text from the Work, provided\n that such additional attribution notices cannot be construed\n as modifying the License.\n\n You may add Your own copyright statement to Your modifications and\n may provide additional or different license terms and conditions\n for use, reproduction, or distribution of Your modifications, or\n for any such Derivative Works as a whole, provided Your use,\n reproduction, and distribution of the Work otherwise complies with\n the conditions stated in this License.\n\n5. Submission of Contributions. Unless You explicitly state otherwise,\n any Contribution intentionally submitted for inclusion in the Work\n by You to the Licensor shall be under the terms and conditions of\n this License, without any additional terms or conditions.\n Notwithstanding the above, nothing herein shall supersede or modify\n the terms of any separate license agreement you may have executed\n with Licensor regarding such Contributions.\n\n6. Trademarks. This License does not grant permission to use the trade\n names, trademarks, service marks, or product names of the Licensor,\n except as required for reasonable and customary use in describing the\n origin of the Work and reproducing the content of the NOTICE file.\n\n7. Disclaimer of Warranty. Unless required by applicable law or\n agreed to in writing, Licensor provides the Work (and each\n Contributor provides its Contributions) on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n implied, including, without limitation, any warranties or conditions\n of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n PARTICULAR PURPOSE. You are solely responsible for determining the\n appropriateness of using or redistributing the Work and assume any\n risks associated with Your exercise of permissions under this License.\n\n8. Limitation of Liability. In no event and under no legal theory,\n whether in tort (including negligence), contract, or otherwise,\n unless required by applicable law (such as deliberate and grossly\n negligent acts) or agreed to in writing, shall any Contributor be\n liable to You for damages, including any direct, indirect, special,\n incidental, or consequential damages of any character arising as a\n result of this License or out of the use or inability to use the\n Work (including but not limited to damages for loss of goodwill,\n work stoppage, computer failure or malfunction, or any and all\n other commercial damages or losses), even if such Contributor\n has been advised of the possibility of such damages.\n\n9. Accepting Warranty or Additional Liability. While redistributing\n the Work or Derivative Works thereof, You may choose to offer,\n and charge a fee for, acceptance of support, warranty, indemnity,\n or other liability obligations and/or rights consistent with this\n License. However, in accepting such obligations, You may act only\n on Your own behalf and on Your sole responsibility, not on behalf\n of any other Contributor, and only if You agree to indemnify,\n defend, and hold each Contributor harmless for any liability\n incurred by, or claims asserted against, such Contributor by reason\n of your accepting any such warranty or additional liability.\n\nEND OF TERMS AND CONDITIONS\n\nAPPENDIX: How to apply the Apache License to your work.\n\n To apply the Apache License to your work, attach the following\n boilerplate notice, with the fields enclosed by brackets \"[]\"\n replaced with your own identifying information. (Don't include\n the brackets!) The text should be enclosed in the appropriate\n comment syntax for the file format. We also recommend that a\n file or class name and description of purpose be included on the\n same \"printed page\" as the copyright notice for easier\n identification within third-party archives.\n\nCopyright [yyyy] [name of copyright owner]\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n\thttp://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n" +- package_name: core-foundation + package_version: 0.10.0 + repository: https://github.com/servo/core-foundation-rs + license: MIT OR Apache-2.0 + licenses: + - license: MIT + text: | + Copyright (c) 2012-2013 Mozilla Foundation + + Permission is hereby granted, free of charge, to any + person obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the + Software without restriction, including without + limitation the rights to use, copy, modify, merge, + publish, distribute, sublicense, and/or sell copies of + the Software, and to permit persons to whom the Software + is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice + shall be included in all copies or substantial portions + of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF + ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED + TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A + PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT + SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR + IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + - license: Apache-2.0 + text: " Apache License\n Version 2.0, January 2004\n http://www.apache.org/licenses/\n\nTERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n1. Definitions.\n\n \"License\" shall mean the terms and conditions for use, reproduction,\n and distribution as defined by Sections 1 through 9 of this document.\n\n \"Licensor\" shall mean the copyright owner or entity authorized by\n the copyright owner that is granting the License.\n\n \"Legal Entity\" shall mean the union of the acting entity and all\n other entities that control, are controlled by, or are under common\n control with that entity. For the purposes of this definition,\n \"control\" means (i) the power, direct or indirect, to cause the\n direction or management of such entity, whether by contract or\n otherwise, or (ii) ownership of fifty percent (50%) or more of the\n outstanding shares, or (iii) beneficial ownership of such entity.\n\n \"You\" (or \"Your\") shall mean an individual or Legal Entity\n exercising permissions granted by this License.\n\n \"Source\" form shall mean the preferred form for making modifications,\n including but not limited to software source code, documentation\n source, and configuration files.\n\n \"Object\" form shall mean any form resulting from mechanical\n transformation or translation of a Source form, including but\n not limited to compiled object code, generated documentation,\n and conversions to other media types.\n\n \"Work\" shall mean the work of authorship, whether in Source or\n Object form, made available under the License, as indicated by a\n copyright notice that is included in or attached to the work\n (an example is provided in the Appendix below).\n\n \"Derivative Works\" shall mean any work, whether in Source or Object\n form, that is based on (or derived from) the Work and for which the\n editorial revisions, annotations, elaborations, or other modifications\n represent, as a whole, an original work of authorship. For the purposes\n of this License, Derivative Works shall not include works that remain\n separable from, or merely link (or bind by name) to the interfaces of,\n the Work and Derivative Works thereof.\n\n \"Contribution\" shall mean any work of authorship, including\n the original version of the Work and any modifications or additions\n to that Work or Derivative Works thereof, that is intentionally\n submitted to Licensor for inclusion in the Work by the copyright owner\n or by an individual or Legal Entity authorized to submit on behalf of\n the copyright owner. For the purposes of this definition, \"submitted\"\n means any form of electronic, verbal, or written communication sent\n to the Licensor or its representatives, including but not limited to\n communication on electronic mailing lists, source code control systems,\n and issue tracking systems that are managed by, or on behalf of, the\n Licensor for the purpose of discussing and improving the Work, but\n excluding communication that is conspicuously marked or otherwise\n designated in writing by the copyright owner as \"Not a Contribution.\"\n\n \"Contributor\" shall mean Licensor and any individual or Legal Entity\n on behalf of whom a Contribution has been received by Licensor and\n subsequently incorporated within the Work.\n\n2. Grant of Copyright License. Subject to the terms and conditions of\n this License, each Contributor hereby grants to You a perpetual,\n worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n copyright license to reproduce, prepare Derivative Works of,\n publicly display, publicly perform, sublicense, and distribute the\n Work and such Derivative Works in Source or Object form.\n\n3. Grant of Patent License. Subject to the terms and conditions of\n this License, each Contributor hereby grants to You a perpetual,\n worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n (except as stated in this section) patent license to make, have made,\n use, offer to sell, sell, import, and otherwise transfer the Work,\n where such license applies only to those patent claims licensable\n by such Contributor that are necessarily infringed by their\n Contribution(s) alone or by combination of their Contribution(s)\n with the Work to which such Contribution(s) was submitted. If You\n institute patent litigation against any entity (including a\n cross-claim or counterclaim in a lawsuit) alleging that the Work\n or a Contribution incorporated within the Work constitutes direct\n or contributory patent infringement, then any patent licenses\n granted to You under this License for that Work shall terminate\n as of the date such litigation is filed.\n\n4. Redistribution. You may reproduce and distribute copies of the\n Work or Derivative Works thereof in any medium, with or without\n modifications, and in Source or Object form, provided that You\n meet the following conditions:\n\n (a) You must give any other recipients of the Work or\n Derivative Works a copy of this License; and\n\n (b) You must cause any modified files to carry prominent notices\n stating that You changed the files; and\n\n (c) You must retain, in the Source form of any Derivative Works\n that You distribute, all copyright, patent, trademark, and\n attribution notices from the Source form of the Work,\n excluding those notices that do not pertain to any part of\n the Derivative Works; and\n\n (d) If the Work includes a \"NOTICE\" text file as part of its\n distribution, then any Derivative Works that You distribute must\n include a readable copy of the attribution notices contained\n within such NOTICE file, excluding those notices that do not\n pertain to any part of the Derivative Works, in at least one\n of the following places: within a NOTICE text file distributed\n as part of the Derivative Works; within the Source form or\n documentation, if provided along with the Derivative Works; or,\n within a display generated by the Derivative Works, if and\n wherever such third-party notices normally appear. The contents\n of the NOTICE file are for informational purposes only and\n do not modify the License. You may add Your own attribution\n notices within Derivative Works that You distribute, alongside\n or as an addendum to the NOTICE text from the Work, provided\n that such additional attribution notices cannot be construed\n as modifying the License.\n\n You may add Your own copyright statement to Your modifications and\n may provide additional or different license terms and conditions\n for use, reproduction, or distribution of Your modifications, or\n for any such Derivative Works as a whole, provided Your use,\n reproduction, and distribution of the Work otherwise complies with\n the conditions stated in this License.\n\n5. Submission of Contributions. Unless You explicitly state otherwise,\n any Contribution intentionally submitted for inclusion in the Work\n by You to the Licensor shall be under the terms and conditions of\n this License, without any additional terms or conditions.\n Notwithstanding the above, nothing herein shall supersede or modify\n the terms of any separate license agreement you may have executed\n with Licensor regarding such Contributions.\n\n6. Trademarks. This License does not grant permission to use the trade\n names, trademarks, service marks, or product names of the Licensor,\n except as required for reasonable and customary use in describing the\n origin of the Work and reproducing the content of the NOTICE file.\n\n7. Disclaimer of Warranty. Unless required by applicable law or\n agreed to in writing, Licensor provides the Work (and each\n Contributor provides its Contributions) on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n implied, including, without limitation, any warranties or conditions\n of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n PARTICULAR PURPOSE. You are solely responsible for determining the\n appropriateness of using or redistributing the Work and assume any\n risks associated with Your exercise of permissions under this License.\n\n8. Limitation of Liability. In no event and under no legal theory,\n whether in tort (including negligence), contract, or otherwise,\n unless required by applicable law (such as deliberate and grossly\n negligent acts) or agreed to in writing, shall any Contributor be\n liable to You for damages, including any direct, indirect, special,\n incidental, or consequential damages of any character arising as a\n result of this License or out of the use or inability to use the\n Work (including but not limited to damages for loss of goodwill,\n work stoppage, computer failure or malfunction, or any and all\n other commercial damages or losses), even if such Contributor\n has been advised of the possibility of such damages.\n\n9. Accepting Warranty or Additional Liability. While redistributing\n the Work or Derivative Works thereof, You may choose to offer,\n and charge a fee for, acceptance of support, warranty, indemnity,\n or other liability obligations and/or rights consistent with this\n License. However, in accepting such obligations, You may act only\n on Your own behalf and on Your sole responsibility, not on behalf\n of any other Contributor, and only if You agree to indemnify,\n defend, and hold each Contributor harmless for any liability\n incurred by, or claims asserted against, such Contributor by reason\n of your accepting any such warranty or additional liability.\n\nEND OF TERMS AND CONDITIONS\n\nAPPENDIX: How to apply the Apache License to your work.\n\n To apply the Apache License to your work, attach the following\n boilerplate notice, with the fields enclosed by brackets \"[]\"\n replaced with your own identifying information. (Don't include\n the brackets!) The text should be enclosed in the appropriate\n comment syntax for the file format. We also recommend that a\n file or class name and description of purpose be included on the\n same \"printed page\" as the copyright notice for easier\n identification within third-party archives.\n\nCopyright [yyyy] [name of copyright owner]\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n\thttp://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n" - package_name: core-foundation-sys package_version: 0.8.7 repository: https://github.com/servo/core-foundation-rs @@ -13225,14 +13282,37 @@ third_party_libraries: OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - package_name: hyper-multipart-rfc7578 - package_version: 0.7.0 + package_version: 0.8.0 repository: https://github.com/ferristseng/rust-multipart-rfc7578 license: MIT OR Apache-2.0 licenses: - license: MIT - text: NOT FOUND + text: | + Permission is hereby granted, free of charge, to any + person obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the + Software without restriction, including without + limitation the rights to use, copy, modify, merge, + publish, distribute, sublicense, and/or sell copies of + the Software, and to permit persons to whom the Software + is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice + shall be included in all copies or substantial portions + of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF + ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED + TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A + PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT + SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR + IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. - license: Apache-2.0 - text: NOT FOUND + text: " Apache License\n Version 2.0, January 2004\n http://www.apache.org/licenses/\n\nTERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n1. Definitions.\n\n \"License\" shall mean the terms and conditions for use, reproduction,\n and distribution as defined by Sections 1 through 9 of this document.\n\n \"Licensor\" shall mean the copyright owner or entity authorized by\n the copyright owner that is granting the License.\n\n \"Legal Entity\" shall mean the union of the acting entity and all\n other entities that control, are controlled by, or are under common\n control with that entity. For the purposes of this definition,\n \"control\" means (i) the power, direct or indirect, to cause the\n direction or management of such entity, whether by contract or\n otherwise, or (ii) ownership of fifty percent (50%) or more of the\n outstanding shares, or (iii) beneficial ownership of such entity.\n\n \"You\" (or \"Your\") shall mean an individual or Legal Entity\n exercising permissions granted by this License.\n\n \"Source\" form shall mean the preferred form for making modifications,\n including but not limited to software source code, documentation\n source, and configuration files.\n\n \"Object\" form shall mean any form resulting from mechanical\n transformation or translation of a Source form, including but\n not limited to compiled object code, generated documentation,\n and conversions to other media types.\n\n \"Work\" shall mean the work of authorship, whether in Source or\n Object form, made available under the License, as indicated by a\n copyright notice that is included in or attached to the work\n (an example is provided in the Appendix below).\n\n \"Derivative Works\" shall mean any work, whether in Source or Object\n form, that is based on (or derived from) the Work and for which the\n editorial revisions, annotations, elaborations, or other modifications\n represent, as a whole, an original work of authorship. For the purposes\n of this License, Derivative Works shall not include works that remain\n separable from, or merely link (or bind by name) to the interfaces of,\n the Work and Derivative Works thereof.\n\n \"Contribution\" shall mean any work of authorship, including\n the original version of the Work and any modifications or additions\n to that Work or Derivative Works thereof, that is intentionally\n submitted to Licensor for inclusion in the Work by the copyright owner\n or by an individual or Legal Entity authorized to submit on behalf of\n the copyright owner. For the purposes of this definition, \"submitted\"\n means any form of electronic, verbal, or written communication sent\n to the Licensor or its representatives, including but not limited to\n communication on electronic mailing lists, source code control systems,\n and issue tracking systems that are managed by, or on behalf of, the\n Licensor for the purpose of discussing and improving the Work, but\n excluding communication that is conspicuously marked or otherwise\n designated in writing by the copyright owner as \"Not a Contribution.\"\n\n \"Contributor\" shall mean Licensor and any individual or Legal Entity\n on behalf of whom a Contribution has been received by Licensor and\n subsequently incorporated within the Work.\n\n2. Grant of Copyright License. Subject to the terms and conditions of\n this License, each Contributor hereby grants to You a perpetual,\n worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n copyright license to reproduce, prepare Derivative Works of,\n publicly display, publicly perform, sublicense, and distribute the\n Work and such Derivative Works in Source or Object form.\n\n3. Grant of Patent License. Subject to the terms and conditions of\n this License, each Contributor hereby grants to You a perpetual,\n worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n (except as stated in this section) patent license to make, have made,\n use, offer to sell, sell, import, and otherwise transfer the Work,\n where such license applies only to those patent claims licensable\n by such Contributor that are necessarily infringed by their\n Contribution(s) alone or by combination of their Contribution(s)\n with the Work to which such Contribution(s) was submitted. If You\n institute patent litigation against any entity (including a\n cross-claim or counterclaim in a lawsuit) alleging that the Work\n or a Contribution incorporated within the Work constitutes direct\n or contributory patent infringement, then any patent licenses\n granted to You under this License for that Work shall terminate\n as of the date such litigation is filed.\n\n4. Redistribution. You may reproduce and distribute copies of the\n Work or Derivative Works thereof in any medium, with or without\n modifications, and in Source or Object form, provided that You\n meet the following conditions:\n\n (a) You must give any other recipients of the Work or\n Derivative Works a copy of this License; and\n\n (b) You must cause any modified files to carry prominent notices\n stating that You changed the files; and\n\n (c) You must retain, in the Source form of any Derivative Works\n that You distribute, all copyright, patent, trademark, and\n attribution notices from the Source form of the Work,\n excluding those notices that do not pertain to any part of\n the Derivative Works; and\n\n (d) If the Work includes a \"NOTICE\" text file as part of its\n distribution, then any Derivative Works that You distribute must\n include a readable copy of the attribution notices contained\n within such NOTICE file, excluding those notices that do not\n pertain to any part of the Derivative Works, in at least one\n of the following places: within a NOTICE text file distributed\n as part of the Derivative Works; within the Source form or\n documentation, if provided along with the Derivative Works; or,\n within a display generated by the Derivative Works, if and\n wherever such third-party notices normally appear. The contents\n of the NOTICE file are for informational purposes only and\n do not modify the License. You may add Your own attribution\n notices within Derivative Works that You distribute, alongside\n or as an addendum to the NOTICE text from the Work, provided\n that such additional attribution notices cannot be construed\n as modifying the License.\n\n You may add Your own copyright statement to Your modifications and\n may provide additional or different license terms and conditions\n for use, reproduction, or distribution of Your modifications, or\n for any such Derivative Works as a whole, provided Your use,\n reproduction, and distribution of the Work otherwise complies with\n the conditions stated in this License.\n\n5. Submission of Contributions. Unless You explicitly state otherwise,\n any Contribution intentionally submitted for inclusion in the Work\n by You to the Licensor shall be under the terms and conditions of\n this License, without any additional terms or conditions.\n Notwithstanding the above, nothing herein shall supersede or modify\n the terms of any separate license agreement you may have executed\n with Licensor regarding such Contributions.\n\n6. Trademarks. This License does not grant permission to use the trade\n names, trademarks, service marks, or product names of the Licensor,\n except as required for reasonable and customary use in describing the\n origin of the Work and reproducing the content of the NOTICE file.\n\n7. Disclaimer of Warranty. Unless required by applicable law or\n agreed to in writing, Licensor provides the Work (and each\n Contributor provides its Contributions) on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n implied, including, without limitation, any warranties or conditions\n of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n PARTICULAR PURPOSE. You are solely responsible for determining the\n appropriateness of using or redistributing the Work and assume any\n risks associated with Your exercise of permissions under this License.\n\n8. Limitation of Liability. In no event and under no legal theory,\n whether in tort (including negligence), contract, or otherwise,\n unless required by applicable law (such as deliberate and grossly\n negligent acts) or agreed to in writing, shall any Contributor be\n liable to You for damages, including any direct, indirect, special,\n incidental, or consequential damages of any character arising as a\n result of this License or out of the use or inability to use the\n Work (including but not limited to damages for loss of goodwill,\n work stoppage, computer failure or malfunction, or any and all\n other commercial damages or losses), even if such Contributor\n has been advised of the possibility of such damages.\n\n9. Accepting Warranty or Additional Liability. While redistributing\n the Work or Derivative Works thereof, You may choose to offer,\n and charge a fee for, acceptance of support, warranty, indemnity,\n or other liability obligations and/or rights consistent with this\n License. However, in accepting such obligations, You may act only\n on Your own behalf and on Your sole responsibility, not on behalf\n of any other Contributor, and only if You agree to indemnify,\n defend, and hold each Contributor harmless for any liability\n incurred by, or claims asserted against, such Contributor by reason\n of your accepting any such warranty or additional liability.\n\nEND OF TERMS AND CONDITIONS\n\nAPPENDIX: How to apply the Apache License to your work.\n\n To apply the Apache License to your work, attach the following\n boilerplate notice, with the fields enclosed by brackets \"[]\"\n replaced with your own identifying information. (Don't include\n the brackets!) The text should be enclosed in the appropriate\n comment syntax for the file format. We also recommend that a\n file or class name and description of purpose be included on the\n same \"printed page\" as the copyright notice for easier\n identification within third-party archives.\n\nCopyright [yyyy] [name of copyright owner]\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n\thttp://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n" - package_name: hyper-named-pipe package_version: 0.1.0 repository: https://github.com/fussybeaver/hyper-named-pipe @@ -23101,7 +23181,7 @@ third_party_libraries: IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - package_name: rustls-native-certs - package_version: 0.8.0 + package_version: 0.8.1 repository: https://github.com/rustls/rustls-native-certs license: Apache-2.0 OR ISC OR MIT licenses: @@ -23890,6 +23970,35 @@ third_party_libraries: CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - license: Apache-2.0 text: " Apache License\n Version 2.0, January 2004\n http://www.apache.org/licenses/\n\nTERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n1. Definitions.\n\n \"License\" shall mean the terms and conditions for use, reproduction,\n and distribution as defined by Sections 1 through 9 of this document.\n\n \"Licensor\" shall mean the copyright owner or entity authorized by\n the copyright owner that is granting the License.\n\n \"Legal Entity\" shall mean the union of the acting entity and all\n other entities that control, are controlled by, or are under common\n control with that entity. For the purposes of this definition,\n \"control\" means (i) the power, direct or indirect, to cause the\n direction or management of such entity, whether by contract or\n otherwise, or (ii) ownership of fifty percent (50%) or more of the\n outstanding shares, or (iii) beneficial ownership of such entity.\n\n \"You\" (or \"Your\") shall mean an individual or Legal Entity\n exercising permissions granted by this License.\n\n \"Source\" form shall mean the preferred form for making modifications,\n including but not limited to software source code, documentation\n source, and configuration files.\n\n \"Object\" form shall mean any form resulting from mechanical\n transformation or translation of a Source form, including but\n not limited to compiled object code, generated documentation,\n and conversions to other media types.\n\n \"Work\" shall mean the work of authorship, whether in Source or\n Object form, made available under the License, as indicated by a\n copyright notice that is included in or attached to the work\n (an example is provided in the Appendix below).\n\n \"Derivative Works\" shall mean any work, whether in Source or Object\n form, that is based on (or derived from) the Work and for which the\n editorial revisions, annotations, elaborations, or other modifications\n represent, as a whole, an original work of authorship. For the purposes\n of this License, Derivative Works shall not include works that remain\n separable from, or merely link (or bind by name) to the interfaces of,\n the Work and Derivative Works thereof.\n\n \"Contribution\" shall mean any work of authorship, including\n the original version of the Work and any modifications or additions\n to that Work or Derivative Works thereof, that is intentionally\n submitted to Licensor for inclusion in the Work by the copyright owner\n or by an individual or Legal Entity authorized to submit on behalf of\n the copyright owner. For the purposes of this definition, \"submitted\"\n means any form of electronic, verbal, or written communication sent\n to the Licensor or its representatives, including but not limited to\n communication on electronic mailing lists, source code control systems,\n and issue tracking systems that are managed by, or on behalf of, the\n Licensor for the purpose of discussing and improving the Work, but\n excluding communication that is conspicuously marked or otherwise\n designated in writing by the copyright owner as \"Not a Contribution.\"\n\n \"Contributor\" shall mean Licensor and any individual or Legal Entity\n on behalf of whom a Contribution has been received by Licensor and\n subsequently incorporated within the Work.\n\n2. Grant of Copyright License. Subject to the terms and conditions of\n this License, each Contributor hereby grants to You a perpetual,\n worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n copyright license to reproduce, prepare Derivative Works of,\n publicly display, publicly perform, sublicense, and distribute the\n Work and such Derivative Works in Source or Object form.\n\n3. Grant of Patent License. Subject to the terms and conditions of\n this License, each Contributor hereby grants to You a perpetual,\n worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n (except as stated in this section) patent license to make, have made,\n use, offer to sell, sell, import, and otherwise transfer the Work,\n where such license applies only to those patent claims licensable\n by such Contributor that are necessarily infringed by their\n Contribution(s) alone or by combination of their Contribution(s)\n with the Work to which such Contribution(s) was submitted. If You\n institute patent litigation against any entity (including a\n cross-claim or counterclaim in a lawsuit) alleging that the Work\n or a Contribution incorporated within the Work constitutes direct\n or contributory patent infringement, then any patent licenses\n granted to You under this License for that Work shall terminate\n as of the date such litigation is filed.\n\n4. Redistribution. You may reproduce and distribute copies of the\n Work or Derivative Works thereof in any medium, with or without\n modifications, and in Source or Object form, provided that You\n meet the following conditions:\n\n (a) You must give any other recipients of the Work or\n Derivative Works a copy of this License; and\n\n (b) You must cause any modified files to carry prominent notices\n stating that You changed the files; and\n\n (c) You must retain, in the Source form of any Derivative Works\n that You distribute, all copyright, patent, trademark, and\n attribution notices from the Source form of the Work,\n excluding those notices that do not pertain to any part of\n the Derivative Works; and\n\n (d) If the Work includes a \"NOTICE\" text file as part of its\n distribution, then any Derivative Works that You distribute must\n include a readable copy of the attribution notices contained\n within such NOTICE file, excluding those notices that do not\n pertain to any part of the Derivative Works, in at least one\n of the following places: within a NOTICE text file distributed\n as part of the Derivative Works; within the Source form or\n documentation, if provided along with the Derivative Works; or,\n within a display generated by the Derivative Works, if and\n wherever such third-party notices normally appear. The contents\n of the NOTICE file are for informational purposes only and\n do not modify the License. You may add Your own attribution\n notices within Derivative Works that You distribute, alongside\n or as an addendum to the NOTICE text from the Work, provided\n that such additional attribution notices cannot be construed\n as modifying the License.\n\n You may add Your own copyright statement to Your modifications and\n may provide additional or different license terms and conditions\n for use, reproduction, or distribution of Your modifications, or\n for any such Derivative Works as a whole, provided Your use,\n reproduction, and distribution of the Work otherwise complies with\n the conditions stated in this License.\n\n5. Submission of Contributions. Unless You explicitly state otherwise,\n any Contribution intentionally submitted for inclusion in the Work\n by You to the Licensor shall be under the terms and conditions of\n this License, without any additional terms or conditions.\n Notwithstanding the above, nothing herein shall supersede or modify\n the terms of any separate license agreement you may have executed\n with Licensor regarding such Contributions.\n\n6. Trademarks. This License does not grant permission to use the trade\n names, trademarks, service marks, or product names of the Licensor,\n except as required for reasonable and customary use in describing the\n origin of the Work and reproducing the content of the NOTICE file.\n\n7. Disclaimer of Warranty. Unless required by applicable law or\n agreed to in writing, Licensor provides the Work (and each\n Contributor provides its Contributions) on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n implied, including, without limitation, any warranties or conditions\n of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n PARTICULAR PURPOSE. You are solely responsible for determining the\n appropriateness of using or redistributing the Work and assume any\n risks associated with Your exercise of permissions under this License.\n\n8. Limitation of Liability. In no event and under no legal theory,\n whether in tort (including negligence), contract, or otherwise,\n unless required by applicable law (such as deliberate and grossly\n negligent acts) or agreed to in writing, shall any Contributor be\n liable to You for damages, including any direct, indirect, special,\n incidental, or consequential damages of any character arising as a\n result of this License or out of the use or inability to use the\n Work (including but not limited to damages for loss of goodwill,\n work stoppage, computer failure or malfunction, or any and all\n other commercial damages or losses), even if such Contributor\n has been advised of the possibility of such damages.\n\n9. Accepting Warranty or Additional Liability. While redistributing\n the Work or Derivative Works thereof, You may choose to offer,\n and charge a fee for, acceptance of support, warranty, indemnity,\n or other liability obligations and/or rights consistent with this\n License. However, in accepting such obligations, You may act only\n on Your own behalf and on Your sole responsibility, not on behalf\n of any other Contributor, and only if You agree to indemnify,\n defend, and hold each Contributor harmless for any liability\n incurred by, or claims asserted against, such Contributor by reason\n of your accepting any such warranty or additional liability.\n\nEND OF TERMS AND CONDITIONS\n\nAPPENDIX: How to apply the Apache License to your work.\n\n To apply the Apache License to your work, attach the following\n boilerplate notice, with the fields enclosed by brackets \"[]\"\n replaced with your own identifying information. (Don't include\n the brackets!) The text should be enclosed in the appropriate\n comment syntax for the file format. We also recommend that a\n file or class name and description of purpose be included on the\n same \"printed page\" as the copyright notice for easier\n identification within third-party archives.\n\nCopyright [yyyy] [name of copyright owner]\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n\thttp://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n" +- package_name: security-framework + package_version: 3.0.1 + repository: https://github.com/kornelski/rust-security-framework + license: MIT OR Apache-2.0 + licenses: + - license: MIT + text: | + The MIT License (MIT) + + Copyright (c) 2015 Steven Fackler + + Permission is hereby granted, free of charge, to any person obtaining a copy of + this software and associated documentation files (the "Software"), to deal in + the Software without restriction, including without limitation the rights to + use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + the Software, and to permit persons to whom the Software is furnished to do so, + subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + - license: Apache-2.0 + text: " Apache License\n Version 2.0, January 2004\n http://www.apache.org/licenses/\n\nTERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n1. Definitions.\n\n \"License\" shall mean the terms and conditions for use, reproduction,\n and distribution as defined by Sections 1 through 9 of this document.\n\n \"Licensor\" shall mean the copyright owner or entity authorized by\n the copyright owner that is granting the License.\n\n \"Legal Entity\" shall mean the union of the acting entity and all\n other entities that control, are controlled by, or are under common\n control with that entity. For the purposes of this definition,\n \"control\" means (i) the power, direct or indirect, to cause the\n direction or management of such entity, whether by contract or\n otherwise, or (ii) ownership of fifty percent (50%) or more of the\n outstanding shares, or (iii) beneficial ownership of such entity.\n\n \"You\" (or \"Your\") shall mean an individual or Legal Entity\n exercising permissions granted by this License.\n\n \"Source\" form shall mean the preferred form for making modifications,\n including but not limited to software source code, documentation\n source, and configuration files.\n\n \"Object\" form shall mean any form resulting from mechanical\n transformation or translation of a Source form, including but\n not limited to compiled object code, generated documentation,\n and conversions to other media types.\n\n \"Work\" shall mean the work of authorship, whether in Source or\n Object form, made available under the License, as indicated by a\n copyright notice that is included in or attached to the work\n (an example is provided in the Appendix below).\n\n \"Derivative Works\" shall mean any work, whether in Source or Object\n form, that is based on (or derived from) the Work and for which the\n editorial revisions, annotations, elaborations, or other modifications\n represent, as a whole, an original work of authorship. For the purposes\n of this License, Derivative Works shall not include works that remain\n separable from, or merely link (or bind by name) to the interfaces of,\n the Work and Derivative Works thereof.\n\n \"Contribution\" shall mean any work of authorship, including\n the original version of the Work and any modifications or additions\n to that Work or Derivative Works thereof, that is intentionally\n submitted to Licensor for inclusion in the Work by the copyright owner\n or by an individual or Legal Entity authorized to submit on behalf of\n the copyright owner. For the purposes of this definition, \"submitted\"\n means any form of electronic, verbal, or written communication sent\n to the Licensor or its representatives, including but not limited to\n communication on electronic mailing lists, source code control systems,\n and issue tracking systems that are managed by, or on behalf of, the\n Licensor for the purpose of discussing and improving the Work, but\n excluding communication that is conspicuously marked or otherwise\n designated in writing by the copyright owner as \"Not a Contribution.\"\n\n \"Contributor\" shall mean Licensor and any individual or Legal Entity\n on behalf of whom a Contribution has been received by Licensor and\n subsequently incorporated within the Work.\n\n2. Grant of Copyright License. Subject to the terms and conditions of\n this License, each Contributor hereby grants to You a perpetual,\n worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n copyright license to reproduce, prepare Derivative Works of,\n publicly display, publicly perform, sublicense, and distribute the\n Work and such Derivative Works in Source or Object form.\n\n3. Grant of Patent License. Subject to the terms and conditions of\n this License, each Contributor hereby grants to You a perpetual,\n worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n (except as stated in this section) patent license to make, have made,\n use, offer to sell, sell, import, and otherwise transfer the Work,\n where such license applies only to those patent claims licensable\n by such Contributor that are necessarily infringed by their\n Contribution(s) alone or by combination of their Contribution(s)\n with the Work to which such Contribution(s) was submitted. If You\n institute patent litigation against any entity (including a\n cross-claim or counterclaim in a lawsuit) alleging that the Work\n or a Contribution incorporated within the Work constitutes direct\n or contributory patent infringement, then any patent licenses\n granted to You under this License for that Work shall terminate\n as of the date such litigation is filed.\n\n4. Redistribution. You may reproduce and distribute copies of the\n Work or Derivative Works thereof in any medium, with or without\n modifications, and in Source or Object form, provided that You\n meet the following conditions:\n\n (a) You must give any other recipients of the Work or\n Derivative Works a copy of this License; and\n\n (b) You must cause any modified files to carry prominent notices\n stating that You changed the files; and\n\n (c) You must retain, in the Source form of any Derivative Works\n that You distribute, all copyright, patent, trademark, and\n attribution notices from the Source form of the Work,\n excluding those notices that do not pertain to any part of\n the Derivative Works; and\n\n (d) If the Work includes a \"NOTICE\" text file as part of its\n distribution, then any Derivative Works that You distribute must\n include a readable copy of the attribution notices contained\n within such NOTICE file, excluding those notices that do not\n pertain to any part of the Derivative Works, in at least one\n of the following places: within a NOTICE text file distributed\n as part of the Derivative Works; within the Source form or\n documentation, if provided along with the Derivative Works; or,\n within a display generated by the Derivative Works, if and\n wherever such third-party notices normally appear. The contents\n of the NOTICE file are for informational purposes only and\n do not modify the License. You may add Your own attribution\n notices within Derivative Works that You distribute, alongside\n or as an addendum to the NOTICE text from the Work, provided\n that such additional attribution notices cannot be construed\n as modifying the License.\n\n You may add Your own copyright statement to Your modifications and\n may provide additional or different license terms and conditions\n for use, reproduction, or distribution of Your modifications, or\n for any such Derivative Works as a whole, provided Your use,\n reproduction, and distribution of the Work otherwise complies with\n the conditions stated in this License.\n\n5. Submission of Contributions. Unless You explicitly state otherwise,\n any Contribution intentionally submitted for inclusion in the Work\n by You to the Licensor shall be under the terms and conditions of\n this License, without any additional terms or conditions.\n Notwithstanding the above, nothing herein shall supersede or modify\n the terms of any separate license agreement you may have executed\n with Licensor regarding such Contributions.\n\n6. Trademarks. This License does not grant permission to use the trade\n names, trademarks, service marks, or product names of the Licensor,\n except as required for reasonable and customary use in describing the\n origin of the Work and reproducing the content of the NOTICE file.\n\n7. Disclaimer of Warranty. Unless required by applicable law or\n agreed to in writing, Licensor provides the Work (and each\n Contributor provides its Contributions) on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n implied, including, without limitation, any warranties or conditions\n of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n PARTICULAR PURPOSE. You are solely responsible for determining the\n appropriateness of using or redistributing the Work and assume any\n risks associated with Your exercise of permissions under this License.\n\n8. Limitation of Liability. In no event and under no legal theory,\n whether in tort (including negligence), contract, or otherwise,\n unless required by applicable law (such as deliberate and grossly\n negligent acts) or agreed to in writing, shall any Contributor be\n liable to You for damages, including any direct, indirect, special,\n incidental, or consequential damages of any character arising as a\n result of this License or out of the use or inability to use the\n Work (including but not limited to damages for loss of goodwill,\n work stoppage, computer failure or malfunction, or any and all\n other commercial damages or losses), even if such Contributor\n has been advised of the possibility of such damages.\n\n9. Accepting Warranty or Additional Liability. While redistributing\n the Work or Derivative Works thereof, You may choose to offer,\n and charge a fee for, acceptance of support, warranty, indemnity,\n or other liability obligations and/or rights consistent with this\n License. However, in accepting such obligations, You may act only\n on Your own behalf and on Your sole responsibility, not on behalf\n of any other Contributor, and only if You agree to indemnify,\n defend, and hold each Contributor harmless for any liability\n incurred by, or claims asserted against, such Contributor by reason\n of your accepting any such warranty or additional liability.\n\nEND OF TERMS AND CONDITIONS\n\nAPPENDIX: How to apply the Apache License to your work.\n\n To apply the Apache License to your work, attach the following\n boilerplate notice, with the fields enclosed by brackets \"[]\"\n replaced with your own identifying information. (Don't include\n the brackets!) The text should be enclosed in the appropriate\n comment syntax for the file format. We also recommend that a\n file or class name and description of purpose be included on the\n same \"printed page\" as the copyright notice for easier\n identification within third-party archives.\n\nCopyright [yyyy] [name of copyright owner]\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n\thttp://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n" - package_name: security-framework-sys package_version: 2.12.0 repository: https://github.com/kornelski/rust-security-framework @@ -28782,6 +28891,214 @@ third_party_libraries: incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. + END OF TERMS AND CONDITIONS +- package_name: thiserror + package_version: 2.0.3 + repository: https://github.com/dtolnay/thiserror + license: MIT OR Apache-2.0 + licenses: + - license: MIT + text: | + Permission is hereby granted, free of charge, to any + person obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the + Software without restriction, including without + limitation the rights to use, copy, modify, merge, + publish, distribute, sublicense, and/or sell copies of + the Software, and to permit persons to whom the Software + is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice + shall be included in all copies or substantial portions + of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF + ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED + TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A + PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT + SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR + IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + - license: Apache-2.0 + text: |2 + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + END OF TERMS AND CONDITIONS - package_name: thiserror-impl package_version: 1.0.68 @@ -28990,6 +29307,214 @@ third_party_libraries: incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. + END OF TERMS AND CONDITIONS +- package_name: thiserror-impl + package_version: 2.0.3 + repository: https://github.com/dtolnay/thiserror + license: MIT OR Apache-2.0 + licenses: + - license: MIT + text: | + Permission is hereby granted, free of charge, to any + person obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the + Software without restriction, including without + limitation the rights to use, copy, modify, merge, + publish, distribute, sublicense, and/or sell copies of + the Software, and to permit persons to whom the Software + is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice + shall be included in all copies or substantial portions + of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF + ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED + TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A + PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT + SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR + IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + - license: Apache-2.0 + text: |2 + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + END OF TERMS AND CONDITIONS - package_name: thread_local package_version: 1.1.8 @@ -33623,7 +34148,7 @@ third_party_libraries: The files under third-party/chromium are licensed as described in third-party/chromium/LICENSE. - package_name: webpki-roots - package_version: 0.26.6 + package_version: 0.26.7 repository: https://github.com/rustls/webpki-roots license: MPL-2.0 licenses: diff --git a/ddcommon-net1/src/connector/mod.rs b/ddcommon-net1/src/connector/mod.rs index a02d05255..23a224bf3 100644 --- a/ddcommon-net1/src/connector/mod.rs +++ b/ddcommon-net1/src/connector/mod.rs @@ -48,6 +48,16 @@ lazy_static! { }; } +#[cfg(not(feature = "use_webpki_roots"))] +lazy_static! { + static ref INIT_CRYPTO_PROVIDER: () = { + #[cfg(unix)] + rustls::crypto::ring::default_provider() + .install_default() + .expect("Failed to install default CryptoProvider"); + }; +} + impl Default for Connector { fn default() -> Self { DEFAULT_CONNECTOR.clone() @@ -123,6 +133,7 @@ fn build_https_connector_with_webpki_roots( #[cfg(not(feature = "use_webpki_roots"))] fn load_root_certs() -> anyhow::Result { + *INIT_CRYPTO_PROVIDER; // One-time initialization of a crypto provider if needed let mut roots = rustls::RootCertStore::empty(); for cert in rustls_native_certs::load_native_certs()? { diff --git a/ddcommon-net2/Cargo.toml b/ddcommon-net2/Cargo.toml new file mode 100644 index 000000000..79b3de318 --- /dev/null +++ b/ddcommon-net2/Cargo.toml @@ -0,0 +1,30 @@ +# Copyright 2024-Present Datadog, Inc. https://www.datadoghq.com/ +# SPDX-License-Identifier: Apache-2.0 + +[package] +name = "ddcommon-net2" +rust-version.workspace = true +edition.workspace = true +version.workspace = true +license.workspace = true + +[lib] +bench = false + +[features] +default = [] +use_native_roots = ["rustls-native-certs", "tokio-rustls/ring"] +use_webpki_roots = ["webpki-roots" ,"tokio-rustls/aws-lc-rs"] + +[dependencies] +ddcommon = { path = "../ddcommon" } +hex = { version = "0.4" } +hyper = { version = "1", default-features = false } +hyper-util = { version = "0.1", default-features = false, features = ["tokio"] } +rustls-native-certs = { version = "0.8", optional = true } +serde = { version = "1.0", features = ["derive"] } +thiserror = { version = "2" } +tokio = { version = "1.41" } +tokio-rustls = { version = "0.26", default-features = false, features = ["logging", "tls12"] } +tokio-util = { version = "0.7" } +webpki-roots = { version = "0.26", optional = true } diff --git a/ddcommon-net2/src/compat.rs b/ddcommon-net2/src/compat.rs new file mode 100644 index 000000000..e72822d98 --- /dev/null +++ b/ddcommon-net2/src/compat.rs @@ -0,0 +1,134 @@ +// Copyright 2021-Present Datadog, Inc. https://www.datadoghq.com/ +// SPDX-License-Identifier: Apache-2.0 + +use hyper::http; + +use ddcommon::entity_id; +use http::request::Builder as HttpRequestBuilder; +use http::{HeaderValue, Uri}; +use serde::{Deserialize, Deserializer, Serialize, Serializer}; +use std::borrow::Cow; +use std::ops::Deref; + +// todo: why do we need to serialize and deserialize endpoints? +#[derive(Clone, PartialEq, Eq, Hash, Debug, Serialize, Deserialize)] +pub struct Endpoint { + #[serde(serialize_with = "serialize_uri", deserialize_with = "deserialize_uri")] + pub url: Uri, + pub api_key: Option>, + pub timeout_ms: u64, + /// Sets X-Datadog-Test-Session-Token header on any request + pub test_token: Option>, +} + +#[derive(serde::Deserialize, serde::Serialize)] +struct SerializedUri<'a> { + scheme: Option>, + authority: Option>, + path_and_query: Option>, +} + +fn serialize_uri(uri: &Uri, serializer: S) -> Result +where + S: Serializer, +{ + let parts = uri.clone().into_parts(); + let uri = SerializedUri { + scheme: parts.scheme.as_ref().map(|s| Cow::Borrowed(s.as_str())), + authority: parts.authority.as_ref().map(|s| Cow::Borrowed(s.as_str())), + path_and_query: parts + .path_and_query + .as_ref() + .map(|s| Cow::Borrowed(s.as_str())), + }; + uri.serialize(serializer) +} + +fn deserialize_uri<'de, D>(deserializer: D) -> Result +where + D: Deserializer<'de>, +{ + let uri = SerializedUri::deserialize(deserializer)?; + let mut builder = hyper::Uri::builder(); + if let Some(v) = uri.authority { + builder = builder.authority(v.deref()); + } + if let Some(v) = uri.scheme { + builder = builder.scheme(v.deref()); + } + if let Some(v) = uri.path_and_query { + builder = builder.path_and_query(v.deref()); + } + + builder.build().map_err(serde::de::Error::custom) +} + +impl Endpoint { + /// Default value for the timeout field in milliseconds. + pub const DEFAULT_TIMEOUT: u64 = 3_000; + + /// Return a request builder with the following headers: + /// - User agent + /// - Api key + /// - Container Id/Entity Id + pub fn to_request_builder(&self, user_agent: &str) -> Result { + let mut builder = hyper::Request::builder() + .uri(self.url.clone()) + .header(hyper::header::USER_AGENT, user_agent); + + // Add the Api key header if available + if let Some(api_key) = &self.api_key { + builder = builder.header(header::DATADOG_API_KEY, HeaderValue::from_str(api_key)?); + } + + // Add the test session token if available + if let Some(token) = &self.test_token { + builder = builder.header( + header::X_DATADOG_TEST_SESSION_TOKEN, + HeaderValue::from_str(token)?, + ); + } + + // Add the Container Id header if available + if let Some(container_id) = entity_id::get_container_id() { + builder = builder.header(header::DATADOG_CONTAINER_ID, container_id); + } + + // Add the Entity Id header if available + if let Some(entity_id) = entity_id::get_entity_id() { + builder = builder.header(header::DATADOG_ENTITY_ID, entity_id); + } + + // Add the External Env header if available + if let Some(external_env) = entity_id::get_external_env() { + builder = builder.header(header::DATADOG_EXTERNAL_ENV, external_env); + } + + Ok(builder) + } +} + +impl From for Endpoint { + fn from(uri: Uri) -> Self { + Self { + url: uri, + api_key: None, + timeout_ms: Endpoint::DEFAULT_TIMEOUT, + test_token: None, + } + } +} + +pub mod header { + #![allow(clippy::declare_interior_mutable_const)] + use hyper::{header::HeaderName, http::HeaderValue}; + pub const DATADOG_CONTAINER_ID: HeaderName = HeaderName::from_static("datadog-container-id"); + pub const DATADOG_ENTITY_ID: HeaderName = HeaderName::from_static("datadog-entity-id"); + pub const DATADOG_EXTERNAL_ENV: HeaderName = HeaderName::from_static("datadog-external-env"); + pub const DATADOG_TRACE_COUNT: HeaderName = HeaderName::from_static("x-datadog-trace-count"); + pub const DATADOG_API_KEY: HeaderName = HeaderName::from_static("dd-api-key"); + pub const APPLICATION_JSON: HeaderValue = HeaderValue::from_static("application/json"); + pub const APPLICATION_MSGPACK: HeaderValue = HeaderValue::from_static("application/msgpack"); + pub const X_DATADOG_TEST_SESSION_TOKEN: HeaderName = + HeaderName::from_static("x-datadog-test-session-token"); +} diff --git a/ddcommon-net2/src/http.rs b/ddcommon-net2/src/http.rs new file mode 100644 index 000000000..624f86af9 --- /dev/null +++ b/ddcommon-net2/src/http.rs @@ -0,0 +1,348 @@ +// Copyright 2024-Present Datadog, Inc. https://www.datadoghq.com/ +// SPDX-License-Identifier: Apache-2.0 + +use hyper::http; + +use hex::FromHex; +use http::{Request, Response, Uri}; +use hyper::body::{Body, Incoming}; +use hyper::rt::{Read, Write}; +use hyper_util::rt::TokioIo; +use std::result::Result as StdResult; +use std::{io, path, sync, time}; +use tokio::net::TcpStream; +use tokio::time::error::Elapsed; +use tokio_rustls::rustls; +use tokio_rustls::rustls::pki_types::ServerName; +use tokio_util::sync::CancellationToken; + +pub trait UriExt { + fn from_path(scheme: S, path: P) -> http::Result + where + http::uri::Scheme: TryFrom, + >::Error: Into, + P: AsRef; +} + +impl UriExt for Uri { + /// Encode the [path::Path] into a URI with the provided scheme. Since file + /// system paths are not valid "authority"s in URIs, the path is + /// hex-encoded. + fn from_path(scheme: S, path: P) -> http::Result + where + http::uri::Scheme: TryFrom, + >::Error: Into, + P: AsRef, + { + let path = path.as_ref(); + let hex_encoded_path = { + // On Unix we can convert the Path's OsStr into &[u8] using a + // trait from the prelude. This is possible because OsStr on Unix + // are basically just byte strings anyway. + #[cfg(unix)] + { + use std::os::unix::prelude::*; + hex::encode(path.as_os_str().as_bytes()) + } + + #[cfg(not(unix))] + // But on other platforms, notably Windows, there is not an API + // for this. So we have to either convert it to UTF lossily, or + // panic, or handle in some other way the conversion. + // This chooses to panic because that's what the implementation in + // ddcommon did. + { + hex::encode(path.to_str().unwrap().as_bytes()) + } + }; + Uri::builder() + .scheme(scheme) + .authority(hex_encoded_path) + .build() + } +} + +#[derive(Debug, thiserror::Error)] +pub enum Error { + #[error(transparent)] + Dns(#[from] rustls::pki_types::InvalidDnsNameError), + + #[error(transparent)] + Http(#[from] http::Error), + + #[error(transparent)] + Hyper(#[from] hyper::Error), + + #[error(transparent)] + Io(#[from] io::Error), + + #[error("secure connections require ClientConfig, none provided")] + MissingConfig, + + #[error(transparent)] + Rustls(#[from] rustls::Error), + + #[error(transparent)] + Timeout(#[from] Elapsed), + + #[error("unsupported scheme: `{0}`")] + UnsupportedScheme(String), + + #[error("user requested cancellation")] + UserRequestedCancellation, +} + +pub struct Client { + config: Option>, + runtime: tokio::runtime::Runtime, +} + +impl Client { + /// Create a client from the given config and runtime. For do-it-yourself + /// types and testing. + pub const fn new( + config: Option>, + runtime: tokio::runtime::Runtime, + ) -> Self { + Self { config, runtime } + } + + /// Create a client with the native cert store and use a current thread + /// runtime. + #[cfg(feature = "use_native_roots")] + pub fn use_native_roots_on_current_thread() -> Result { + let provider = crate::crytpo::Provider::use_native_roots(); + let config = provider.get_client_config(); + let runtime = crate::rt::create_current_thread_runtime()?; + Ok(Client { config, runtime }) + } + + /// Create a client with the webpki certs and use a current thread runtime. + #[cfg(feature = "use_webpki_roots")] + pub fn use_webpki_roots_on_current_thread() -> Result { + let provider = crate::crytpo::Provider::use_webpki_roots(); + let config = provider.get_client_config(); + let runtime = crate::rt::create_current_thread_runtime()?; + Ok(Client { config, runtime }) + } + + pub fn send( + &self, + request: Request, + cancel: Option<&CancellationToken>, + timeout: Option, + ) -> Result, Error> + where + B: Body + Send + 'static, + B::Data: Send, + B::Error: Into>, + { + let client_config = self.config.clone(); + self.runtime.block_on(async move { + tokio::select! { + result = async { match timeout { + Some(t) => { + tokio::time::timeout(t, send_and_infer_connector(client_config, request)) + .await? + } + None => send_and_infer_connector(client_config, request).await, + }} => result, + _ = async { match cancel { + Some(token) => token.cancelled().await, + // If no token is provided, future::pending() provides a + // no-op future that never resolves. + None => std::future::pending().await, + }} => Err(Error::UserRequestedCancellation), + } + }) + } +} + +pub async fn send_and_infer_connector( + client_config: Option>, + request: Request, +) -> StdResult, Error> +where + B: Body + Send + 'static, + B::Data: Send, + B::Error: Into>, +{ + let uri = request.uri(); + match uri.scheme() { + None => Err(Error::UnsupportedScheme(String::new())), + Some(scheme) => match scheme.as_str() { + "http" => send_http(request).await, + "https" => { + if let Some(client_config) = client_config { + send_https(client_config, request).await + } else { + Err(Error::MissingConfig) + } + } + #[cfg(unix)] + "unix" => send_via_unix_socket(request).await, + #[cfg(windows)] + "windows" => send_via_named_pipe(request).await, + scheme => Err(Error::UnsupportedScheme(String::from(scheme))), + }, + } +} + +#[cfg(unix)] +pub async fn send_via_unix_socket(request: Request) -> StdResult, Error> +where + B: Body + Send + 'static, + B::Data: Send, + B::Error: Into>, +{ + let path = parse_path_from_uri(request.uri())?; + let unix_stream = tokio::net::UnixStream::connect(path).await?; + let hyper_wrapper = TokioIo::new(unix_stream); + + Ok(send_via_io(request, hyper_wrapper).await?) +} + +#[cfg(windows)] +pub async fn send_via_named_pipe(request: Request) -> StdResult, Error> +where + B: Body + Send + 'static, + B::Data: Send, + B::Error: Into>, +{ + let _path = parse_path_from_uri(request.uri())?; + todo!("re-implement named pipes on Windows") +} + +pub async fn send_http(request: Request) -> StdResult, Error> +where + B: Body + Send + 'static, + B::Data: Send, + B::Error: Into>, +{ + // This _should_ be a redundant check, caller should only call this if + // they expect it's an http connection to begin with. + let scheme_str = request.uri().scheme_str(); + if scheme_str != Some("http") { + let base = "URI scheme must be http"; + let msg = if let Some(scheme) = scheme_str { + format!("{base}, given {scheme}") + } else { + format!("{base}, empty scheme found") + }; + let err = io::Error::new(io::ErrorKind::InvalidInput, msg); + return Err(Error::from(err)); + } + + let authority = request + .uri() + .authority() + .ok_or(Error::Io(io::Error::new( + io::ErrorKind::InvalidInput, + "URI must have host", + )))? + .as_str(); + let stream = TcpStream::connect(authority).await?; + let hyper_wrapper = TokioIo::new(stream); + + Ok(send_via_io(request, hyper_wrapper).await?) +} + +pub async fn send_https( + client_config: sync::Arc, + request: Request, +) -> StdResult, Error> +where + B: Body + Send + 'static, + B::Data: Send, + B::Error: Into>, +{ + let uri = request.uri(); + + // This _should_ be a redundant check, caller should only call this if + // they expect it's an https connection to begin with. + let scheme_str = request.uri().scheme_str(); + if scheme_str != Some("https") { + let base = "URI scheme must be https"; + let msg = if let Some(scheme) = scheme_str { + format!("{base}, given {scheme}") + } else { + format!("{base}, empty scheme found") + }; + let err = io::Error::new(io::ErrorKind::InvalidInput, msg); + return Err(Error::from(err)); + } + + let server_name = ServerName::try_from(uri.to_string())?; + let connector = tokio_rustls::TlsConnector::from(client_config); + + let tcp_stream = { + let authority = uri.authority().ok_or(Error::Io(io::Error::new( + io::ErrorKind::InvalidInput, + "URI must have a host", + )))?; + TcpStream::connect(authority.as_str()).await? + }; + + let stream = connector.connect(server_name, tcp_stream).await?; + let hyper_wrapper = TokioIo::new(stream); + Ok(send_via_io(request, hyper_wrapper).await?) +} + +async fn send_via_io( + request: Request, + io: T, +) -> StdResult, hyper::Error> +where + T: Read + Write + Send + Unpin + 'static, + B: Body + Send + 'static, + B::Data: Send, + B::Error: Into>, +{ + let (mut sender, connection) = hyper::client::conn::http1::handshake(io).await?; + + // The docs say we need to poll this to drive it to completion, but they + // never directly use the return type or anything: + // https://hyper.rs/guides/1/client/basic/ + let _todo = tokio::spawn(connection); + + sender.send_request(request).await +} + +pub fn parse_path_from_uri(uri: &Uri) -> io::Result { + // This _should_ be a redundant check, caller should only call this if + // they expect it's a unix domain socket or windows named pipe. + let scheme_str = uri.scheme_str(); + if scheme_str != Some("unix") || scheme_str != Some("windows") { + let base = "URI scheme must be unix or windows"; + let msg = if let Some(scheme) = scheme_str { + format!("{base}, given {scheme}") + } else { + format!("{base}, empty scheme found") + }; + return Err(io::Error::new(io::ErrorKind::InvalidInput, msg)); + } + + if let Some(host) = uri.host() { + let bytes = Vec::from_hex(host).map_err(|err| { + io::Error::new( + io::ErrorKind::InvalidInput, + format!("URI host must be a hex-encoded path: {err}"), + ) + })?; + let str = match std::str::from_utf8(&bytes) { + Ok(s) => s, + Err(err) => { + return Err(io::Error::new( + io::ErrorKind::InvalidInput, + format!("URI is invalid: {err}"), + )) + } + }; + Ok(path::PathBuf::from(str)) + } else { + Err(io::Error::new( + io::ErrorKind::InvalidInput, + "URI is missing host", + )) + } +} diff --git a/ddcommon-net2/src/lib.rs b/ddcommon-net2/src/lib.rs new file mode 100644 index 000000000..df2165972 --- /dev/null +++ b/ddcommon-net2/src/lib.rs @@ -0,0 +1,112 @@ +// Copyright 2024-Present Datadog, Inc. https://www.datadoghq.com/ +// SPDX-License-Identifier: Apache-2.0 + +/// Provides _some_ migration paths from the ddcommon +pub mod compat; + +/// The http module has types and functions for working with HTTP requests +/// through hyper and tokio. Generally, we do not need asynchronous execution, +/// but we do need features like HTTP over UNIX Domain Sockets (UDS) and +/// Windows Named Pipes. This aims to provide a simple API for doing blocking, +/// synchronous HTTP calls with all the different connectors we support. +pub mod http; + +/// This module exports some dependencies so that crates depending on this +/// one do not also have to directly depend on and manage the versions. +pub mod dep { + pub use hex; + pub use hyper::{self, http}; + pub use tokio; + pub use tokio_rustls::{self, rustls}; +} + +pub mod crytpo { + use std::sync::Arc; + use tokio_rustls::rustls; + + #[derive(Clone, Debug)] + pub enum Provider { + #[cfg(feature = "use_native_roots")] + Native(Arc), + + #[cfg(feature = "use_webpki_roots")] + Webpki(Arc), + + // This won't work for TLS. + None, + } + + impl Provider { + pub const fn none() -> Self { + Provider::None + } + + #[cfg(feature = "use_webpki_roots")] + pub fn use_webpki_roots() -> Provider { + Provider::Webpki(Arc::new(rustls::crypto::aws_lc_rs::default_provider())) + } + + #[cfg(feature = "use_native_roots")] + pub fn use_native_roots() -> Provider { + Provider::Native(Arc::new(rustls::crypto::ring::default_provider())) + } + + /// Create the [rustls::ClientConfig] for the provider. Note that this + /// can be expensive and should be called sparingly. + pub fn get_client_config(&self) -> Option> { + let mut cert_store = rustls::RootCertStore::empty(); + + let maybe_provider: Option> = match self { + #[cfg(feature = "use_native_roots")] + Provider::Native(crypto_provider) => { + // Its docs say: + // > This function can be expensive: on some platforms it + // > involves loading and parsing a ~300KB disk file. It's + // > therefore prudent to call this sparingly. + let certs = rustls_native_certs::load_native_certs().certs; + + // It is unlikely that the end-user selects HTTPs, so there's + // no need to hard-error here if certificates aren't added. + _ = cert_store.add_parsable_certificates(certs); + Some(crypto_provider.clone()) + } + + #[cfg(feature = "use_webpki_roots")] + Provider::Webpki(crypto_provider) => { + cert_store.extend(webpki_roots::TLS_SERVER_ROOTS.iter().cloned()); + Some(crypto_provider.clone()) + } + + Provider::None => None, + }; + + maybe_provider.and_then(|provider| { + let client_config = rustls::ClientConfig::builder_with_provider(provider) + .with_protocol_versions(rustls::DEFAULT_VERSIONS) + .ok()? + .with_root_certificates(cert_store) + .with_no_client_auth(); + Some(Arc::new(client_config)) + }) + } + } +} + +/// Holds a function to create a Tokio Runtime for the current thread. +/// Note that currently it will still use a thread pool for certain operations +/// which block. +pub mod rt { + use std::io; + use tokio::runtime; + use tokio_util::sync::CancellationToken; + + /// Creates a tokio runtime for the current thread. This is the expected + /// way to create a runtime used by this crate. + pub fn create_current_thread_runtime() -> io::Result { + runtime::Builder::new_current_thread().enable_all().build() + } + + pub fn create_cancellation_token() -> CancellationToken { + CancellationToken::new() + } +} diff --git a/profiling-ffi/Cargo.toml b/profiling-ffi/Cargo.toml index 154efabcf..78b3efc89 100644 --- a/profiling-ffi/Cargo.toml +++ b/profiling-ffi/Cargo.toml @@ -34,6 +34,7 @@ build_common = { path = "../build-common" } anyhow = "1.0" datadog-crashtracker-ffi = { path = "../crashtracker-ffi", default-features = false, optional = true} datadog-profiling = { path = "../profiling" } +futures = { version = "0.3", default-features = false } hyper = { version = "0.14", features = ["backports", "deprecated"], default-features = false } ddcommon = { path = "../ddcommon" } ddcommon-ffi = { path = "../ddcommon-ffi", default-features = false } @@ -42,8 +43,10 @@ ddtelemetry-ffi = { path = "../ddtelemetry-ffi", default-features = false, optio libc = "0.2" tokio-util = "0.7.1" serde_json = { version = "1.0" } -futures = { version = "0.3", default-features = false } symbolizer-ffi = { path = "../symbolizer-ffi", optional = true, default-features = false } symbolic-demangle = { version = "12.8.0", default-features = false, features = ["rust", "cpp", "msvc"] } symbolic-common = "12.8.0" data-pipeline-ffi = { path = "../data-pipeline-ffi", default-features = false, optional = true } + +[dev-dependencies] +http-body-util = "0.1" \ No newline at end of file diff --git a/profiling-ffi/src/exporter.rs b/profiling-ffi/src/exporter.rs index 0f8aa1cea..273d9466e 100644 --- a/profiling-ffi/src/exporter.rs +++ b/profiling-ffi/src/exporter.rs @@ -4,15 +4,15 @@ #![allow(renamed_and_removed_lints)] #![allow(clippy::box_vec)] -use datadog_profiling::exporter; -use datadog_profiling::exporter::{ProfileExporter, Request}; +use datadog_profiling::exporter::config::{self, EndpointExt}; +use datadog_profiling::exporter::{self, Client, Endpoint, ProfileExporter, Request, Uri}; use datadog_profiling::internal::ProfiledEndpointsStats; use ddcommon::tag::Tag; use ddcommon_ffi::slice::{AsBytes, ByteSlice, CharSlice, Slice}; use ddcommon_ffi::{Error, MaybeError, Timespec}; -use std::borrow::Cow; use std::ptr::NonNull; use std::str::FromStr; +use std::sync::{Arc, OnceLock}; #[allow(dead_code)] #[repr(C)] @@ -93,40 +93,39 @@ pub extern "C" fn ddog_prof_Endpoint_agentless<'a>( pub extern "C" fn endpoint_file(filename: CharSlice) -> ProfilingEndpoint { ProfilingEndpoint::File(filename) } -unsafe fn try_to_url(slice: CharSlice) -> anyhow::Result { + +unsafe fn try_to_url(slice: CharSlice) -> anyhow::Result { let str: &str = slice.try_to_utf8()?; #[cfg(unix)] if let Some(path) = str.strip_prefix("unix://") { - return Ok(exporter::socket_path_to_uri(path.as_ref())?); + return Ok(config::try_socket_path_to_uri(path.as_ref())?); } #[cfg(windows)] if let Some(path) = str.strip_prefix("windows:") { - return Ok(exporter::named_pipe_path_to_uri(path.as_ref())?); + return Ok(config::try_named_pipe_path_to_uri(path.as_ref())?); } - Ok(hyper::Uri::from_str(str)?) + Ok(Uri::from_str(str)?) } -pub unsafe fn try_to_endpoint( - endpoint: ProfilingEndpoint, -) -> anyhow::Result { +pub unsafe fn try_to_endpoint(endpoint: ProfilingEndpoint) -> anyhow::Result { // convert to utf8 losslessly -- URLs and API keys should all be ASCII, so // a failed result is likely to be an error. match endpoint { ProfilingEndpoint::Agent(url) => { let base_url = try_to_url(url)?; - exporter::config::agent(base_url) + Ok(Endpoint::profiling_agent(base_url)?) } ProfilingEndpoint::Agentless(site, api_key) => { let site_str = site.try_to_utf8()?; let api_key_str = api_key.try_to_utf8()?; - exporter::config::agentless( - Cow::Owned(site_str.to_owned()), - Cow::Owned(api_key_str.to_owned()), - ) + Ok(Endpoint::profiling_agentless( + site_str, + api_key_str.to_owned(), + )?) } ProfilingEndpoint::File(filename) => { let filename = filename.try_to_utf8()?; - exporter::config::file(filename) + Ok(Endpoint::profiling_file(filename)?) } } } @@ -168,7 +167,7 @@ pub unsafe extern "C" fn ddog_prof_Exporter_new( let ptr = NonNull::new_unchecked(Box::into_raw(Box::new(exporter))); ExporterNewResult::Ok(ptr) } - Err(err) => ExporterNewResult::Err(err.into()), + Err(err) => ExporterNewResult::Err(err.context("ddog_prof_Exporter_new failed").into()), } } @@ -179,12 +178,32 @@ fn ddog_prof_exporter_new_impl( tags: Option<&ddcommon_ffi::Vec>, endpoint: ProfilingEndpoint, ) -> anyhow::Result { + // Cache the client because client config can be expensive to create. + // The client should probably be exposed to the user over FFI so that: + // 1. They can choose which cert provider to use (webpki or native). + // 2. The client can actually be freed properly if needed as this will leak some memory. The + // previous implementation also leaked memory in this area, so this is not a new leak. + // 3. I don't like hidden locks. + static CLIENT: OnceLock, exporter::Error>> = OnceLock::new(); + let client_result = CLIENT.get_or_init(|| -> Result, exporter::Error> { + let client = Client::use_native_roots_on_current_thread()?; + Ok(Arc::new(client)) + }); + + let client = match client_result { + Ok(c) => c.clone(), + Err(err) => { + return Err(anyhow::Error::from(err).context("failed to create HTTP client")); + } + }; + let library_name = profiling_library_name.to_utf8_lossy().into_owned(); let library_version = profiling_library_version.to_utf8_lossy().into_owned(); let family = family.to_utf8_lossy().into_owned(); let converted_endpoint = unsafe { try_to_endpoint(endpoint)? }; let tags = tags.map(|tags| tags.iter().cloned().collect()); ProfileExporter::new( + client, library_name, library_version, family, @@ -483,7 +502,7 @@ mod tests { use super::*; use ddcommon::tag; use ddcommon_ffi::Slice; - use hyper::body::HttpBody; + use http_body_util::BodyExt; use serde_json::json; fn profiling_library_name() -> CharSlice<'static> { @@ -514,6 +533,7 @@ mod tests { // alternative. If you do figure out a better way, there's another copy of this code // in the profiling tests, please update there too :) let body = request.body(); + let body_bytes: String = String::from_utf8_lossy( &futures::executor::block_on(body.collect()) .unwrap() @@ -970,7 +990,10 @@ mod tests { }; let build_result = Result::from(build_result); - build_result.unwrap_err(); + assert!( + build_result.is_err(), + "ddog_prof_Exporter_Request_build returned Ok when it should have errored" + ); } #[test] diff --git a/profiling/Cargo.toml b/profiling/Cargo.toml index 048d7cc81..e33f077ad 100644 --- a/profiling/Cargo.toml +++ b/profiling/Cargo.toml @@ -20,20 +20,15 @@ harness = false [dependencies] anyhow = "1.0" bitmaps = "3.2.0" +byteorder = { version = "1.5", features = ["std"] } bytes = "1.1" chrono = {version = "0.4", default-features = false, features = ["std", "clock"]} datadog-alloc = {path = "../alloc"} ddcommon = { path = "../ddcommon" } -ddcommon-net1 = { path = "../ddcommon-net1" } +ddcommon-net2 = { path = "../ddcommon-net2", features = ["use_native_roots"] } derivative = "2.2.0" -futures = { version = "0.3", default-features = false } -futures-core = {version = "0.3.0", default-features = false} -futures-util = {version = "0.3.0", default-features = false} hashbrown = { version = "0.14", default-features = false, features = ["allocator-api2"] } -http = "0.2" -http-body = "0.4" -hyper = {version = "0.14", features = ["client", "backports", "deprecated"], default-features = false} -hyper-multipart-rfc7578 = "0.7.0" +hyper-multipart-rfc7578 = { git = "https://github.com/jothan/rust-hyper-multipart-rfc7578.git", rev = "4d3064a7a8c0062b485d50e4460cb7ad71c83d35" } indexmap = "2.2" libc = "0.2" lz4_flex = { version = "0.9", default-features = false, features = ["std", "safe-encode", "frame"] } @@ -46,9 +41,11 @@ serde = {version = "1.0", features = ["derive"]} serde_json = {version = "1.0"} tokio = {version = "1.23", features = ["rt", "macros"]} tokio-util = "0.7.1" -byteorder = { version = "1.5", features = ["std"] } +rustls-native-certs = "0.8.1" [dev-dependencies] bolero = "0.10.1" bolero-generator = "0.10.2" criterion = "0.5.1" +futures = { version = "0.3", default-features = false } +http-body-util = "0.1" diff --git a/profiling/src/exporter/config.rs b/profiling/src/exporter/config.rs index 51a71b8bd..5407ff0f7 100644 --- a/profiling/src/exporter/config.rs +++ b/profiling/src/exporter/config.rs @@ -1,77 +1,80 @@ // Copyright 2021-Present Datadog, Inc. https://www.datadoghq.com/ // SPDX-License-Identifier: Apache-2.0 -use http::Uri; +use crate::exporter::Uri; +use ddcommon_net2::compat::Endpoint; +use ddcommon_net2::{dep::http, http::UriExt}; use std::borrow::Cow; +use std::path::Path; use std::str::FromStr; -use ddcommon_net1::Endpoint; +pub trait EndpointExt { + fn profiling_agentless( + site: impl AsRef, + api_key: impl Into>, + ) -> http::Result; -#[cfg(unix)] -use ddcommon_net1::connector::uds; + fn profiling_agent>(uri: U) -> Result + where + http::Error: From; -#[cfg(windows)] -use ddcommon_net1::connector::named_pipe; + fn profiling_file(path: impl AsRef) -> http::Result; +} -/// Creates an Endpoint for talking to the Datadog agent. -/// -/// # Arguments -/// * `base_url` - has protocol, host, and port e.g. http://localhost:8126/ -pub fn agent(base_url: Uri) -> anyhow::Result { - let mut parts = base_url.into_parts(); - let p_q = match parts.path_and_query { - None => None, - Some(pq) => { - let path = pq.path(); - let path = path.strip_suffix('/').unwrap_or(path); - Some(format!("{path}/profiling/v1/input").parse()?) - } - }; - parts.path_and_query = p_q; - let url = Uri::from_parts(parts)?; - Ok(Endpoint::from_url(url)) +impl EndpointExt for Endpoint { + fn profiling_agentless( + site: impl AsRef, + api_key: impl Into>, + ) -> http::Result { + let intake_url = format!("https://intake.profile.{}/api/v2/profile", site.as_ref()); + Ok(Self { + url: Uri::try_from(intake_url)?, + api_key: Some(api_key.into()), + timeout_ms: 0, + test_token: None, + }) + } + + fn profiling_agent>(uri: U) -> Result + where + http::Error: From, + { + let mut parts = uri.try_into()?.into_parts(); + parts.path_and_query = Some(http::uri::PathAndQuery::from_str("/profiling/v1/input")?); + let url = Uri::from_parts(parts)?; + Ok(Self { + url, + api_key: None, + timeout_ms: 0, + test_token: None, + }) + } + + fn profiling_file(path: impl AsRef) -> http::Result { + let raw_url = format!("file://{}", path.as_ref()); + let url = Uri::from_str(&raw_url)?; + Ok(Self::from(url)) + } } -/// Creates an Endpoint for talking to the Datadog agent though a unix socket. -/// -/// # Arguments -/// * `socket_path` - file system path to the socket #[cfg(unix)] -pub fn agent_uds(path: &std::path::Path) -> anyhow::Result { - let base_url = uds::socket_path_to_uri(path)?; - agent(base_url) +/// Creates a new Uri, with the `unix` scheme, and the path to the socket +/// encoded as a hex string, to prevent special characters in the url authority +pub fn try_socket_path_to_uri(path: &Path) -> http::Result { + Uri::from_path("unix", path) } -/// Creates an Endpoint for talking to the Datadog agent though a windows named pipe. -/// -/// # Arguments -/// * `path` - file system path to the named pipe #[cfg(windows)] -pub fn agent_named_pipe(path: &std::path::Path) -> anyhow::Result { - let base_url = named_pipe::named_pipe_path_to_uri(path)?; - agent(base_url) -} - -/// Creates an Endpoint for talking to Datadog intake without using the agent. -/// This is an experimental feature. +/// Windows Named Pipe +/// https://docs.microsoft.com/en-us/windows/win32/ipc/named-pipes /// -/// # Arguments -/// * `site` - e.g. "datadoghq.com". -/// * `api_key` -pub fn agentless, IntoCow: Into>>( - site: AsStrRef, - api_key: IntoCow, -) -> anyhow::Result { - let intake_url: String = format!("https://intake.profile.{}/api/v2/profile", site.as_ref()); - - Ok(Endpoint { - url: Uri::from_str(intake_url.as_str())?, - api_key: Some(api_key.into()), - ..Default::default() - }) -} - -pub fn file(path: impl AsRef) -> anyhow::Result { - let url: String = format!("file://{}", path.as_ref()); - Ok(Endpoint::from_slice(&url)) +/// The form a windows named pipe path is either local to the computer: +/// \\.\pipe\pipename +/// or targeting a remote server +/// \\ServerName\pipe\pipename +/// +/// Build a URI from a Path representing a named pipe +/// `path` - named pipe path. ex: \\.\pipe\pipename +pub fn try_named_pipe_path_to_uri(path: &Path) -> http::Result { + Uri::from_path("windows", path) } diff --git a/profiling/src/exporter/mod.rs b/profiling/src/exporter/mod.rs index 57d97ee91..5d6d9284d 100644 --- a/profiling/src/exporter/mod.rs +++ b/profiling/src/exporter/mod.rs @@ -2,47 +2,38 @@ // SPDX-License-Identifier: Apache-2.0 pub mod config; - mod errors; -use bytes::Bytes; +use crate::internal::ProfiledEndpointsStats; +use ddcommon::azure_app_services; +use ddcommon_net2::dep::{http, hyper}; +use hyper::body::Incoming; use hyper_multipart_rfc7578::client::multipart; use lz4_flex::frame::FrameEncoder; use serde_json::json; use std::borrow::Cow; -use std::future; use std::io::{Cursor, Write}; -use tokio::runtime::Runtime; +use std::sync; use tokio_util::sync::CancellationToken; -use crate::internal::ProfiledEndpointsStats; -use ddcommon::azure_app_services; -use ddcommon_net1::{connector, Endpoint, HttpClient, HttpResponse}; - pub use chrono::{DateTime, Utc}; pub use ddcommon::tag::Tag; -pub use hyper::Uri; - -#[cfg(unix)] -pub use connector::uds::{socket_path_from_uri, socket_path_to_uri}; - -#[cfg(windows)] -pub use connector::named_pipe::{named_pipe_path_from_uri, named_pipe_path_to_uri}; +pub use ddcommon_net2::compat::Endpoint; +pub use ddcommon_net2::crytpo::Provider as CryptoProvider; +pub use ddcommon_net2::dep::tokio_rustls::rustls; +pub use ddcommon_net2::http::{Client, Error}; +pub use ddcommon_net2::rt; +pub use http::Uri; const DURATION_ZERO: std::time::Duration = std::time::Duration::from_millis(0); -pub struct Exporter { - client: HttpClient, - runtime: Runtime, -} - pub struct Fields { pub start: DateTime, pub end: DateTime, } pub struct ProfileExporter { - exporter: Exporter, + http_client: sync::Arc, endpoint: Endpoint, family: Cow<'static, str>, profiling_library_name: Cow<'static, str>, @@ -55,14 +46,13 @@ pub struct File<'a> { pub bytes: &'a [u8], } -#[derive(Debug)] pub struct Request { timeout: Option, - req: hyper::Request, + req: hyper::Request, } -impl From> for Request { - fn from(req: hyper::Request) -> Self { +impl From> for Request { + fn from(req: hyper::Request) -> Self { Self { req, timeout: None } } } @@ -81,7 +71,7 @@ impl Request { &self.timeout } - pub fn uri(&self) -> &hyper::Uri { + pub fn uri(&self) -> &Uri { self.req.uri() } @@ -89,32 +79,9 @@ impl Request { self.req.headers() } - pub fn body(self) -> hyper::Body { + pub fn body(self) -> multipart::Body { self.req.into_body() } - - async fn send( - self, - client: &HttpClient, - cancel: Option<&CancellationToken>, - ) -> anyhow::Result> { - tokio::select! { - _ = async { match cancel { - Some(cancellation_token) => cancellation_token.cancelled().await, - // If no token is provided, future::pending() provides a no-op future that never resolves - None => future::pending().await, - }} - => Err(crate::exporter::errors::Error::UserRequestedCancellation.into()), - result = async { - Ok(match self.timeout { - Some(t) => tokio::time::timeout(t, client.request(self.req)) - .await - .map_err(|_| crate::exporter::errors::Error::OperationTimedOut)?, - None => client.request(self.req).await, - }?)} - => result, - } - } } impl ProfileExporter { @@ -130,6 +97,7 @@ impl ProfileExporter { /// to include profile-specific tags, see `additional_tags` on `build`. /// * `endpoint` - Configuration for reporting data pub fn new( + http_client: sync::Arc, profiling_library_name: N, profiling_library_version: V, family: F, @@ -142,7 +110,7 @@ impl ProfileExporter { V: Into>, { Ok(Self { - exporter: Exporter::new()?, + http_client, endpoint, family: family.into(), profiling_library_name: profiling_library_name.into(), @@ -274,66 +242,33 @@ impl ProfileExporter { let builder = self .endpoint - .into_request_builder(concat!("DDProf/", env!("CARGO_PKG_VERSION")))? - .method(http::Method::POST) - .header("Connection", "close") + .to_request_builder(concat!("DDProf/", env!("CARGO_PKG_VERSION")))? + .method(http::Method::POST.as_str()) + .header(http::header::CONNECTION.as_str(), "close") .header("DD-EVP-ORIGIN", self.profiling_library_name.as_ref()) .header( "DD-EVP-ORIGIN-VERSION", self.profiling_library_version.as_ref(), ); - Ok( - Request::from(form.set_body_convert::(builder)?) - .with_timeout(std::time::Duration::from_millis(self.endpoint.timeout_ms)), - ) + let request = form.set_body::(builder)?; + + Ok(Request::from(request) + .with_timeout(std::time::Duration::from_millis(self.endpoint.timeout_ms))) } pub fn send( &self, request: Request, cancel: Option<&CancellationToken>, - ) -> anyhow::Result { - self.exporter - .runtime - .block_on(request.send(&self.exporter.client, cancel)) + ) -> anyhow::Result> { + let response = self + .http_client + .send(request.req, cancel, request.timeout)?; + Ok(response) } pub fn set_timeout(&mut self, timeout_ms: u64) { self.endpoint.timeout_ms = timeout_ms; } } - -impl Exporter { - /// Creates a new Exporter, initializing the TLS stack. - pub fn new() -> anyhow::Result { - // Set idle to 0, which prevents the pipe being broken every 2nd request - let client = hyper::Client::builder() - .pool_max_idle_per_host(0) - .build(connector::Connector::default()); - let runtime = tokio::runtime::Builder::new_current_thread() - .enable_all() - .build()?; - Ok(Self { client, runtime }) - } - - pub fn send( - &self, - http_method: http::Method, - url: &str, - mut headers: hyper::header::HeaderMap, - body: &[u8], - timeout: std::time::Duration, - ) -> anyhow::Result> { - self.runtime.block_on(async { - let mut request = hyper::Request::builder() - .method(http_method) - .uri(url) - .body(hyper::Body::from(Bytes::copy_from_slice(body)))?; - std::mem::swap(request.headers_mut(), &mut headers); - - let request: Request = request.into(); - request.with_timeout(timeout).send(&self.client, None).await - }) - } -} diff --git a/profiling/tests/form.rs b/profiling/tests/form.rs index 4eed33d21..a59a354d3 100644 --- a/profiling/tests/form.rs +++ b/profiling/tests/form.rs @@ -59,16 +59,18 @@ fn multipart( #[cfg(test)] mod tests { use crate::multipart; + use datadog_profiling::exporter::config::EndpointExt; use datadog_profiling::exporter::*; use ddcommon::tag; - use hyper::body::HttpBody; use serde_json::json; + use std::sync; fn default_tags() -> Vec { vec![tag!("service", "php"), tag!("host", "bits")] } fn parsed_event_json(request: Request) -> serde_json::Value { + use http_body_util::BodyExt; // Really hacky way of getting the event.json file contents, because I didn't want to // implement a full multipart parser and didn't find a particularly good // alternative. If you do figure out a better way, there's another copy of this code @@ -89,6 +91,11 @@ mod tests { serde_json::from_str(event_json).unwrap() } + fn http_only_client() -> sync::Arc { + let runtime = rt::create_current_thread_runtime().unwrap(); + sync::Arc::new(Client::new(None, runtime)) + } + #[test] // This test invokes an external function SecTrustSettingsCopyCertificates // which Miri cannot evaluate. @@ -96,9 +103,10 @@ mod tests { fn multipart_agent() { let profiling_library_name = "dd-trace-foo"; let profiling_library_version = "1.2.3"; - let base_url = "http://localhost:8126".parse().expect("url to parse"); - let endpoint = config::agent(base_url).expect("endpoint to construct"); + let endpoint = + Endpoint::profiling_agent("http://localhost:8126").expect("endpoint to construct"); let mut exporter = ProfileExporter::new( + http_only_client(), profiling_library_name, profiling_library_version, "php", @@ -145,9 +153,10 @@ mod tests { fn including_internal_metadata() { let profiling_library_name = "dd-trace-foo"; let profiling_library_version = "1.2.3"; - let base_url = "http://localhost:8126".parse().expect("url to parse"); - let endpoint = config::agent(base_url).expect("endpoint to construct"); + let endpoint = + Endpoint::profiling_agent("http://localhost:8126").expect("endpoint to construct"); let mut exporter = ProfileExporter::new( + http_only_client(), profiling_library_name, profiling_library_version, "php", @@ -174,9 +183,10 @@ mod tests { fn including_info() { let profiling_library_name = "dd-trace-foo"; let profiling_library_version = "1.2.3"; - let base_url = "http://localhost:8126".parse().expect("url to parse"); - let endpoint = config::agent(base_url).expect("endpoint to construct"); + let endpoint = + Endpoint::profiling_agent("http://localhost:8126").expect("endpoint to construct"); let mut exporter = ProfileExporter::new( + http_only_client(), profiling_library_name, profiling_library_version, "php", @@ -214,9 +224,11 @@ mod tests { fn multipart_agentless() { let profiling_library_name = "dd-trace-foo"; let profiling_library_version = "1.2.3"; + let site = "datadoghq.com"; let api_key = "1234567890123456789012"; - let endpoint = config::agentless("datadoghq.com", api_key).expect("endpoint to construct"); + let endpoint = Endpoint::profiling_agentless(site, api_key).expect("endpoint to construct"); let mut exporter = ProfileExporter::new( + http_only_client(), profiling_library_name, profiling_library_version, "php", diff --git a/tools/docker/Dockerfile.build b/tools/docker/Dockerfile.build index 323c98593..6904951e6 100644 --- a/tools/docker/Dockerfile.build +++ b/tools/docker/Dockerfile.build @@ -73,8 +73,9 @@ COPY "build-common/Cargo.toml" "build-common/" COPY "crashtracker/Cargo.toml" "crashtracker/" COPY "crashtracker-ffi/Cargo.toml" "crashtracker-ffi/" COPY "ddcommon/Cargo.toml" "ddcommon/" -COPY "ddcommon-ffi/Cargo.toml" "ddcommon-ffi/" -COPY "ddcommon-net1/Cargo.toml" "ddcommon-net1/" +COPY "ddcommon-ffi/Cargo.toml" "ddcommon-ffi/" +COPY "ddcommon-net1/Cargo.toml" "ddcommon-net1/" +COPY "ddcommon-net2/Cargo.toml" "ddcommon-net2/" COPY "ddtelemetry/Cargo.toml" "ddtelemetry/" COPY "ddtelemetry-ffi/Cargo.toml" "ddtelemetry-ffi/" COPY "ddsketch/Cargo.toml" "ddsketch/" From bbfabb18526f71eff2b9dc02f1a833cac9fe42b0 Mon Sep 17 00:00:00 2001 From: Levi Morrison Date: Mon, 2 Dec 2024 15:07:47 -0700 Subject: [PATCH 05/13] Add feature to sub-dependency so that ring is available --- ddcommon-net1/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ddcommon-net1/Cargo.toml b/ddcommon-net1/Cargo.toml index 504b97562..e12529f14 100644 --- a/ddcommon-net1/Cargo.toml +++ b/ddcommon-net1/Cargo.toml @@ -12,7 +12,7 @@ license.workspace = true bench = false [features] -default = [] +default = ["hyper-rustls/rustls-native-certs"] use_webpki_roots = ["hyper-rustls/webpki-roots"] [dependencies] From c001c62986f84c564e4b3ccfe145a01a77df0823 Mon Sep 17 00:00:00 2001 From: Levi Morrison Date: Tue, 3 Dec 2024 11:39:03 -0700 Subject: [PATCH 06/13] style: use consistent FROM ... AS ... casing --- tools/docker/Dockerfile.build | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tools/docker/Dockerfile.build b/tools/docker/Dockerfile.build index 6904951e6..4ea56a268 100644 --- a/tools/docker/Dockerfile.build +++ b/tools/docker/Dockerfile.build @@ -4,18 +4,18 @@ ARG CARGO_NET_RETRY="2" ARG BUILDER_IMAGE=debian_builder ### Debian builder -FROM rust:1-slim-buster as debian_builder +FROM rust:1-slim-buster AS debian_builder ENV CARGO_HOME="/root/.cargo" WORKDIR /build RUN cargo install cbindgen; mv /root/.cargo/bin/cbindgen /usr/bin/; rm -rf /root/.cargo ### Debian buildplatform builder -FROM --platform=$BUILDPLATFORM rust:1-slim-buster as debian_builder_platform_native +FROM --platform=$BUILDPLATFORM rust:1-slim-buster AS debian_builder_platform_native ENV CARGO_HOME="/root/.cargo" WORKDIR /build ### Alpine builder -FROM ${ALPINE_BASE_IMAGE} as alpine_base +FROM ${ALPINE_BASE_IMAGE} AS alpine_base ENV CARGO_HOME="/root/.cargo" WORKDIR /build @@ -43,20 +43,20 @@ SHELL ["/bin/bash", "-c"] # Also, it doesn't understand x86_64-alpine-linux-musl like the OS's cargo. #RUN rustup-init -y --no-modify-path --default-toolchain stable -FROM alpine_base as alpine_aws_cli +FROM alpine_base AS alpine_aws_cli RUN apk add --no-cache aws-cli \ && rm -rf /var/cache/apk/* RUN aws --version # Just to make sure its installed alright -FROM alpine_base as alpine_cbindgen +FROM alpine_base AS alpine_cbindgen ENV PATH="/root/.cargo/bin:$PATH" ARG CARGO_BUILD_INCREMENTAL ARG CARGO_NET_RETRY ENV CARGO_NET_RETRY="${CARGO_NET_RETRY}" RUN cargo install cbindgen --version "^0.26" && cargo install bindgen-cli --locked && rm -rf /root/.cargo/registry /root/.cargo/git -FROM alpine_aws_cli as alpine_builder +FROM alpine_aws_cli AS alpine_builder COPY --from=alpine_cbindgen /root/.cargo/bin/cbindgen /usr/local/bin/cbindgen COPY --from=alpine_cbindgen /root/.cargo/bin/bindgen /usr/local/bin/bindgen @@ -146,7 +146,7 @@ RUN echo \ RUN cargo fetch --locked # extract cargo cache -FROM --platform=$BUILDPLATFORM scratch as ffi_build_platform_agnostic_cache +FROM --platform=$BUILDPLATFORM scratch AS ffi_build_platform_agnostic_cache COPY --from=ffi_build_platform_agnostic_cache_build /root/.cargo /root/.cargo COPY --from=ffi_build_platform_agnostic_cache_build /build /build @@ -163,6 +163,6 @@ RUN cargo build --release --lib --workspace --exclude builder COPY ./ ./ RUN cargo run --bin release --features profiling,telemetry,data-pipeline,symbolizer,crashtracker --release -- --out /build/output -FROM scratch as ffi_build_output +FROM scratch AS ffi_build_output COPY --from=ffi_build /build/output/ ./ From af97e0cd01879a5bde80394b2f0081c197189af5 Mon Sep 17 00:00:00 2001 From: Levi Morrison Date: Tue, 3 Dec 2024 11:54:05 -0700 Subject: [PATCH 07/13] build: fix missing ring in some cases --- ddcommon-net1/Cargo.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ddcommon-net1/Cargo.toml b/ddcommon-net1/Cargo.toml index e12529f14..c26b55ddd 100644 --- a/ddcommon-net1/Cargo.toml +++ b/ddcommon-net1/Cargo.toml @@ -12,7 +12,7 @@ license.workspace = true bench = false [features] -default = ["hyper-rustls/rustls-native-certs"] +default = [] use_webpki_roots = ["hyper-rustls/webpki-roots"] [dependencies] @@ -27,7 +27,7 @@ hyper = { version = "0.14", features = ["http1", "client", "tcp", "stream", "bac hyper-util = "0.1" lazy_static = "1.4" pin-project = "1" -rustls = { version = "0.23", default-features = false } +rustls = { version = "0.23", default-features = false, features = ["ring"] } rustls-native-certs = { version = "0.7" } serde = { version = "1.0", features = ["derive"] } tokio = { version = "1.23", features = ["rt", "macros"] } From 8232986b60dfee5681b5d061255187cdd819619f Mon Sep 17 00:00:00 2001 From: Levi Morrison Date: Tue, 3 Dec 2024 14:43:19 -0700 Subject: [PATCH 08/13] Extract ddcommon-net1-ffi --- Cargo.lock | 15 ++- Cargo.toml | 1 + LICENSE-3rdparty.yml | 2 +- crashtracker-ffi/Cargo.toml | 2 +- crashtracker-ffi/src/collector/datatypes.rs | 2 +- ddcommon-ffi/src/lib.rs | 1 - ddcommon-net1-ffi/Cargo.toml | 13 +++ ddcommon-net1-ffi/cbindgen.toml | 35 +++++++ .../src/endpoint.rs | 93 ++++++++----------- ddcommon-net1-ffi/src/lib.rs | 6 ++ ddcommon-net1/src/lib.rs | 5 + ddtelemetry-ffi/Cargo.toml | 1 + ddtelemetry-ffi/src/builder/expanded.rs | 2 +- ddtelemetry-ffi/src/lib.rs | 2 +- live-debugger-ffi/Cargo.toml | 2 +- live-debugger-ffi/src/sender.rs | 2 +- sidecar-ffi/Cargo.toml | 2 +- sidecar-ffi/src/lib.rs | 2 +- sidecar-ffi/tests/sidecar.rs | 2 +- tools/docker/Dockerfile.build | 1 + 20 files changed, 122 insertions(+), 69 deletions(-) create mode 100644 ddcommon-net1-ffi/Cargo.toml create mode 100644 ddcommon-net1-ffi/cbindgen.toml rename {ddcommon-ffi => ddcommon-net1-ffi}/src/endpoint.rs (52%) create mode 100644 ddcommon-net1-ffi/src/lib.rs diff --git a/Cargo.lock b/Cargo.lock index 7fa2aa147..4b9e7c6c4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1387,7 +1387,7 @@ dependencies = [ "ddcommon", "ddcommon-ffi", "ddcommon-net1", - "hyper 0.14.31", + "ddcommon-net1-ffi", "symbolic-common", "symbolic-demangle", ] @@ -1480,7 +1480,7 @@ dependencies = [ "datadog-live-debugger", "ddcommon", "ddcommon-ffi", - "ddcommon-net1", + "ddcommon-net1-ffi", "log", "percent-encoding", "serde_json", @@ -1694,7 +1694,7 @@ dependencies = [ "datadog-trace-utils", "ddcommon", "ddcommon-ffi", - "ddcommon-net1", + "ddcommon-net1-ffi", "ddtelemetry", "ddtelemetry-ffi", "dogstatsd-client", @@ -1866,6 +1866,14 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "ddcommon-net1-ffi" +version = "14.3.1" +dependencies = [ + "ddcommon-ffi", + "ddcommon-net1", +] + [[package]] name = "ddcommon-net2" version = "14.3.1" @@ -1929,6 +1937,7 @@ dependencies = [ "ddcommon", "ddcommon-ffi", "ddcommon-net1", + "ddcommon-net1-ffi", "ddtelemetry", "libc", "paste", diff --git a/Cargo.toml b/Cargo.toml index c24b2ca45..044807192 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,6 +13,7 @@ members = [ "ddcommon", "ddcommon-ffi", "ddcommon-net1", + "ddcommon-net1-ffi", "ddcommon-net2", "ddtelemetry", "ddtelemetry-ffi", diff --git a/LICENSE-3rdparty.yml b/LICENSE-3rdparty.yml index c03ae5549..16553e84c 100644 --- a/LICENSE-3rdparty.yml +++ b/LICENSE-3rdparty.yml @@ -1,4 +1,4 @@ -root_name: datadog-alloc, builder, build_common, tools, datadog-crashtracker, ddcommon, ddcommon-net1, ddtelemetry, datadog-ddsketch, datadog-crashtracker-ffi, ddcommon-ffi, datadog-profiling, ddcommon-net2, datadog-profiling-ffi, data-pipeline-ffi, data-pipeline, datadog-trace-normalization, datadog-trace-protobuf, datadog-trace-obfuscation, datadog-trace-utils, tinybytes, dogstatsd-client, ddtelemetry-ffi, symbolizer-ffi, datadog-profiling-replayer, dogstatsd, datadog-ipc, datadog-ipc-macros, tarpc, tarpc-plugins, spawn_worker, cc_utils, datadog-live-debugger, datadog-live-debugger-ffi, datadog-remote-config, datadog-dynamic-configuration, datadog-sidecar, datadog-sidecar-macros, datadog-sidecar-ffi, sidecar_mockgen, test_spawn_from_lib, datadog-serverless-trace-mini-agent, datadog-trace-mini-agent +root_name: datadog-alloc, builder, build_common, tools, datadog-crashtracker, ddcommon, ddcommon-net1, ddtelemetry, datadog-ddsketch, datadog-crashtracker-ffi, ddcommon-ffi, ddcommon-net1-ffi, datadog-profiling, ddcommon-net2, datadog-profiling-ffi, data-pipeline-ffi, data-pipeline, datadog-trace-normalization, datadog-trace-protobuf, datadog-trace-obfuscation, datadog-trace-utils, tinybytes, dogstatsd-client, ddtelemetry-ffi, symbolizer-ffi, datadog-profiling-replayer, dogstatsd, datadog-ipc, datadog-ipc-macros, tarpc, tarpc-plugins, spawn_worker, cc_utils, datadog-live-debugger, datadog-live-debugger-ffi, datadog-remote-config, datadog-dynamic-configuration, datadog-sidecar, datadog-sidecar-macros, datadog-sidecar-ffi, sidecar_mockgen, test_spawn_from_lib, datadog-serverless-trace-mini-agent, datadog-trace-mini-agent third_party_libraries: - package_name: addr2line package_version: 0.24.2 diff --git a/crashtracker-ffi/Cargo.toml b/crashtracker-ffi/Cargo.toml index 5099ca416..add4869c7 100644 --- a/crashtracker-ffi/Cargo.toml +++ b/crashtracker-ffi/Cargo.toml @@ -29,6 +29,6 @@ datadog-crashtracker = { path = "../crashtracker" } ddcommon = { path = "../ddcommon" } ddcommon-ffi = { path = "../ddcommon-ffi", default-features = false } ddcommon-net1 = { path = "../ddcommon-net1" } -hyper = {version = "0.14", features = ["backports", "deprecated"], default-features = false} +ddcommon-net1-ffi = { path = "../ddcommon-net1-ffi" } symbolic-demangle = { version = "12.8.0", default-features = false, features = ["rust", "cpp", "msvc"], optional = true } symbolic-common = { version = "12.8.0", default-features = false, optional = true } diff --git a/crashtracker-ffi/src/collector/datatypes.rs b/crashtracker-ffi/src/collector/datatypes.rs index c4fa30b76..832cf0ac9 100644 --- a/crashtracker-ffi/src/collector/datatypes.rs +++ b/crashtracker-ffi/src/collector/datatypes.rs @@ -5,7 +5,7 @@ use crate::option_from_char_slice; pub use datadog_crashtracker::{OpTypes, StacktraceCollection}; use ddcommon_ffi::slice::{AsBytes, CharSlice}; use ddcommon_ffi::{Error, Slice}; -use ddcommon_net1::Endpoint; +use ddcommon_net1_ffi::Endpoint; #[repr(C)] pub struct EnvVar<'a> { diff --git a/ddcommon-ffi/src/lib.rs b/ddcommon-ffi/src/lib.rs index 5163ca1c0..9c38c0d7f 100644 --- a/ddcommon-ffi/src/lib.rs +++ b/ddcommon-ffi/src/lib.rs @@ -4,7 +4,6 @@ mod error; pub mod array_queue; -pub mod endpoint; pub mod option; pub mod slice; pub mod string; diff --git a/ddcommon-net1-ffi/Cargo.toml b/ddcommon-net1-ffi/Cargo.toml new file mode 100644 index 000000000..2674a32bb --- /dev/null +++ b/ddcommon-net1-ffi/Cargo.toml @@ -0,0 +1,13 @@ +# Copyright 2021-Present Datadog, Inc. https://www.datadoghq.com/ +# SPDX-License-Identifier: Apache-2.0 + +[package] +name = "ddcommon-net1-ffi" +rust-version.workspace = true +edition.workspace = true +version.workspace = true +license.workspace = true + +[dependencies] +ddcommon-ffi = { path = "../ddcommon-ffi" } +ddcommon-net1 = { path = "../ddcommon-net1" } diff --git a/ddcommon-net1-ffi/cbindgen.toml b/ddcommon-net1-ffi/cbindgen.toml new file mode 100644 index 000000000..87358d172 --- /dev/null +++ b/ddcommon-net1-ffi/cbindgen.toml @@ -0,0 +1,35 @@ +# Copyright 2021-Present Datadog, Inc. https://www.datadoghq.com/ +# SPDX-License-Identifier: Apache-2.0 + +language = "C" +cpp_compat = true +tab_width = 2 +header = """// Copyright 2021-Present Datadog, Inc. https://www.datadoghq.com/ +// SPDX-License-Identifier: Apache-2.0 +""" +include_guard = "DDOG_COMMON_NET1_H" +style = "both" +pragma_once = true + +no_includes = true +sys_includes = ["stdbool.h", "stddef.h", "stdint.h"] + +[export] +prefix = "ddog_net1" +renaming_overrides_prefixing = true + +[export.mangle] +rename_types = "PascalCase" + +[export.rename] + + +[enum] +prefix_with_name = true +rename_variants = "ScreamingSnakeCase" + +[fn] +must_use = "DDOG_CHECK_RETURN" + +[parse] +parse_deps = true \ No newline at end of file diff --git a/ddcommon-ffi/src/endpoint.rs b/ddcommon-net1-ffi/src/endpoint.rs similarity index 52% rename from ddcommon-ffi/src/endpoint.rs rename to ddcommon-net1-ffi/src/endpoint.rs index d11cf954c..2ea96f409 100644 --- a/ddcommon-ffi/src/endpoint.rs +++ b/ddcommon-net1-ffi/src/endpoint.rs @@ -1,60 +1,45 @@ // Copyright 2021-Present Datadog, Inc. https://www.datadoghq.com/ // SPDX-License-Identifier: Apache-2.0 -use crate::slice::AsBytes; -use crate::Error; -use hyper::http::uri::{Authority, Parts}; +use ddcommon_ffi::slice::AsBytes; +use ddcommon_ffi::Error; +use ddcommon_net1::{dep::http, parse_uri}; use std::borrow::Cow; use std::str::FromStr; -use ddcommon_net1 as net; -use net::parse_uri; +use http::uri::{Authority, Parts}; -/// Wrapper type to generate the correct FFI name. -pub struct Endpoint(net::Endpoint); - -impl From for Endpoint { - fn from(inner: net::Endpoint) -> Self { - Self(inner) - } -} - -impl From for net::Endpoint { - fn from(inner: Endpoint) -> Self { - inner.0 - } -} +pub type Endpoint = ddcommon_net1::Endpoint; #[no_mangle] #[must_use] -pub extern "C" fn ddog_endpoint_from_url(url: crate::CharSlice) -> Option> { +pub extern "C" fn ddog_endpoint_from_url(url: ddcommon_ffi::CharSlice) -> Option> { parse_uri(url.to_utf8_lossy().as_ref()) .ok() - .map(|url| Box::new(net::Endpoint::from_url(url).into())) + .map(|url| Box::new(Endpoint::from_url(url))) } #[no_mangle] #[must_use] -pub extern "C" fn ddog_endpoint_from_filename(filename: crate::CharSlice) -> Option> { +pub extern "C" fn ddog_endpoint_from_filename( + filename: ddcommon_ffi::CharSlice, +) -> Option> { let url = format!("file://{}", filename.to_utf8_lossy()); - Some(Box::new(net::Endpoint::from_slice(&url).into())) + Some(Box::new(Endpoint::from_slice(&url))) } // We'll just specify the base site here. If api key provided, different intakes need to use their // own subdomains. #[no_mangle] #[must_use] -pub extern "C" fn ddog_endpoint_from_api_key(api_key: crate::CharSlice) -> Box { +pub extern "C" fn ddog_endpoint_from_api_key(api_key: ddcommon_ffi::CharSlice) -> Box { let mut parts = Parts::default(); parts.authority = Some(Authority::from_static("datadoghq.com")); - Box::new( - net::Endpoint { - url: hyper::Uri::from_parts(parts).unwrap(), - api_key: Some(api_key.to_utf8_lossy().to_string().into()), - ..Default::default() - } - .into(), - ) + Box::new(Endpoint { + url: http::Uri::from_parts(parts).unwrap(), + api_key: Some(api_key.to_utf8_lossy().to_string().into()), + ..Default::default() + }) } // We'll just specify the base site here. If api key provided, different intakes need to use their @@ -62,8 +47,8 @@ pub extern "C" fn ddog_endpoint_from_api_key(api_key: crate::CharSlice) -> Box Option> { let mut parts = Parts::default(); @@ -71,25 +56,25 @@ pub extern "C" fn ddog_endpoint_from_api_key_and_site( Ok(s) => s, Err(e) => return Some(Box::new(Error::from(e.to_string()))), }); - *endpoint = Box::into_raw(Box::new( - net::Endpoint { - url: hyper::Uri::from_parts(parts).unwrap(), - api_key: Some(api_key.to_utf8_lossy().to_string().into()), - ..Default::default() - } - .into(), - )); + *endpoint = Box::into_raw(Box::new(Endpoint { + url: http::Uri::from_parts(parts).unwrap(), + api_key: Some(api_key.to_utf8_lossy().to_string().into()), + ..Default::default() + })); None } #[no_mangle] extern "C" fn ddog_endpoint_set_timeout(endpoint: &mut Endpoint, millis: u64) { - endpoint.0.timeout_ms = millis; + endpoint.timeout_ms = millis; } #[no_mangle] -extern "C" fn ddog_endpoint_set_test_token(endpoint: &mut Endpoint, token: crate::CharSlice) { - endpoint.0.test_token = if token.is_empty() { +extern "C" fn ddog_endpoint_set_test_token( + endpoint: &mut Endpoint, + token: ddcommon_ffi::CharSlice, +) { + endpoint.test_token = if token.is_empty() { None } else { Some(Cow::Owned(token.to_utf8_lossy().to_string())) @@ -102,8 +87,7 @@ pub extern "C" fn ddog_endpoint_drop(_: Box) {} #[cfg(test)] mod tests { use super::*; - use crate::CharSlice; - use net::Endpoint; + use ddcommon_ffi::CharSlice; #[test] fn test_ddog_endpoint_from_url() { @@ -128,19 +112,18 @@ mod tests { let url = CharSlice::from("http://127.0.0.1"); let mut endpoint = ddog_endpoint_from_url(url); - let timeout_ms = endpoint.as_ref().unwrap().0.timeout_ms; - assert_eq!(timeout_ms, Endpoint::DEFAULT_TIMEOUT); + assert_eq!( + endpoint.as_ref().unwrap().timeout_ms, + Endpoint::DEFAULT_TIMEOUT + ); ddog_endpoint_set_timeout(endpoint.as_mut().unwrap(), 2000); - let timeout_ms = endpoint.as_ref().unwrap().0.timeout_ms; - assert_eq!(timeout_ms, 2000); + assert_eq!(endpoint.unwrap().timeout_ms, 2000); let mut endpoint_api_key = ddog_endpoint_from_api_key(CharSlice::from("test-key")); - let timeout_ms = endpoint_api_key.0.timeout_ms; - assert_eq!(timeout_ms, Endpoint::DEFAULT_TIMEOUT); + assert_eq!(endpoint_api_key.timeout_ms, Endpoint::DEFAULT_TIMEOUT); ddog_endpoint_set_timeout(&mut endpoint_api_key, 2000); - let timeout_ms = endpoint_api_key.0.timeout_ms; - assert_eq!(timeout_ms, 2000); + assert_eq!(endpoint_api_key.timeout_ms, 2000); } } diff --git a/ddcommon-net1-ffi/src/lib.rs b/ddcommon-net1-ffi/src/lib.rs new file mode 100644 index 000000000..f62a97607 --- /dev/null +++ b/ddcommon-net1-ffi/src/lib.rs @@ -0,0 +1,6 @@ +// Copyright 2021-Present Datadog, Inc. https://www.datadoghq.com/ +// SPDX-License-Identifier: Apache-2.0 + +mod endpoint; + +pub use endpoint::*; diff --git a/ddcommon-net1/src/lib.rs b/ddcommon-net1/src/lib.rs index 2dee51be8..f3ef3cf62 100644 --- a/ddcommon-net1/src/lib.rs +++ b/ddcommon-net1/src/lib.rs @@ -13,6 +13,10 @@ use std::str::FromStr; pub mod connector; +pub mod dep { + pub use http; +} + pub type HttpClient = hyper::Client; pub type HttpResponse = hyper::Response; pub type HttpRequestBuilder = hyper::http::request::Builder; @@ -133,6 +137,7 @@ pub fn decode_uri_path_in_authority(uri: &hyper::Uri) -> anyhow::Result impl Endpoint { /// Default value for the timeout field in milliseconds. + /// Sync with ddog_Endpoint's default manually. pub const DEFAULT_TIMEOUT: u64 = 3_000; /// Return a request builder with the following headers: diff --git a/ddtelemetry-ffi/Cargo.toml b/ddtelemetry-ffi/Cargo.toml index 0875107cd..3f097e6b1 100644 --- a/ddtelemetry-ffi/Cargo.toml +++ b/ddtelemetry-ffi/Cargo.toml @@ -25,6 +25,7 @@ ddtelemetry = { path = "../ddtelemetry" } ddcommon = { path = "../ddcommon" } ddcommon-ffi = { path = "../ddcommon-ffi", default-features = false } ddcommon-net1 = { path = "../ddcommon-net1" } +ddcommon-net1-ffi = { path = "../ddcommon-net1-ffi" } paste = "1" libc = "0.2" diff --git a/ddtelemetry-ffi/src/builder/expanded.rs b/ddtelemetry-ffi/src/builder/expanded.rs index fcfe35146..c10a6d51c 100644 --- a/ddtelemetry-ffi/src/builder/expanded.rs +++ b/ddtelemetry-ffi/src/builder/expanded.rs @@ -4,7 +4,7 @@ pub use macros::*; mod macros { use ddcommon_ffi as ffi; - use ddcommon_net1::Endpoint; + use ddcommon_net1_ffi::Endpoint; use ddtelemetry::worker::TelemetryWorkerBuilder; use ffi::slice::AsBytes; #[no_mangle] diff --git a/ddtelemetry-ffi/src/lib.rs b/ddtelemetry-ffi/src/lib.rs index f4490fc70..dfdef4d6f 100644 --- a/ddtelemetry-ffi/src/lib.rs +++ b/ddtelemetry-ffi/src/lib.rs @@ -108,7 +108,7 @@ pub(crate) use c_setters; mod tests { use crate::{builder::*, worker_handle::*}; use ddcommon_ffi as ffi; - use ddcommon_net1::Endpoint; + use ddcommon_net1_ffi::Endpoint; use ddtelemetry::{ data::metrics::{MetricNamespace, MetricType}, worker::{TelemetryWorkerBuilder, TelemetryWorkerHandle}, diff --git a/live-debugger-ffi/Cargo.toml b/live-debugger-ffi/Cargo.toml index abf49c689..8bfa4834c 100644 --- a/live-debugger-ffi/Cargo.toml +++ b/live-debugger-ffi/Cargo.toml @@ -13,7 +13,7 @@ bench = false [dependencies] datadog-live-debugger = { path = "../live-debugger" } ddcommon = { path = "../ddcommon" } -ddcommon-net1 = { path = "../ddcommon-net1" } +ddcommon-net1-ffi = { path = "../ddcommon-net1-ffi" } ddcommon-ffi = { path = "../ddcommon-ffi", default-features = false } percent-encoding = "2.1" uuid = { version = "1.7.0", features = ["v4"] } diff --git a/live-debugger-ffi/src/sender.rs b/live-debugger-ffi/src/sender.rs index edb28589d..4c7f6a8c1 100644 --- a/live-debugger-ffi/src/sender.rs +++ b/live-debugger-ffi/src/sender.rs @@ -8,7 +8,7 @@ use datadog_live_debugger::sender::{generate_tags, Config, DebuggerType}; use ddcommon::tag::Tag; use ddcommon_ffi::slice::AsBytes; use ddcommon_ffi::{CharSlice, MaybeError}; -use ddcommon_net1::Endpoint; +use ddcommon_net1_ffi::Endpoint; use log::{debug, warn}; use percent_encoding::{percent_encode, CONTROLS}; use std::sync::Arc; diff --git a/sidecar-ffi/Cargo.toml b/sidecar-ffi/Cargo.toml index f32e84c24..f6e2ede87 100644 --- a/sidecar-ffi/Cargo.toml +++ b/sidecar-ffi/Cargo.toml @@ -17,7 +17,7 @@ datadog-trace-utils = { path = "../trace-utils" } datadog-ipc = { path = "../ipc" } ddcommon = { path = "../ddcommon" } ddcommon-ffi = { path = "../ddcommon-ffi", default-features = false } -ddcommon-net1 = { path = "../ddcommon-net1" } +ddcommon-net1-ffi = { path = "../ddcommon-net1-ffi" } ddtelemetry-ffi = { path = "../ddtelemetry-ffi", default-features = false } datadog-remote-config = { path = "../remote-config" } datadog-live-debugger = { path = "../live-debugger" } diff --git a/sidecar-ffi/src/lib.rs b/sidecar-ffi/src/lib.rs index c8eb7cd5a..60c1fb801 100644 --- a/sidecar-ffi/src/lib.rs +++ b/sidecar-ffi/src/lib.rs @@ -23,7 +23,7 @@ use datadog_sidecar::shm_remote_config::{path_for_remote_config, RemoteConfigRea use ddcommon::tag::Tag; use ddcommon_ffi as ffi; use ddcommon_ffi::{CharSlice, MaybeError}; -use ddcommon_net1::Endpoint; +use ddcommon_net1_ffi::Endpoint; use ddtelemetry::{ data::{self, Dependency, Integration}, worker::{LifecycleAction, TelemetryActions}, diff --git a/sidecar-ffi/tests/sidecar.rs b/sidecar-ffi/tests/sidecar.rs index 42a40649b..9a09fda5a 100644 --- a/sidecar-ffi/tests/sidecar.rs +++ b/sidecar-ffi/tests/sidecar.rs @@ -11,7 +11,7 @@ macro_rules! assert_maybe_no_error { }; } -use ddcommon_net1::Endpoint; +use ddcommon_net1_ffi::Endpoint; use std::ptr::{null, null_mut}; use std::time::Duration; #[cfg(unix)] diff --git a/tools/docker/Dockerfile.build b/tools/docker/Dockerfile.build index 4ea56a268..59cb19352 100644 --- a/tools/docker/Dockerfile.build +++ b/tools/docker/Dockerfile.build @@ -75,6 +75,7 @@ COPY "crashtracker-ffi/Cargo.toml" "crashtracker-ffi/" COPY "ddcommon/Cargo.toml" "ddcommon/" COPY "ddcommon-ffi/Cargo.toml" "ddcommon-ffi/" COPY "ddcommon-net1/Cargo.toml" "ddcommon-net1/" +COPY "ddcommon-net1-ffi/Cargo.toml" "ddcommon-net1-ffi/" COPY "ddcommon-net2/Cargo.toml" "ddcommon-net2/" COPY "ddtelemetry/Cargo.toml" "ddtelemetry/" COPY "ddtelemetry-ffi/Cargo.toml" "ddtelemetry-ffi/" From 7af9e81072536a326329e338a897a624048f8b34 Mon Sep 17 00:00:00 2001 From: Levi Morrison Date: Tue, 3 Dec 2024 16:09:43 -0700 Subject: [PATCH 09/13] fix: partially fix build --- Cargo.lock | 4 +-- builder/Cargo.toml | 1 + builder/src/bin/release.rs | 2 ++ builder/src/common_net1.rs | 43 +++++++++++++++++++++++++++ builder/src/lib.rs | 1 + crashtracker-ffi/cbindgen.toml | 2 +- ddcommon-net1-ffi/Cargo.toml | 7 +++++ ddcommon-net1-ffi/build.rs | 10 +++++++ ddcommon-net1-ffi/cbindgen.toml | 7 +++-- ddcommon-net1-ffi/src/endpoint.rs | 11 +++++++ ddcommon-net1/src/lib.rs | 2 +- ddtelemetry-ffi/Cargo.toml | 1 - ddtelemetry-ffi/src/builder/macros.rs | 2 +- examples/ffi/crashtracking.c | 5 ++-- examples/ffi/telemetry.c | 5 ++-- examples/ffi/telemetry_metrics.c | 3 +- profiling-ffi/Cargo.toml | 3 +- profiling-ffi/cbindgen.toml | 2 +- 18 files changed, 96 insertions(+), 15 deletions(-) create mode 100644 builder/src/common_net1.rs create mode 100644 ddcommon-net1-ffi/build.rs diff --git a/Cargo.lock b/Cargo.lock index 4b9e7c6c4..c66239d21 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1535,7 +1535,7 @@ dependencies = [ "datadog-profiling", "ddcommon", "ddcommon-ffi", - "ddcommon-net1", + "ddcommon-net1-ffi", "ddtelemetry-ffi", "futures", "http-body-util", @@ -1870,6 +1870,7 @@ dependencies = [ name = "ddcommon-net1-ffi" version = "14.3.1" dependencies = [ + "build_common", "ddcommon-ffi", "ddcommon-net1", ] @@ -1936,7 +1937,6 @@ dependencies = [ "build_common", "ddcommon", "ddcommon-ffi", - "ddcommon-net1", "ddcommon-net1-ffi", "ddtelemetry", "libc", diff --git a/builder/Cargo.toml b/builder/Cargo.toml index 218389f28..9938018de 100644 --- a/builder/Cargo.toml +++ b/builder/Cargo.toml @@ -8,6 +8,7 @@ license.workspace = true [features] default = [] +common-net1 = [] crashtracker = [] profiling = [] telemetry = [] diff --git a/builder/src/bin/release.rs b/builder/src/bin/release.rs index 03388c858..27c97e4e4 100644 --- a/builder/src/bin/release.rs +++ b/builder/src/bin/release.rs @@ -61,6 +61,8 @@ pub fn main() { let features = { #[allow(unused_mut)] let mut f: Vec = vec![]; + #[cfg(feature = "common-net1")] + f.push("ddcommon-net1-ffi".to_string()); #[cfg(feature = "telemetry")] f.push("ddtelemetry-ffi".to_string()); #[cfg(feature = "data-pipeline")] diff --git a/builder/src/common_net1.rs b/builder/src/common_net1.rs new file mode 100644 index 000000000..d1f3bd248 --- /dev/null +++ b/builder/src/common_net1.rs @@ -0,0 +1,43 @@ +// Copyright 2024-Present Datadog, Inc. https://www.datadoghq.com/ +// SPDX-License-Identifier: Apache-2.0 + +use crate::arch; +use crate::module::Module; +use crate::utils::project_root; +use anyhow::Result; +use std::fs; +use std::path::PathBuf; +use std::process::Command; +use std::rc::Rc; + +pub struct CommonNet1 { + pub arch: Rc, + pub source_include: Rc, + pub target_include: Rc, +} + +impl Module for CommonNet1 { + fn build(&self) -> Result<()> { + let mut cargo = Command::new("cargo") + .env("RUSTFLAGS", arch::RUSTFLAGS.join(" ")) + .current_dir(project_root()) + .args(["build", "-p", "ddcommon-net1-ffi", "--target", &self.arch]) + .spawn() + .expect("failed to spawn cargo"); + + cargo.wait().expect("Cargo failed"); + Ok(()) + } + + fn install(&self) -> Result<()> { + let target_path: PathBuf = [self.target_include.as_ref(), "common_net1.h"] + .iter() + .collect(); + + let origin_path: PathBuf = [self.source_include.as_ref(), "common_net1.h"] + .iter() + .collect(); + fs::copy(origin_path, target_path).expect("Failed to copy common_net1.h"); + Ok(()) + } +} diff --git a/builder/src/lib.rs b/builder/src/lib.rs index 3151e7c40..8b747acdb 100644 --- a/builder/src/lib.rs +++ b/builder/src/lib.rs @@ -4,6 +4,7 @@ pub mod arch; pub mod builder; pub mod common; +pub mod common_net1; #[cfg(feature = "crashtracker")] pub mod crashtracker; pub mod module; diff --git a/crashtracker-ffi/cbindgen.toml b/crashtracker-ffi/cbindgen.toml index b5571f563..3c8f30312 100644 --- a/crashtracker-ffi/cbindgen.toml +++ b/crashtracker-ffi/cbindgen.toml @@ -23,7 +23,7 @@ renaming_overrides_prefixing = true "ByteSlice" = "ddog_ByteSlice" "CancellationToken" = "ddog_CancellationToken" "CharSlice" = "ddog_CharSlice" -"Endpoint" = "ddog_Endpoint" +"Endpoint" = "ddog_net1_Endpoint" "Error" = "ddog_Error" "HttpStatus" = "ddog_HttpStatus" "Option_U32" = "ddog_Option_U32" diff --git a/ddcommon-net1-ffi/Cargo.toml b/ddcommon-net1-ffi/Cargo.toml index 2674a32bb..e368b260a 100644 --- a/ddcommon-net1-ffi/Cargo.toml +++ b/ddcommon-net1-ffi/Cargo.toml @@ -8,6 +8,13 @@ edition.workspace = true version.workspace = true license.workspace = true +[lib] +crate-type = ["lib", "staticlib", "cdylib"] +bench = false + +[build-dependencies] +build_common = { path = "../build-common" } + [dependencies] ddcommon-ffi = { path = "../ddcommon-ffi" } ddcommon-net1 = { path = "../ddcommon-net1" } diff --git a/ddcommon-net1-ffi/build.rs b/ddcommon-net1-ffi/build.rs new file mode 100644 index 000000000..e27f858bd --- /dev/null +++ b/ddcommon-net1-ffi/build.rs @@ -0,0 +1,10 @@ +// Copyright 2024-Present Datadog, Inc. https://www.datadoghq.com/ +// SPDX-License-Identifier: Apache-2.0 +extern crate build_common; + +use build_common::generate_and_configure_header; + +fn main() { + let header_name = "common_net1.h"; + generate_and_configure_header(header_name); +} diff --git a/ddcommon-net1-ffi/cbindgen.toml b/ddcommon-net1-ffi/cbindgen.toml index 87358d172..c32a0fb42 100644 --- a/ddcommon-net1-ffi/cbindgen.toml +++ b/ddcommon-net1-ffi/cbindgen.toml @@ -15,13 +15,15 @@ no_includes = true sys_includes = ["stdbool.h", "stddef.h", "stdint.h"] [export] -prefix = "ddog_net1" +prefix = "ddog_net1_" renaming_overrides_prefixing = true [export.mangle] rename_types = "PascalCase" [export.rename] +"CharSlice" = "ddog_CharSlice" +"Error" = "ddog_Error" [enum] @@ -32,4 +34,5 @@ rename_variants = "ScreamingSnakeCase" must_use = "DDOG_CHECK_RETURN" [parse] -parse_deps = true \ No newline at end of file +parse_deps = true +include = ["ddcommon-net1"] \ No newline at end of file diff --git a/ddcommon-net1-ffi/src/endpoint.rs b/ddcommon-net1-ffi/src/endpoint.rs index 2ea96f409..3b1c8fc85 100644 --- a/ddcommon-net1-ffi/src/endpoint.rs +++ b/ddcommon-net1-ffi/src/endpoint.rs @@ -9,6 +9,17 @@ use std::str::FromStr; use http::uri::{Authority, Parts}; +// Bindgen doesn't understand modules, this is the same type as far as bindgen +// is concerned. Using a transparent repr is important here. +mod bindgen { + // Create a wrapper struct for FFI, since bindgen doesn't forward declare + // the struct without it. + #[allow(dead_code)] + #[repr(transparent)] + #[derive(Clone, PartialEq, Eq, Hash, Debug)] + pub struct Endpoint(ddcommon_net1::Endpoint); +} + pub type Endpoint = ddcommon_net1::Endpoint; #[no_mangle] diff --git a/ddcommon-net1/src/lib.rs b/ddcommon-net1/src/lib.rs index f3ef3cf62..d7a02e689 100644 --- a/ddcommon-net1/src/lib.rs +++ b/ddcommon-net1/src/lib.rs @@ -137,7 +137,7 @@ pub fn decode_uri_path_in_authority(uri: &hyper::Uri) -> anyhow::Result impl Endpoint { /// Default value for the timeout field in milliseconds. - /// Sync with ddog_Endpoint's default manually. + /// Sync with ddog_net1_Endpoint's default manually. pub const DEFAULT_TIMEOUT: u64 = 3_000; /// Return a request builder with the following headers: diff --git a/ddtelemetry-ffi/Cargo.toml b/ddtelemetry-ffi/Cargo.toml index 3f097e6b1..6fdeaf249 100644 --- a/ddtelemetry-ffi/Cargo.toml +++ b/ddtelemetry-ffi/Cargo.toml @@ -24,7 +24,6 @@ build_common = { path = "../build-common" } ddtelemetry = { path = "../ddtelemetry" } ddcommon = { path = "../ddcommon" } ddcommon-ffi = { path = "../ddcommon-ffi", default-features = false } -ddcommon-net1 = { path = "../ddcommon-net1" } ddcommon-net1-ffi = { path = "../ddcommon-net1-ffi" } paste = "1" libc = "0.2" diff --git a/ddtelemetry-ffi/src/builder/macros.rs b/ddtelemetry-ffi/src/builder/macros.rs index 2dd9070df..79b61b20c 100644 --- a/ddtelemetry-ffi/src/builder/macros.rs +++ b/ddtelemetry-ffi/src/builder/macros.rs @@ -10,7 +10,7 @@ // ``` use ddcommon_ffi as ffi; -use ddcommon_net1::Endpoint; +use ddcommon_net1_ffi::Endpoint; use ddtelemetry::worker::TelemetryWorkerBuilder; use ffi::slice::AsBytes; diff --git a/examples/ffi/crashtracking.c b/examples/ffi/crashtracking.c index 8555ab133..8fc489d3f 100644 --- a/examples/ffi/crashtracking.c +++ b/examples/ffi/crashtracking.c @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 #include +#include #include #include #include @@ -49,10 +50,10 @@ int main(int argc, char **argv) { .optional_stdout_filename = DDOG_CHARSLICE_C("/tmp/crashreports/stdout.txt"), }; - struct ddog_Endpoint *endpoint = + struct ddog_net1_Endpoint *endpoint = ddog_endpoint_from_filename(DDOG_CHARSLICE_C("/tmp/crashreports/crashreport.json")); // Alternatively: - // struct ddog_Endpoint * endpoint = + // struct ddog_net1_Endpoint * endpoint = // ddog_endpoint_from_url(DDOG_CHARSLICE_C("http://localhost:8126")); ddog_crasht_Config config = { diff --git a/examples/ffi/telemetry.c b/examples/ffi/telemetry.c index 195a29f3a..b22f7e82e 100644 --- a/examples/ffi/telemetry.c +++ b/examples/ffi/telemetry.c @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 #include +#include #include #include #include @@ -24,7 +25,7 @@ int main(void) { TRY(ddog_telemetry_builder_instantiate(&builder, service, lang, lang_version, tracer_version)); ddog_CharSlice endpoint_char = DDOG_CHARSLICE_C("file://./examples_telemetry.out"); - struct ddog_Endpoint *endpoint = ddog_endpoint_from_url(endpoint_char); + struct ddog_net1_Endpoint *endpoint = ddog_endpoint_from_url(endpoint_char); TRY(ddog_telemetry_builder_with_endpoint_config_endpoint(builder, endpoint)); ddog_endpoint_drop(endpoint); @@ -44,4 +45,4 @@ int main(void) { ddog_telemetry_handle_wait_for_shutdown(handle); return 0; -} \ No newline at end of file +} diff --git a/examples/ffi/telemetry_metrics.c b/examples/ffi/telemetry_metrics.c index f119d9c2f..273ad787c 100644 --- a/examples/ffi/telemetry_metrics.c +++ b/examples/ffi/telemetry_metrics.c @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 #include +#include #include #include #include @@ -48,7 +49,7 @@ int main(void) { TRY(ddog_telemetry_builder_instantiate(&builder, service, lang, lang_version, tracer_version)); ddog_CharSlice endpoint_char = DDOG_CHARSLICE_C("file://./examples_telemetry_metrics.out"); - struct ddog_Endpoint *endpoint = ddog_endpoint_from_url(endpoint_char); + struct ddog_net1_Endpoint *endpoint = ddog_endpoint_from_url(endpoint_char); TRY(ddog_telemetry_builder_with_endpoint_config_endpoint(builder, endpoint)); ddog_endpoint_drop(endpoint); diff --git a/profiling-ffi/Cargo.toml b/profiling-ffi/Cargo.toml index 78b3efc89..d3faf78d8 100644 --- a/profiling-ffi/Cargo.toml +++ b/profiling-ffi/Cargo.toml @@ -17,6 +17,7 @@ bench = false [features] default = [] cbindgen = ["build_common/cbindgen", "ddcommon-ffi/cbindgen"] +ddcommon-net1-ffi = ["dep:ddcommon-net1-ffi"] ddtelemetry-ffi = ["dep:ddtelemetry-ffi"] symbolizer = ["symbolizer-ffi"] data-pipeline-ffi = ["dep:data-pipeline-ffi"] @@ -38,7 +39,7 @@ futures = { version = "0.3", default-features = false } hyper = { version = "0.14", features = ["backports", "deprecated"], default-features = false } ddcommon = { path = "../ddcommon" } ddcommon-ffi = { path = "../ddcommon-ffi", default-features = false } -ddcommon-net1 = { path = "../ddcommon-net1" } +ddcommon-net1-ffi = { path = "../ddcommon-net1-ffi", optional = true } ddtelemetry-ffi = { path = "../ddtelemetry-ffi", default-features = false, optional = true, features = ["expanded_builder_macros"] } libc = "0.2" tokio-util = "0.7.1" diff --git a/profiling-ffi/cbindgen.toml b/profiling-ffi/cbindgen.toml index 4c3c485dd..8fe977e8c 100644 --- a/profiling-ffi/cbindgen.toml +++ b/profiling-ffi/cbindgen.toml @@ -23,7 +23,7 @@ renaming_overrides_prefixing = true "ByteSlice" = "ddog_ByteSlice" "CancellationToken" = "ddog_CancellationToken" "CharSlice" = "ddog_CharSlice" -"Endpoint" = "ddog_Endpoint" +"Endpoint" = "ddog_net1_Endpoint" "Error" = "ddog_Error" "HttpStatus" = "ddog_HttpStatus" "Slice_CChar" = "ddog_Slice_CChar" From d26ac3b9337a1afdbe673b3db8404026e0f2c70a Mon Sep 17 00:00:00 2001 From: Levi Morrison Date: Wed, 4 Dec 2024 14:23:02 -0700 Subject: [PATCH 10/13] keep trying to fix build --- README.md | 4 ++-- build-profiling-ffi.sh | 4 ++++ builder/src/arch/apple.rs | 9 ++++++--- builder/src/common_net1.rs | 6 +++--- ddcommon-net1-ffi/build.rs | 2 +- ddcommon-net1-ffi/cbindgen.toml | 1 + examples/ffi/crashtracking.c | 2 +- examples/ffi/telemetry.c | 2 +- examples/ffi/telemetry_metrics.c | 2 +- 9 files changed, 20 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index ff852b715..6ab4fd844 100644 --- a/README.md +++ b/README.md @@ -37,8 +37,8 @@ LIBDD_OUTPUT_FOLDER=/opt/release cargo build -p builder --features profiling,tel ``` #### Build scripts -This is the non-prefered way of building a release, it's use is discouraged and it will be soon deprecated in favour of -using the builder crate. +This is the non-preferred way of building a release, it's use is discouraged and it will be soon deprecated in favour +of using the builder crate. To package a release with the generated ffi header and CMake module, use the `build-profiling-ffi.sh` / `build-telemetry-ffi.sh` helper scripts. Here's an example of using on of these scripts, placing the output inside `/opt/libdatadog`: diff --git a/build-profiling-ffi.sh b/build-profiling-ffi.sh index 064716029..c5e94c2af 100755 --- a/build-profiling-ffi.sh +++ b/build-profiling-ffi.sh @@ -143,6 +143,7 @@ FEATURES=( "data-pipeline-ffi" "datadog-profiling-ffi/ddtelemetry-ffi" "datadog-profiling-ffi/demangler" + "ddcommon-net1-ffi" ) if [[ "$symbolizer" -eq 1 ]]; then FEATURES+=("symbolizer") @@ -230,6 +231,9 @@ case $ARG_FEATURES in *data-pipeline-ffi*) HEADERS="$HEADERS $destdir/include/datadog/data-pipeline.h" ;; + *ddcommon-net1-ffi*) + HEADERS="$HEADERS $destdir/include/datadog/common-net1.h" + ;; esac "$CARGO_TARGET_DIR"/debug/dedup_headers $HEADERS diff --git a/builder/src/arch/apple.rs b/builder/src/arch/apple.rs index 6b409aa80..58433a982 100644 --- a/builder/src/arch/apple.rs +++ b/builder/src/arch/apple.rs @@ -15,17 +15,20 @@ pub const REMOVE_RPATH: bool = true; pub const BUILD_CRASHTRACKER: bool = true; pub const RUSTFLAGS: [&str; 2] = ["-C", "relocation-model=pic"]; -#[allow(clippy::zombie_processes)] pub fn fix_rpath(lib_path: &str) { if REMOVE_RPATH { let lib_name = lib_path.split('/').last().unwrap(); - Command::new("install_name_tool") + let status = Command::new("install_name_tool") .arg("-id") .arg("@rpath/".to_string() + lib_name) .arg(lib_path) - .spawn() + .status() .expect("Failed to fix rpath"); + + if !status.success() { + panic!("Failed to fix rpath: {status}"); + } } } diff --git a/builder/src/common_net1.rs b/builder/src/common_net1.rs index d1f3bd248..d1a2f735e 100644 --- a/builder/src/common_net1.rs +++ b/builder/src/common_net1.rs @@ -30,14 +30,14 @@ impl Module for CommonNet1 { } fn install(&self) -> Result<()> { - let target_path: PathBuf = [self.target_include.as_ref(), "common_net1.h"] + let target_path: PathBuf = [self.target_include.as_ref(), "common-net1.h"] .iter() .collect(); - let origin_path: PathBuf = [self.source_include.as_ref(), "common_net1.h"] + let origin_path: PathBuf = [self.source_include.as_ref(), "common-net1.h"] .iter() .collect(); - fs::copy(origin_path, target_path).expect("Failed to copy common_net1.h"); + fs::copy(origin_path, target_path).expect("Failed to copy common-net1.h"); Ok(()) } } diff --git a/ddcommon-net1-ffi/build.rs b/ddcommon-net1-ffi/build.rs index e27f858bd..fe47ad441 100644 --- a/ddcommon-net1-ffi/build.rs +++ b/ddcommon-net1-ffi/build.rs @@ -5,6 +5,6 @@ extern crate build_common; use build_common::generate_and_configure_header; fn main() { - let header_name = "common_net1.h"; + let header_name = "common-net1.h"; generate_and_configure_header(header_name); } diff --git a/ddcommon-net1-ffi/cbindgen.toml b/ddcommon-net1-ffi/cbindgen.toml index c32a0fb42..79047916f 100644 --- a/ddcommon-net1-ffi/cbindgen.toml +++ b/ddcommon-net1-ffi/cbindgen.toml @@ -13,6 +13,7 @@ pragma_once = true no_includes = true sys_includes = ["stdbool.h", "stddef.h", "stdint.h"] +includes = ["common.h"] [export] prefix = "ddog_net1_" diff --git a/examples/ffi/crashtracking.c b/examples/ffi/crashtracking.c index 8fc489d3f..875e31f72 100644 --- a/examples/ffi/crashtracking.c +++ b/examples/ffi/crashtracking.c @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 #include -#include +#include #include #include #include diff --git a/examples/ffi/telemetry.c b/examples/ffi/telemetry.c index b22f7e82e..cfff00153 100644 --- a/examples/ffi/telemetry.c +++ b/examples/ffi/telemetry.c @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 #include -#include +#include #include #include #include diff --git a/examples/ffi/telemetry_metrics.c b/examples/ffi/telemetry_metrics.c index 273ad787c..d17405d2c 100644 --- a/examples/ffi/telemetry_metrics.c +++ b/examples/ffi/telemetry_metrics.c @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 #include -#include +#include #include #include #include From 2fccc1bffa876779979ba76f9480442e8091382b Mon Sep 17 00:00:00 2001 From: Levi Morrison Date: Wed, 4 Dec 2024 15:33:17 -0700 Subject: [PATCH 11/13] try to fix build by going back to ddog_Endpoint being in ddcommon-ffi --- Cargo.lock | 18 +--- Cargo.toml | 1 - LICENSE-3rdparty.yml | 2 +- build-profiling-ffi.sh | 4 - builder/Cargo.toml | 1 - builder/src/bin/release.rs | 2 - builder/src/common_net1.rs | 43 -------- builder/src/lib.rs | 1 - crashtracker-ffi/Cargo.toml | 1 - crashtracker-ffi/cbindgen.toml | 2 +- crashtracker-ffi/src/collector/datatypes.rs | 2 +- ddcommon-ffi/Cargo.toml | 1 - .../src/endpoint.rs | 101 ++++++++++-------- ddcommon-ffi/src/lib.rs | 2 + ddcommon-net1-ffi/Cargo.toml | 20 ---- ddcommon-net1-ffi/build.rs | 10 -- ddcommon-net1-ffi/cbindgen.toml | 39 ------- ddcommon-net1-ffi/src/lib.rs | 6 -- ddcommon-net1/src/lib.rs | 1 - ddtelemetry-ffi/Cargo.toml | 2 +- ddtelemetry-ffi/src/builder/expanded.rs | 2 +- ddtelemetry-ffi/src/builder/macros.rs | 2 +- ddtelemetry-ffi/src/lib.rs | 2 +- examples/ffi/crashtracking.c | 5 +- examples/ffi/telemetry.c | 3 +- examples/ffi/telemetry_metrics.c | 3 +- live-debugger-ffi/Cargo.toml | 2 +- live-debugger-ffi/src/sender.rs | 2 +- profiling-ffi/Cargo.toml | 2 - profiling-ffi/cbindgen.toml | 2 +- sidecar-ffi/Cargo.toml | 2 +- sidecar-ffi/src/lib.rs | 2 +- sidecar-ffi/tests/sidecar.rs | 2 +- tools/docker/Dockerfile.build | 1 - 34 files changed, 76 insertions(+), 215 deletions(-) delete mode 100644 builder/src/common_net1.rs rename {ddcommon-net1-ffi => ddcommon-ffi}/src/endpoint.rs (53%) delete mode 100644 ddcommon-net1-ffi/Cargo.toml delete mode 100644 ddcommon-net1-ffi/build.rs delete mode 100644 ddcommon-net1-ffi/cbindgen.toml delete mode 100644 ddcommon-net1-ffi/src/lib.rs diff --git a/Cargo.lock b/Cargo.lock index c66239d21..c84e638b4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1387,7 +1387,6 @@ dependencies = [ "ddcommon", "ddcommon-ffi", "ddcommon-net1", - "ddcommon-net1-ffi", "symbolic-common", "symbolic-demangle", ] @@ -1480,7 +1479,7 @@ dependencies = [ "datadog-live-debugger", "ddcommon", "ddcommon-ffi", - "ddcommon-net1-ffi", + "ddcommon-net1", "log", "percent-encoding", "serde_json", @@ -1535,7 +1534,6 @@ dependencies = [ "datadog-profiling", "ddcommon", "ddcommon-ffi", - "ddcommon-net1-ffi", "ddtelemetry-ffi", "futures", "http-body-util", @@ -1694,7 +1692,7 @@ dependencies = [ "datadog-trace-utils", "ddcommon", "ddcommon-ffi", - "ddcommon-net1-ffi", + "ddcommon-net1", "ddtelemetry", "ddtelemetry-ffi", "dogstatsd-client", @@ -1838,7 +1836,6 @@ dependencies = [ "crossbeam-queue", "ddcommon", "ddcommon-net1", - "hyper 0.14.31", "serde", ] @@ -1866,15 +1863,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "ddcommon-net1-ffi" -version = "14.3.1" -dependencies = [ - "build_common", - "ddcommon-ffi", - "ddcommon-net1", -] - [[package]] name = "ddcommon-net2" version = "14.3.1" @@ -1937,7 +1925,7 @@ dependencies = [ "build_common", "ddcommon", "ddcommon-ffi", - "ddcommon-net1-ffi", + "ddcommon-net1", "ddtelemetry", "libc", "paste", diff --git a/Cargo.toml b/Cargo.toml index 044807192..c24b2ca45 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,7 +13,6 @@ members = [ "ddcommon", "ddcommon-ffi", "ddcommon-net1", - "ddcommon-net1-ffi", "ddcommon-net2", "ddtelemetry", "ddtelemetry-ffi", diff --git a/LICENSE-3rdparty.yml b/LICENSE-3rdparty.yml index 16553e84c..c03ae5549 100644 --- a/LICENSE-3rdparty.yml +++ b/LICENSE-3rdparty.yml @@ -1,4 +1,4 @@ -root_name: datadog-alloc, builder, build_common, tools, datadog-crashtracker, ddcommon, ddcommon-net1, ddtelemetry, datadog-ddsketch, datadog-crashtracker-ffi, ddcommon-ffi, ddcommon-net1-ffi, datadog-profiling, ddcommon-net2, datadog-profiling-ffi, data-pipeline-ffi, data-pipeline, datadog-trace-normalization, datadog-trace-protobuf, datadog-trace-obfuscation, datadog-trace-utils, tinybytes, dogstatsd-client, ddtelemetry-ffi, symbolizer-ffi, datadog-profiling-replayer, dogstatsd, datadog-ipc, datadog-ipc-macros, tarpc, tarpc-plugins, spawn_worker, cc_utils, datadog-live-debugger, datadog-live-debugger-ffi, datadog-remote-config, datadog-dynamic-configuration, datadog-sidecar, datadog-sidecar-macros, datadog-sidecar-ffi, sidecar_mockgen, test_spawn_from_lib, datadog-serverless-trace-mini-agent, datadog-trace-mini-agent +root_name: datadog-alloc, builder, build_common, tools, datadog-crashtracker, ddcommon, ddcommon-net1, ddtelemetry, datadog-ddsketch, datadog-crashtracker-ffi, ddcommon-ffi, datadog-profiling, ddcommon-net2, datadog-profiling-ffi, data-pipeline-ffi, data-pipeline, datadog-trace-normalization, datadog-trace-protobuf, datadog-trace-obfuscation, datadog-trace-utils, tinybytes, dogstatsd-client, ddtelemetry-ffi, symbolizer-ffi, datadog-profiling-replayer, dogstatsd, datadog-ipc, datadog-ipc-macros, tarpc, tarpc-plugins, spawn_worker, cc_utils, datadog-live-debugger, datadog-live-debugger-ffi, datadog-remote-config, datadog-dynamic-configuration, datadog-sidecar, datadog-sidecar-macros, datadog-sidecar-ffi, sidecar_mockgen, test_spawn_from_lib, datadog-serverless-trace-mini-agent, datadog-trace-mini-agent third_party_libraries: - package_name: addr2line package_version: 0.24.2 diff --git a/build-profiling-ffi.sh b/build-profiling-ffi.sh index c5e94c2af..064716029 100755 --- a/build-profiling-ffi.sh +++ b/build-profiling-ffi.sh @@ -143,7 +143,6 @@ FEATURES=( "data-pipeline-ffi" "datadog-profiling-ffi/ddtelemetry-ffi" "datadog-profiling-ffi/demangler" - "ddcommon-net1-ffi" ) if [[ "$symbolizer" -eq 1 ]]; then FEATURES+=("symbolizer") @@ -231,9 +230,6 @@ case $ARG_FEATURES in *data-pipeline-ffi*) HEADERS="$HEADERS $destdir/include/datadog/data-pipeline.h" ;; - *ddcommon-net1-ffi*) - HEADERS="$HEADERS $destdir/include/datadog/common-net1.h" - ;; esac "$CARGO_TARGET_DIR"/debug/dedup_headers $HEADERS diff --git a/builder/Cargo.toml b/builder/Cargo.toml index 9938018de..218389f28 100644 --- a/builder/Cargo.toml +++ b/builder/Cargo.toml @@ -8,7 +8,6 @@ license.workspace = true [features] default = [] -common-net1 = [] crashtracker = [] profiling = [] telemetry = [] diff --git a/builder/src/bin/release.rs b/builder/src/bin/release.rs index 27c97e4e4..03388c858 100644 --- a/builder/src/bin/release.rs +++ b/builder/src/bin/release.rs @@ -61,8 +61,6 @@ pub fn main() { let features = { #[allow(unused_mut)] let mut f: Vec = vec![]; - #[cfg(feature = "common-net1")] - f.push("ddcommon-net1-ffi".to_string()); #[cfg(feature = "telemetry")] f.push("ddtelemetry-ffi".to_string()); #[cfg(feature = "data-pipeline")] diff --git a/builder/src/common_net1.rs b/builder/src/common_net1.rs deleted file mode 100644 index d1a2f735e..000000000 --- a/builder/src/common_net1.rs +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2024-Present Datadog, Inc. https://www.datadoghq.com/ -// SPDX-License-Identifier: Apache-2.0 - -use crate::arch; -use crate::module::Module; -use crate::utils::project_root; -use anyhow::Result; -use std::fs; -use std::path::PathBuf; -use std::process::Command; -use std::rc::Rc; - -pub struct CommonNet1 { - pub arch: Rc, - pub source_include: Rc, - pub target_include: Rc, -} - -impl Module for CommonNet1 { - fn build(&self) -> Result<()> { - let mut cargo = Command::new("cargo") - .env("RUSTFLAGS", arch::RUSTFLAGS.join(" ")) - .current_dir(project_root()) - .args(["build", "-p", "ddcommon-net1-ffi", "--target", &self.arch]) - .spawn() - .expect("failed to spawn cargo"); - - cargo.wait().expect("Cargo failed"); - Ok(()) - } - - fn install(&self) -> Result<()> { - let target_path: PathBuf = [self.target_include.as_ref(), "common-net1.h"] - .iter() - .collect(); - - let origin_path: PathBuf = [self.source_include.as_ref(), "common-net1.h"] - .iter() - .collect(); - fs::copy(origin_path, target_path).expect("Failed to copy common-net1.h"); - Ok(()) - } -} diff --git a/builder/src/lib.rs b/builder/src/lib.rs index 8b747acdb..3151e7c40 100644 --- a/builder/src/lib.rs +++ b/builder/src/lib.rs @@ -4,7 +4,6 @@ pub mod arch; pub mod builder; pub mod common; -pub mod common_net1; #[cfg(feature = "crashtracker")] pub mod crashtracker; pub mod module; diff --git a/crashtracker-ffi/Cargo.toml b/crashtracker-ffi/Cargo.toml index add4869c7..ad824d3ce 100644 --- a/crashtracker-ffi/Cargo.toml +++ b/crashtracker-ffi/Cargo.toml @@ -29,6 +29,5 @@ datadog-crashtracker = { path = "../crashtracker" } ddcommon = { path = "../ddcommon" } ddcommon-ffi = { path = "../ddcommon-ffi", default-features = false } ddcommon-net1 = { path = "../ddcommon-net1" } -ddcommon-net1-ffi = { path = "../ddcommon-net1-ffi" } symbolic-demangle = { version = "12.8.0", default-features = false, features = ["rust", "cpp", "msvc"], optional = true } symbolic-common = { version = "12.8.0", default-features = false, optional = true } diff --git a/crashtracker-ffi/cbindgen.toml b/crashtracker-ffi/cbindgen.toml index 3c8f30312..b5571f563 100644 --- a/crashtracker-ffi/cbindgen.toml +++ b/crashtracker-ffi/cbindgen.toml @@ -23,7 +23,7 @@ renaming_overrides_prefixing = true "ByteSlice" = "ddog_ByteSlice" "CancellationToken" = "ddog_CancellationToken" "CharSlice" = "ddog_CharSlice" -"Endpoint" = "ddog_net1_Endpoint" +"Endpoint" = "ddog_Endpoint" "Error" = "ddog_Error" "HttpStatus" = "ddog_HttpStatus" "Option_U32" = "ddog_Option_U32" diff --git a/crashtracker-ffi/src/collector/datatypes.rs b/crashtracker-ffi/src/collector/datatypes.rs index 832cf0ac9..c4fa30b76 100644 --- a/crashtracker-ffi/src/collector/datatypes.rs +++ b/crashtracker-ffi/src/collector/datatypes.rs @@ -5,7 +5,7 @@ use crate::option_from_char_slice; pub use datadog_crashtracker::{OpTypes, StacktraceCollection}; use ddcommon_ffi::slice::{AsBytes, CharSlice}; use ddcommon_ffi::{Error, Slice}; -use ddcommon_net1_ffi::Endpoint; +use ddcommon_net1::Endpoint; #[repr(C)] pub struct EnvVar<'a> { diff --git a/ddcommon-ffi/Cargo.toml b/ddcommon-ffi/Cargo.toml index 2a5a1c9fa..b0a4bbe48 100644 --- a/ddcommon-ffi/Cargo.toml +++ b/ddcommon-ffi/Cargo.toml @@ -24,7 +24,6 @@ chrono = { version = "0.4.38", features = ["std"] } crossbeam-queue = "0.3.11" ddcommon = { path = "../ddcommon" } ddcommon-net1 = { path = "../ddcommon-net1" } -hyper = {version = "0.14", features = ["backports", "deprecated"], default-features = false} serde = "1.0" [dev-dependencies] diff --git a/ddcommon-net1-ffi/src/endpoint.rs b/ddcommon-ffi/src/endpoint.rs similarity index 53% rename from ddcommon-net1-ffi/src/endpoint.rs rename to ddcommon-ffi/src/endpoint.rs index 3b1c8fc85..adc3876bb 100644 --- a/ddcommon-net1-ffi/src/endpoint.rs +++ b/ddcommon-ffi/src/endpoint.rs @@ -1,56 +1,61 @@ // Copyright 2021-Present Datadog, Inc. https://www.datadoghq.com/ // SPDX-License-Identifier: Apache-2.0 -use ddcommon_ffi::slice::AsBytes; -use ddcommon_ffi::Error; -use ddcommon_net1::{dep::http, parse_uri}; +use crate::slice::AsBytes; +use crate::Error; +use ddcommon_net1 as net; +use ddcommon_net1::dep::http; + +use http::uri::{Authority, Parts}; +use net::parse_uri; use std::borrow::Cow; use std::str::FromStr; -use http::uri::{Authority, Parts}; +/// Wrapper type to generate the correct FFI name. +pub struct Endpoint(net::Endpoint); -// Bindgen doesn't understand modules, this is the same type as far as bindgen -// is concerned. Using a transparent repr is important here. -mod bindgen { - // Create a wrapper struct for FFI, since bindgen doesn't forward declare - // the struct without it. - #[allow(dead_code)] - #[repr(transparent)] - #[derive(Clone, PartialEq, Eq, Hash, Debug)] - pub struct Endpoint(ddcommon_net1::Endpoint); +impl From for Endpoint { + fn from(inner: net::Endpoint) -> Self { + Self(inner) + } } -pub type Endpoint = ddcommon_net1::Endpoint; +impl From for net::Endpoint { + fn from(inner: Endpoint) -> Self { + inner.0 + } +} #[no_mangle] #[must_use] -pub extern "C" fn ddog_endpoint_from_url(url: ddcommon_ffi::CharSlice) -> Option> { +pub extern "C" fn ddog_endpoint_from_url(url: crate::CharSlice) -> Option> { parse_uri(url.to_utf8_lossy().as_ref()) .ok() - .map(|url| Box::new(Endpoint::from_url(url))) + .map(|url| Box::new(net::Endpoint::from_url(url).into())) } #[no_mangle] #[must_use] -pub extern "C" fn ddog_endpoint_from_filename( - filename: ddcommon_ffi::CharSlice, -) -> Option> { +pub extern "C" fn ddog_endpoint_from_filename(filename: crate::CharSlice) -> Option> { let url = format!("file://{}", filename.to_utf8_lossy()); - Some(Box::new(Endpoint::from_slice(&url))) + Some(Box::new(net::Endpoint::from_slice(&url).into())) } // We'll just specify the base site here. If api key provided, different intakes need to use their // own subdomains. #[no_mangle] #[must_use] -pub extern "C" fn ddog_endpoint_from_api_key(api_key: ddcommon_ffi::CharSlice) -> Box { +pub extern "C" fn ddog_endpoint_from_api_key(api_key: crate::CharSlice) -> Box { let mut parts = Parts::default(); parts.authority = Some(Authority::from_static("datadoghq.com")); - Box::new(Endpoint { - url: http::Uri::from_parts(parts).unwrap(), - api_key: Some(api_key.to_utf8_lossy().to_string().into()), - ..Default::default() - }) + Box::new( + net::Endpoint { + url: http::Uri::from_parts(parts).unwrap(), + api_key: Some(api_key.to_utf8_lossy().to_string().into()), + ..Default::default() + } + .into(), + ) } // We'll just specify the base site here. If api key provided, different intakes need to use their @@ -58,8 +63,8 @@ pub extern "C" fn ddog_endpoint_from_api_key(api_key: ddcommon_ffi::CharSlice) - #[no_mangle] #[must_use] pub extern "C" fn ddog_endpoint_from_api_key_and_site( - api_key: ddcommon_ffi::CharSlice, - site: ddcommon_ffi::CharSlice, + api_key: crate::CharSlice, + site: crate::CharSlice, endpoint: &mut *mut Endpoint, ) -> Option> { let mut parts = Parts::default(); @@ -67,25 +72,25 @@ pub extern "C" fn ddog_endpoint_from_api_key_and_site( Ok(s) => s, Err(e) => return Some(Box::new(Error::from(e.to_string()))), }); - *endpoint = Box::into_raw(Box::new(Endpoint { - url: http::Uri::from_parts(parts).unwrap(), - api_key: Some(api_key.to_utf8_lossy().to_string().into()), - ..Default::default() - })); + *endpoint = Box::into_raw(Box::new( + net::Endpoint { + url: http::Uri::from_parts(parts).unwrap(), + api_key: Some(api_key.to_utf8_lossy().to_string().into()), + ..Default::default() + } + .into(), + )); None } #[no_mangle] extern "C" fn ddog_endpoint_set_timeout(endpoint: &mut Endpoint, millis: u64) { - endpoint.timeout_ms = millis; + endpoint.0.timeout_ms = millis; } #[no_mangle] -extern "C" fn ddog_endpoint_set_test_token( - endpoint: &mut Endpoint, - token: ddcommon_ffi::CharSlice, -) { - endpoint.test_token = if token.is_empty() { +extern "C" fn ddog_endpoint_set_test_token(endpoint: &mut Endpoint, token: crate::CharSlice) { + endpoint.0.test_token = if token.is_empty() { None } else { Some(Cow::Owned(token.to_utf8_lossy().to_string())) @@ -98,7 +103,8 @@ pub extern "C" fn ddog_endpoint_drop(_: Box) {} #[cfg(test)] mod tests { use super::*; - use ddcommon_ffi::CharSlice; + use crate::CharSlice; + use net::Endpoint; #[test] fn test_ddog_endpoint_from_url() { @@ -123,18 +129,19 @@ mod tests { let url = CharSlice::from("http://127.0.0.1"); let mut endpoint = ddog_endpoint_from_url(url); - assert_eq!( - endpoint.as_ref().unwrap().timeout_ms, - Endpoint::DEFAULT_TIMEOUT - ); + let timeout_ms = endpoint.as_ref().unwrap().0.timeout_ms; + assert_eq!(timeout_ms, Endpoint::DEFAULT_TIMEOUT); ddog_endpoint_set_timeout(endpoint.as_mut().unwrap(), 2000); - assert_eq!(endpoint.unwrap().timeout_ms, 2000); + let timeout_ms = endpoint.as_ref().unwrap().0.timeout_ms; + assert_eq!(timeout_ms, 2000); let mut endpoint_api_key = ddog_endpoint_from_api_key(CharSlice::from("test-key")); - assert_eq!(endpoint_api_key.timeout_ms, Endpoint::DEFAULT_TIMEOUT); + let timeout_ms = endpoint_api_key.0.timeout_ms; + assert_eq!(timeout_ms, Endpoint::DEFAULT_TIMEOUT); ddog_endpoint_set_timeout(&mut endpoint_api_key, 2000); - assert_eq!(endpoint_api_key.timeout_ms, 2000); + let timeout_ms = endpoint_api_key.0.timeout_ms; + assert_eq!(timeout_ms, 2000); } } diff --git a/ddcommon-ffi/src/lib.rs b/ddcommon-ffi/src/lib.rs index 9c38c0d7f..445ee4e01 100644 --- a/ddcommon-ffi/src/lib.rs +++ b/ddcommon-ffi/src/lib.rs @@ -1,6 +1,7 @@ // Copyright 2021-Present Datadog, Inc. https://www.datadoghq.com/ // SPDX-License-Identifier: Apache-2.0 +mod endpoint; mod error; pub mod array_queue; @@ -11,6 +12,7 @@ pub mod tags; pub mod timespec; pub mod vec; +pub use endpoint::*; pub use error::*; pub use option::*; pub use slice::{CharSlice, Slice}; diff --git a/ddcommon-net1-ffi/Cargo.toml b/ddcommon-net1-ffi/Cargo.toml deleted file mode 100644 index e368b260a..000000000 --- a/ddcommon-net1-ffi/Cargo.toml +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright 2021-Present Datadog, Inc. https://www.datadoghq.com/ -# SPDX-License-Identifier: Apache-2.0 - -[package] -name = "ddcommon-net1-ffi" -rust-version.workspace = true -edition.workspace = true -version.workspace = true -license.workspace = true - -[lib] -crate-type = ["lib", "staticlib", "cdylib"] -bench = false - -[build-dependencies] -build_common = { path = "../build-common" } - -[dependencies] -ddcommon-ffi = { path = "../ddcommon-ffi" } -ddcommon-net1 = { path = "../ddcommon-net1" } diff --git a/ddcommon-net1-ffi/build.rs b/ddcommon-net1-ffi/build.rs deleted file mode 100644 index fe47ad441..000000000 --- a/ddcommon-net1-ffi/build.rs +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright 2024-Present Datadog, Inc. https://www.datadoghq.com/ -// SPDX-License-Identifier: Apache-2.0 -extern crate build_common; - -use build_common::generate_and_configure_header; - -fn main() { - let header_name = "common-net1.h"; - generate_and_configure_header(header_name); -} diff --git a/ddcommon-net1-ffi/cbindgen.toml b/ddcommon-net1-ffi/cbindgen.toml deleted file mode 100644 index 79047916f..000000000 --- a/ddcommon-net1-ffi/cbindgen.toml +++ /dev/null @@ -1,39 +0,0 @@ -# Copyright 2021-Present Datadog, Inc. https://www.datadoghq.com/ -# SPDX-License-Identifier: Apache-2.0 - -language = "C" -cpp_compat = true -tab_width = 2 -header = """// Copyright 2021-Present Datadog, Inc. https://www.datadoghq.com/ -// SPDX-License-Identifier: Apache-2.0 -""" -include_guard = "DDOG_COMMON_NET1_H" -style = "both" -pragma_once = true - -no_includes = true -sys_includes = ["stdbool.h", "stddef.h", "stdint.h"] -includes = ["common.h"] - -[export] -prefix = "ddog_net1_" -renaming_overrides_prefixing = true - -[export.mangle] -rename_types = "PascalCase" - -[export.rename] -"CharSlice" = "ddog_CharSlice" -"Error" = "ddog_Error" - - -[enum] -prefix_with_name = true -rename_variants = "ScreamingSnakeCase" - -[fn] -must_use = "DDOG_CHECK_RETURN" - -[parse] -parse_deps = true -include = ["ddcommon-net1"] \ No newline at end of file diff --git a/ddcommon-net1-ffi/src/lib.rs b/ddcommon-net1-ffi/src/lib.rs deleted file mode 100644 index f62a97607..000000000 --- a/ddcommon-net1-ffi/src/lib.rs +++ /dev/null @@ -1,6 +0,0 @@ -// Copyright 2021-Present Datadog, Inc. https://www.datadoghq.com/ -// SPDX-License-Identifier: Apache-2.0 - -mod endpoint; - -pub use endpoint::*; diff --git a/ddcommon-net1/src/lib.rs b/ddcommon-net1/src/lib.rs index d7a02e689..e70ec6e02 100644 --- a/ddcommon-net1/src/lib.rs +++ b/ddcommon-net1/src/lib.rs @@ -137,7 +137,6 @@ pub fn decode_uri_path_in_authority(uri: &hyper::Uri) -> anyhow::Result impl Endpoint { /// Default value for the timeout field in milliseconds. - /// Sync with ddog_net1_Endpoint's default manually. pub const DEFAULT_TIMEOUT: u64 = 3_000; /// Return a request builder with the following headers: diff --git a/ddtelemetry-ffi/Cargo.toml b/ddtelemetry-ffi/Cargo.toml index 6fdeaf249..0875107cd 100644 --- a/ddtelemetry-ffi/Cargo.toml +++ b/ddtelemetry-ffi/Cargo.toml @@ -24,7 +24,7 @@ build_common = { path = "../build-common" } ddtelemetry = { path = "../ddtelemetry" } ddcommon = { path = "../ddcommon" } ddcommon-ffi = { path = "../ddcommon-ffi", default-features = false } -ddcommon-net1-ffi = { path = "../ddcommon-net1-ffi" } +ddcommon-net1 = { path = "../ddcommon-net1" } paste = "1" libc = "0.2" diff --git a/ddtelemetry-ffi/src/builder/expanded.rs b/ddtelemetry-ffi/src/builder/expanded.rs index c10a6d51c..fcfe35146 100644 --- a/ddtelemetry-ffi/src/builder/expanded.rs +++ b/ddtelemetry-ffi/src/builder/expanded.rs @@ -4,7 +4,7 @@ pub use macros::*; mod macros { use ddcommon_ffi as ffi; - use ddcommon_net1_ffi::Endpoint; + use ddcommon_net1::Endpoint; use ddtelemetry::worker::TelemetryWorkerBuilder; use ffi::slice::AsBytes; #[no_mangle] diff --git a/ddtelemetry-ffi/src/builder/macros.rs b/ddtelemetry-ffi/src/builder/macros.rs index 79b61b20c..2dd9070df 100644 --- a/ddtelemetry-ffi/src/builder/macros.rs +++ b/ddtelemetry-ffi/src/builder/macros.rs @@ -10,7 +10,7 @@ // ``` use ddcommon_ffi as ffi; -use ddcommon_net1_ffi::Endpoint; +use ddcommon_net1::Endpoint; use ddtelemetry::worker::TelemetryWorkerBuilder; use ffi::slice::AsBytes; diff --git a/ddtelemetry-ffi/src/lib.rs b/ddtelemetry-ffi/src/lib.rs index dfdef4d6f..f4490fc70 100644 --- a/ddtelemetry-ffi/src/lib.rs +++ b/ddtelemetry-ffi/src/lib.rs @@ -108,7 +108,7 @@ pub(crate) use c_setters; mod tests { use crate::{builder::*, worker_handle::*}; use ddcommon_ffi as ffi; - use ddcommon_net1_ffi::Endpoint; + use ddcommon_net1::Endpoint; use ddtelemetry::{ data::metrics::{MetricNamespace, MetricType}, worker::{TelemetryWorkerBuilder, TelemetryWorkerHandle}, diff --git a/examples/ffi/crashtracking.c b/examples/ffi/crashtracking.c index 875e31f72..8555ab133 100644 --- a/examples/ffi/crashtracking.c +++ b/examples/ffi/crashtracking.c @@ -2,7 +2,6 @@ // SPDX-License-Identifier: Apache-2.0 #include -#include #include #include #include @@ -50,10 +49,10 @@ int main(int argc, char **argv) { .optional_stdout_filename = DDOG_CHARSLICE_C("/tmp/crashreports/stdout.txt"), }; - struct ddog_net1_Endpoint *endpoint = + struct ddog_Endpoint *endpoint = ddog_endpoint_from_filename(DDOG_CHARSLICE_C("/tmp/crashreports/crashreport.json")); // Alternatively: - // struct ddog_net1_Endpoint * endpoint = + // struct ddog_Endpoint * endpoint = // ddog_endpoint_from_url(DDOG_CHARSLICE_C("http://localhost:8126")); ddog_crasht_Config config = { diff --git a/examples/ffi/telemetry.c b/examples/ffi/telemetry.c index cfff00153..5b88b6e03 100644 --- a/examples/ffi/telemetry.c +++ b/examples/ffi/telemetry.c @@ -2,7 +2,6 @@ // SPDX-License-Identifier: Apache-2.0 #include -#include #include #include #include @@ -25,7 +24,7 @@ int main(void) { TRY(ddog_telemetry_builder_instantiate(&builder, service, lang, lang_version, tracer_version)); ddog_CharSlice endpoint_char = DDOG_CHARSLICE_C("file://./examples_telemetry.out"); - struct ddog_net1_Endpoint *endpoint = ddog_endpoint_from_url(endpoint_char); + struct ddog_Endpoint *endpoint = ddog_endpoint_from_url(endpoint_char); TRY(ddog_telemetry_builder_with_endpoint_config_endpoint(builder, endpoint)); ddog_endpoint_drop(endpoint); diff --git a/examples/ffi/telemetry_metrics.c b/examples/ffi/telemetry_metrics.c index d17405d2c..f119d9c2f 100644 --- a/examples/ffi/telemetry_metrics.c +++ b/examples/ffi/telemetry_metrics.c @@ -2,7 +2,6 @@ // SPDX-License-Identifier: Apache-2.0 #include -#include #include #include #include @@ -49,7 +48,7 @@ int main(void) { TRY(ddog_telemetry_builder_instantiate(&builder, service, lang, lang_version, tracer_version)); ddog_CharSlice endpoint_char = DDOG_CHARSLICE_C("file://./examples_telemetry_metrics.out"); - struct ddog_net1_Endpoint *endpoint = ddog_endpoint_from_url(endpoint_char); + struct ddog_Endpoint *endpoint = ddog_endpoint_from_url(endpoint_char); TRY(ddog_telemetry_builder_with_endpoint_config_endpoint(builder, endpoint)); ddog_endpoint_drop(endpoint); diff --git a/live-debugger-ffi/Cargo.toml b/live-debugger-ffi/Cargo.toml index 8bfa4834c..af21510ab 100644 --- a/live-debugger-ffi/Cargo.toml +++ b/live-debugger-ffi/Cargo.toml @@ -13,8 +13,8 @@ bench = false [dependencies] datadog-live-debugger = { path = "../live-debugger" } ddcommon = { path = "../ddcommon" } -ddcommon-net1-ffi = { path = "../ddcommon-net1-ffi" } ddcommon-ffi = { path = "../ddcommon-ffi", default-features = false } +ddcommon-net1 = { path = "../ddcommon-net1" } percent-encoding = "2.1" uuid = { version = "1.7.0", features = ["v4"] } serde_json = "1.0" diff --git a/live-debugger-ffi/src/sender.rs b/live-debugger-ffi/src/sender.rs index 4c7f6a8c1..edb28589d 100644 --- a/live-debugger-ffi/src/sender.rs +++ b/live-debugger-ffi/src/sender.rs @@ -8,7 +8,7 @@ use datadog_live_debugger::sender::{generate_tags, Config, DebuggerType}; use ddcommon::tag::Tag; use ddcommon_ffi::slice::AsBytes; use ddcommon_ffi::{CharSlice, MaybeError}; -use ddcommon_net1_ffi::Endpoint; +use ddcommon_net1::Endpoint; use log::{debug, warn}; use percent_encoding::{percent_encode, CONTROLS}; use std::sync::Arc; diff --git a/profiling-ffi/Cargo.toml b/profiling-ffi/Cargo.toml index d3faf78d8..f7efb051e 100644 --- a/profiling-ffi/Cargo.toml +++ b/profiling-ffi/Cargo.toml @@ -17,7 +17,6 @@ bench = false [features] default = [] cbindgen = ["build_common/cbindgen", "ddcommon-ffi/cbindgen"] -ddcommon-net1-ffi = ["dep:ddcommon-net1-ffi"] ddtelemetry-ffi = ["dep:ddtelemetry-ffi"] symbolizer = ["symbolizer-ffi"] data-pipeline-ffi = ["dep:data-pipeline-ffi"] @@ -39,7 +38,6 @@ futures = { version = "0.3", default-features = false } hyper = { version = "0.14", features = ["backports", "deprecated"], default-features = false } ddcommon = { path = "../ddcommon" } ddcommon-ffi = { path = "../ddcommon-ffi", default-features = false } -ddcommon-net1-ffi = { path = "../ddcommon-net1-ffi", optional = true } ddtelemetry-ffi = { path = "../ddtelemetry-ffi", default-features = false, optional = true, features = ["expanded_builder_macros"] } libc = "0.2" tokio-util = "0.7.1" diff --git a/profiling-ffi/cbindgen.toml b/profiling-ffi/cbindgen.toml index 8fe977e8c..4c3c485dd 100644 --- a/profiling-ffi/cbindgen.toml +++ b/profiling-ffi/cbindgen.toml @@ -23,7 +23,7 @@ renaming_overrides_prefixing = true "ByteSlice" = "ddog_ByteSlice" "CancellationToken" = "ddog_CancellationToken" "CharSlice" = "ddog_CharSlice" -"Endpoint" = "ddog_net1_Endpoint" +"Endpoint" = "ddog_Endpoint" "Error" = "ddog_Error" "HttpStatus" = "ddog_HttpStatus" "Slice_CChar" = "ddog_Slice_CChar" diff --git a/sidecar-ffi/Cargo.toml b/sidecar-ffi/Cargo.toml index f6e2ede87..f32e84c24 100644 --- a/sidecar-ffi/Cargo.toml +++ b/sidecar-ffi/Cargo.toml @@ -17,7 +17,7 @@ datadog-trace-utils = { path = "../trace-utils" } datadog-ipc = { path = "../ipc" } ddcommon = { path = "../ddcommon" } ddcommon-ffi = { path = "../ddcommon-ffi", default-features = false } -ddcommon-net1-ffi = { path = "../ddcommon-net1-ffi" } +ddcommon-net1 = { path = "../ddcommon-net1" } ddtelemetry-ffi = { path = "../ddtelemetry-ffi", default-features = false } datadog-remote-config = { path = "../remote-config" } datadog-live-debugger = { path = "../live-debugger" } diff --git a/sidecar-ffi/src/lib.rs b/sidecar-ffi/src/lib.rs index 60c1fb801..c8eb7cd5a 100644 --- a/sidecar-ffi/src/lib.rs +++ b/sidecar-ffi/src/lib.rs @@ -23,7 +23,7 @@ use datadog_sidecar::shm_remote_config::{path_for_remote_config, RemoteConfigRea use ddcommon::tag::Tag; use ddcommon_ffi as ffi; use ddcommon_ffi::{CharSlice, MaybeError}; -use ddcommon_net1_ffi::Endpoint; +use ddcommon_net1::Endpoint; use ddtelemetry::{ data::{self, Dependency, Integration}, worker::{LifecycleAction, TelemetryActions}, diff --git a/sidecar-ffi/tests/sidecar.rs b/sidecar-ffi/tests/sidecar.rs index 9a09fda5a..42a40649b 100644 --- a/sidecar-ffi/tests/sidecar.rs +++ b/sidecar-ffi/tests/sidecar.rs @@ -11,7 +11,7 @@ macro_rules! assert_maybe_no_error { }; } -use ddcommon_net1_ffi::Endpoint; +use ddcommon_net1::Endpoint; use std::ptr::{null, null_mut}; use std::time::Duration; #[cfg(unix)] diff --git a/tools/docker/Dockerfile.build b/tools/docker/Dockerfile.build index 59cb19352..4ea56a268 100644 --- a/tools/docker/Dockerfile.build +++ b/tools/docker/Dockerfile.build @@ -75,7 +75,6 @@ COPY "crashtracker-ffi/Cargo.toml" "crashtracker-ffi/" COPY "ddcommon/Cargo.toml" "ddcommon/" COPY "ddcommon-ffi/Cargo.toml" "ddcommon-ffi/" COPY "ddcommon-net1/Cargo.toml" "ddcommon-net1/" -COPY "ddcommon-net1-ffi/Cargo.toml" "ddcommon-net1-ffi/" COPY "ddcommon-net2/Cargo.toml" "ddcommon-net2/" COPY "ddtelemetry/Cargo.toml" "ddtelemetry/" COPY "ddtelemetry-ffi/Cargo.toml" "ddtelemetry-ffi/" From 24c38f7901c0c425772be2b2386e745cc902602a Mon Sep 17 00:00:00 2001 From: Levi Morrison Date: Wed, 4 Dec 2024 15:36:57 -0700 Subject: [PATCH 12/13] shrink diff to base branch --- ddcommon-ffi/src/lib.rs | 3 +-- live-debugger-ffi/Cargo.toml | 2 +- profiling-ffi/Cargo.toml | 4 ++-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/ddcommon-ffi/src/lib.rs b/ddcommon-ffi/src/lib.rs index 445ee4e01..5163ca1c0 100644 --- a/ddcommon-ffi/src/lib.rs +++ b/ddcommon-ffi/src/lib.rs @@ -1,10 +1,10 @@ // Copyright 2021-Present Datadog, Inc. https://www.datadoghq.com/ // SPDX-License-Identifier: Apache-2.0 -mod endpoint; mod error; pub mod array_queue; +pub mod endpoint; pub mod option; pub mod slice; pub mod string; @@ -12,7 +12,6 @@ pub mod tags; pub mod timespec; pub mod vec; -pub use endpoint::*; pub use error::*; pub use option::*; pub use slice::{CharSlice, Slice}; diff --git a/live-debugger-ffi/Cargo.toml b/live-debugger-ffi/Cargo.toml index af21510ab..abf49c689 100644 --- a/live-debugger-ffi/Cargo.toml +++ b/live-debugger-ffi/Cargo.toml @@ -13,8 +13,8 @@ bench = false [dependencies] datadog-live-debugger = { path = "../live-debugger" } ddcommon = { path = "../ddcommon" } -ddcommon-ffi = { path = "../ddcommon-ffi", default-features = false } ddcommon-net1 = { path = "../ddcommon-net1" } +ddcommon-ffi = { path = "../ddcommon-ffi", default-features = false } percent-encoding = "2.1" uuid = { version = "1.7.0", features = ["v4"] } serde_json = "1.0" diff --git a/profiling-ffi/Cargo.toml b/profiling-ffi/Cargo.toml index f7efb051e..a5c29df24 100644 --- a/profiling-ffi/Cargo.toml +++ b/profiling-ffi/Cargo.toml @@ -34,7 +34,6 @@ build_common = { path = "../build-common" } anyhow = "1.0" datadog-crashtracker-ffi = { path = "../crashtracker-ffi", default-features = false, optional = true} datadog-profiling = { path = "../profiling" } -futures = { version = "0.3", default-features = false } hyper = { version = "0.14", features = ["backports", "deprecated"], default-features = false } ddcommon = { path = "../ddcommon" } ddcommon-ffi = { path = "../ddcommon-ffi", default-features = false } @@ -42,10 +41,11 @@ ddtelemetry-ffi = { path = "../ddtelemetry-ffi", default-features = false, optio libc = "0.2" tokio-util = "0.7.1" serde_json = { version = "1.0" } +futures = { version = "0.3", default-features = false } symbolizer-ffi = { path = "../symbolizer-ffi", optional = true, default-features = false } symbolic-demangle = { version = "12.8.0", default-features = false, features = ["rust", "cpp", "msvc"] } symbolic-common = "12.8.0" data-pipeline-ffi = { path = "../data-pipeline-ffi", default-features = false, optional = true } [dev-dependencies] -http-body-util = "0.1" \ No newline at end of file +http-body-util = "0.1" From 3c7a2407e3e27329fd3c5f2451d60ed5b8655203 Mon Sep 17 00:00:00 2001 From: Levi Morrison Date: Wed, 4 Dec 2024 15:48:58 -0700 Subject: [PATCH 13/13] fix bundled licenses --- LICENSE-3rdparty.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/LICENSE-3rdparty.yml b/LICENSE-3rdparty.yml index c03ae5549..a4ebe462c 100644 --- a/LICENSE-3rdparty.yml +++ b/LICENSE-3rdparty.yml @@ -28893,7 +28893,7 @@ third_party_libraries: END OF TERMS AND CONDITIONS - package_name: thiserror - package_version: 2.0.3 + package_version: 2.0.4 repository: https://github.com/dtolnay/thiserror license: MIT OR Apache-2.0 licenses: @@ -29309,7 +29309,7 @@ third_party_libraries: END OF TERMS AND CONDITIONS - package_name: thiserror-impl - package_version: 2.0.3 + package_version: 2.0.4 repository: https://github.com/dtolnay/thiserror license: MIT OR Apache-2.0 licenses: @@ -34148,7 +34148,7 @@ third_party_libraries: The files under third-party/chromium are licensed as described in third-party/chromium/LICENSE. - package_name: webpki-roots - package_version: 0.26.7 + package_version: 0.26.6 repository: https://github.com/rustls/webpki-roots license: MPL-2.0 licenses: