diff --git a/.gitignore b/.gitignore index 4e4ac988..e716e7d4 100644 --- a/.gitignore +++ b/.gitignore @@ -9,4 +9,7 @@ hs_err_pid* # IntelliJ -.idea/ \ No newline at end of file +.idea/ + +# Rust +target/ \ No newline at end of file diff --git a/interop/Cargo.lock b/interop/Cargo.lock new file mode 100644 index 00000000..cb080971 --- /dev/null +++ b/interop/Cargo.lock @@ -0,0 +1,1978 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "anstream" +version = "0.6.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43d5b281e737544384e969a5ccad3f1cdd24b48086a0fc1b2a5262a26b8f4f4a" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5192cca8006f1fd4f7237516f40fa183bb07f8fbdfedaa0036de5ea9b0b45e78" + +[[package]] +name = "anstyle-parse" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" +dependencies = [ + "anstyle", + "once_cell_polyfill", + "windows-sys 0.61.2", +] + +[[package]] +name = "async-trait" +version = "0.1.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9035ad2d096bed7955a320ee7e2230574d28fd3c3a0f186cbea1ff3c7eed5dbb" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + +[[package]] +name = "bitflags" +version = "2.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "812e12b5285cc515a9c72a5c1d3b6d46a19dac5acfef5265968c166106e31dd3" + +[[package]] +name = "bumpalo" +version = "3.19.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5dd9dc738b7a8311c7ade152424974d8115f2cdad61e8dab8dac9f2362298510" + +[[package]] +name = "bytes" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b35204fbdc0b3f4446b89fc1ac2cf84a8a68971995d0bf2e925ec7cd960f9cb3" + +[[package]] +name = "cbindgen" +version = "0.29.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "befbfd072a8e81c02f8c507aefce431fe5e7d051f83d48a23ffc9b9fe5a11799" +dependencies = [ + "clap", + "heck", + "indexmap", + "log", + "proc-macro2", + "quote", + "serde", + "serde_json", + "syn", + "tempfile", + "toml", +] + +[[package]] +name = "cc" +version = "1.2.51" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a0aeaff4ff1a90589618835a598e545176939b97874f7abc7851caa0618f203" +dependencies = [ + "find-msvc-tools", + "shlex", +] + +[[package]] +name = "cfg-if" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" + +[[package]] +name = "cfg_aliases" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" + +[[package]] +name = "clap" +version = "4.5.53" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9e340e012a1bf4935f5282ed1436d1489548e8f72308207ea5df0e23d2d03f8" +dependencies = [ + "clap_builder", +] + +[[package]] +name = "clap_builder" +version = "4.5.53" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d76b5d13eaa18c901fd2f7fca939fefe3a0727a953561fefdf3b2922b8569d00" +dependencies = [ + "anstream", + "anstyle", + "clap_lex", + "strsim", +] + +[[package]] +name = "clap_lex" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1d728cc89cf3aee9ff92b05e62b19ee65a02b5702cff7d5a377e32c6ae29d8d" + +[[package]] +name = "colorchoice" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" + +[[package]] +name = "data-encoding" +version = "2.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a2330da5de22e8a3cb63252ce2abb30116bf5265e89c0e01bc17015ce30a476" + +[[package]] +name = "displaydoc" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "enum-as-inner" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1e6a265c649f3f5979b601d26f1d05ada116434c87741c9493cb56218f76cbc" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "equivalent" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" + +[[package]] +name = "errno" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "fastrand" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" + +[[package]] +name = "find-msvc-tools" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "645cbb3a84e60b7531617d5ae4e57f7e27308f6445f5abf653209ea76dec8dff" + +[[package]] +name = "form_urlencoded" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "futures-channel" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" + +[[package]] +name = "futures-io" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" + +[[package]] +name = "futures-sink" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" + +[[package]] +name = "futures-task" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" + +[[package]] +name = "futures-util" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" +dependencies = [ + "futures-core", + "futures-io", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "pin-utils", + "slab", +] + +[[package]] +name = "getrandom" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "wasi", + "wasm-bindgen", +] + +[[package]] +name = "getrandom" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "r-efi", + "wasip2", + "wasm-bindgen", +] + +[[package]] +name = "hashbrown" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "hickory-proto" +version = "0.24.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92652067c9ce6f66ce53cc38d1169daa36e6e7eb7dd3b63b5103bd9d97117248" +dependencies = [ + "async-trait", + "cfg-if", + "data-encoding", + "enum-as-inner", + "futures-channel", + "futures-io", + "futures-util", + "idna", + "ipnet", + "once_cell", + "rand 0.8.5", + "thiserror 1.0.69", + "tinyvec", + "tokio", + "tracing", + "url", +] + +[[package]] +name = "hickory-resolver" +version = "0.24.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cbb117a1ca520e111743ab2f6688eddee69db4e0ea242545a604dce8a66fd22e" +dependencies = [ + "cfg-if", + "futures-util", + "hickory-proto", + "ipconfig", + "lru-cache", + "once_cell", + "parking_lot", + "rand 0.8.5", + "resolv-conf", + "smallvec", + "thiserror 1.0.69", + "tokio", + "tracing", +] + +[[package]] +name = "http" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3ba2a386d7f85a81f119ad7498ebe444d2e22c2af0b86b069416ace48b3311a" +dependencies = [ + "bytes", + "itoa", +] + +[[package]] +name = "http-body" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" +dependencies = [ + "bytes", + "http", +] + +[[package]] +name = "http-body-util" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b021d93e26becf5dc7e1b75b1bed1fd93124b374ceb73f43d4d4eafec896a64a" +dependencies = [ + "bytes", + "futures-core", + "http", + "http-body", + "pin-project-lite", +] + +[[package]] +name = "http-native" +version = "0.1.0" +dependencies = [ + "cbindgen", + "hickory-resolver", + "reqwest", + "tokio", +] + +[[package]] +name = "httparse" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" + +[[package]] +name = "hyper" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ab2d4f250c3d7b1c9fcdff1cece94ea4e2dfbec68614f7b87cb205f24ca9d11" +dependencies = [ + "atomic-waker", + "bytes", + "futures-channel", + "futures-core", + "http", + "http-body", + "httparse", + "itoa", + "pin-project-lite", + "pin-utils", + "smallvec", + "tokio", + "want", +] + +[[package]] +name = "hyper-rustls" +version = "0.27.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3c93eb611681b207e1fe55d5a71ecf91572ec8a6705cdb6857f7d8d5242cf58" +dependencies = [ + "http", + "hyper", + "hyper-util", + "rustls", + "rustls-pki-types", + "tokio", + "tokio-rustls", + "tower-service", + "webpki-roots", +] + +[[package]] +name = "hyper-util" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "727805d60e7938b76b826a6ef209eb70eaa1812794f9424d4a4e2d740662df5f" +dependencies = [ + "base64", + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "http", + "http-body", + "hyper", + "ipnet", + "libc", + "percent-encoding", + "pin-project-lite", + "socket2 0.6.1", + "tokio", + "tower-service", + "tracing", +] + +[[package]] +name = "icu_collections" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c6b649701667bbe825c3b7e6388cb521c23d88644678e83c0c4d0a621a34b43" +dependencies = [ + "displaydoc", + "potential_utf", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locale_core" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edba7861004dd3714265b4db54a3c390e880ab658fec5f7db895fae2046b5bb6" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_normalizer" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f6c8828b67bf8908d82127b2054ea1b4427ff0230ee9141c54251934ab1b599" +dependencies = [ + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7aedcccd01fc5fe81e6b489c15b247b8b0690feb23304303a9e560f37efc560a" + +[[package]] +name = "icu_properties" +version = "2.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "020bfc02fe870ec3a66d93e677ccca0562506e5872c650f893269e08615d74ec" +dependencies = [ + "icu_collections", + "icu_locale_core", + "icu_properties_data", + "icu_provider", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "2.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "616c294cf8d725c6afcd8f55abc17c56464ef6211f9ed59cccffe534129c77af" + +[[package]] +name = "icu_provider" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85962cf0ce02e1e0a629cc34e7ca3e373ce20dda4c4d7294bbd0bf1fdb59e614" +dependencies = [ + "displaydoc", + "icu_locale_core", + "writeable", + "yoke", + "zerofrom", + "zerotrie", + "zerovec", +] + +[[package]] +name = "idna" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" +dependencies = [ + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3acae9609540aa318d1bc588455225fb2085b9ed0c4f6bd0d9d5bcd86f1a0344" +dependencies = [ + "icu_normalizer", + "icu_properties", +] + +[[package]] +name = "indexmap" +version = "2.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ad4bb2b565bca0645f4d68c5c9af97fba094e9791da685bf83cb5f3ce74acf2" +dependencies = [ + "equivalent", + "hashbrown", +] + +[[package]] +name = "ipconfig" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b58db92f96b720de98181bbbe63c831e87005ab460c1bf306eb2622b4707997f" +dependencies = [ + "socket2 0.5.10", + "widestring", + "windows-sys 0.48.0", + "winreg", +] + +[[package]] +name = "ipnet" +version = "2.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "469fb0b9cefa57e3ef31275ee7cacb78f2fdca44e4765491884a2b119d4eb130" + +[[package]] +name = "iri-string" +version = "0.7.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f867b9d1d896b67beb18518eda36fdb77a32ea590de864f1325b294a6d14397" +dependencies = [ + "memchr", + "serde", +] + +[[package]] +name = "is_terminal_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" + +[[package]] +name = "itoa" +version = "1.0.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ee5b5339afb4c41626dde77b7a611bd4f2c202b897852b4bcf5d03eddc61010" + +[[package]] +name = "js-sys" +version = "0.3.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "464a3709c7f55f1f721e5389aa6ea4e3bc6aba669353300af094b29ffbdde1d8" +dependencies = [ + "once_cell", + "wasm-bindgen", +] + +[[package]] +name = "libc" +version = "0.2.178" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37c93d8daa9d8a012fd8ab92f088405fb202ea0b6ab73ee2482ae66af4f42091" + +[[package]] +name = "linked-hash-map" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" + +[[package]] +name = "linux-raw-sys" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df1d3c3b53da64cf5760482273a98e575c651a67eec7f77df96b5b642de8f039" + +[[package]] +name = "litemap" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6373607a59f0be73a39b6fe456b8192fcc3585f602af20751600e974dd455e77" + +[[package]] +name = "lock_api" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" +dependencies = [ + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897" + +[[package]] +name = "lru-cache" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31e24f1ad8321ca0e8a1e0ac13f23cb668e6f5466c2c57319f6a5cf1cc8e3b1c" +dependencies = [ + "linked-hash-map", +] + +[[package]] +name = "lru-slab" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "112b39cec0b298b6c1999fee3e31427f74f676e4cb9879ed1a121b43661a4154" + +[[package]] +name = "memchr" +version = "2.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273" + +[[package]] +name = "mio" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a69bcab0ad47271a0234d9422b131806bf3968021e5dc9328caf2d4cd58557fc" +dependencies = [ + "libc", + "wasi", + "windows-sys 0.61.2", +] + +[[package]] +name = "once_cell" +version = "1.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" + +[[package]] +name = "once_cell_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" + +[[package]] +name = "parking_lot" +version = "0.12.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-link", +] + +[[package]] +name = "percent-encoding" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" + +[[package]] +name = "pin-project-lite" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "potential_utf" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b73949432f5e2a09657003c25bca5e19a0e9c84f8058ca374f49e0ebe605af77" +dependencies = [ + "zerovec", +] + +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] + +[[package]] +name = "proc-macro2" +version = "1.0.103" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ee95bc4ef87b8d5ba32e8b7714ccc834865276eab0aed5c9958d00ec45f49e8" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quinn" +version = "0.11.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e20a958963c291dc322d98411f541009df2ced7b5a4f2bd52337638cfccf20" +dependencies = [ + "bytes", + "cfg_aliases", + "pin-project-lite", + "quinn-proto", + "quinn-udp", + "rustc-hash", + "rustls", + "socket2 0.6.1", + "thiserror 2.0.17", + "tokio", + "tracing", + "web-time", +] + +[[package]] +name = "quinn-proto" +version = "0.11.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1906b49b0c3bc04b5fe5d86a77925ae6524a19b816ae38ce1e426255f1d8a31" +dependencies = [ + "bytes", + "getrandom 0.3.4", + "lru-slab", + "rand 0.9.2", + "ring", + "rustc-hash", + "rustls", + "rustls-pki-types", + "slab", + "thiserror 2.0.17", + "tinyvec", + "tracing", + "web-time", +] + +[[package]] +name = "quinn-udp" +version = "0.5.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "addec6a0dcad8a8d96a771f815f0eaf55f9d1805756410b39f5fa81332574cbd" +dependencies = [ + "cfg_aliases", + "libc", + "once_cell", + "socket2 0.6.1", + "tracing", + "windows-sys 0.60.2", +] + +[[package]] +name = "quote" +version = "1.0.42" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a338cc41d27e6cc6dce6cefc13a0729dfbb81c262b1f519331575dd80ef3067f" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "r-efi" +version = "5.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" + +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha 0.3.1", + "rand_core 0.6.4", +] + +[[package]] +name = "rand" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" +dependencies = [ + "rand_chacha 0.9.0", + "rand_core 0.9.3", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core 0.6.4", +] + +[[package]] +name = "rand_chacha" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" +dependencies = [ + "ppv-lite86", + "rand_core 0.9.3", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom 0.2.16", +] + +[[package]] +name = "rand_core" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" +dependencies = [ + "getrandom 0.3.4", +] + +[[package]] +name = "redox_syscall" +version = "0.5.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" +dependencies = [ + "bitflags", +] + +[[package]] +name = "reqwest" +version = "0.12.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eddd3ca559203180a307f12d114c268abf583f59b03cb906fd0b3ff8646c1147" +dependencies = [ + "base64", + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-rustls", + "hyper-util", + "js-sys", + "log", + "percent-encoding", + "pin-project-lite", + "quinn", + "rustls", + "rustls-pki-types", + "serde", + "serde_json", + "serde_urlencoded", + "sync_wrapper", + "tokio", + "tokio-rustls", + "tower", + "tower-http", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "webpki-roots", +] + +[[package]] +name = "resolv-conf" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e061d1b48cb8d38042de4ae0a7a6401009d6143dc80d2e2d6f31f0bdd6470c7" + +[[package]] +name = "ring" +version = "0.17.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" +dependencies = [ + "cc", + "cfg-if", + "getrandom 0.2.16", + "libc", + "untrusted", + "windows-sys 0.52.0", +] + +[[package]] +name = "rustc-hash" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d" + +[[package]] +name = "rustix" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "146c9e247ccc180c1f61615433868c99f3de3ae256a30a43b49f67c2d9171f34" +dependencies = [ + "bitflags", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.61.2", +] + +[[package]] +name = "rustls" +version = "0.23.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "533f54bc6a7d4f647e46ad909549eda97bf5afc1585190ef692b4286b198bd8f" +dependencies = [ + "once_cell", + "ring", + "rustls-pki-types", + "rustls-webpki", + "subtle", + "zeroize", +] + +[[package]] +name = "rustls-pki-types" +version = "1.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21e6f2ab2928ca4291b86736a8bd920a277a399bba1589409d72154ff87c1282" +dependencies = [ + "web-time", + "zeroize", +] + +[[package]] +name = "rustls-webpki" +version = "0.103.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ffdfa2f5286e2247234e03f680868ac2815974dc39e00ea15adc445d0aafe52" +dependencies = [ + "ring", + "rustls-pki-types", + "untrusted", +] + +[[package]] +name = "rustversion" +version = "1.0.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" + +[[package]] +name = "ryu" +version = "1.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62049b2877bf12821e8f9ad256ee38fdc31db7387ec2d3b3f403024de2034aea" + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "serde" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.147" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6af14725505314343e673e9ecb7cd7e8a36aa9791eb936235a3567cc31447ae4" +dependencies = [ + "itoa", + "memchr", + "serde", + "serde_core", + "zmij", +] + +[[package]] +name = "serde_spanned" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8bbf91e5a4d6315eee45e704372590b30e260ee83af6639d64557f51b067776" +dependencies = [ + "serde_core", +] + +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[package]] +name = "signal-hook-registry" +version = "1.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b" +dependencies = [ + "errno", + "libc", +] + +[[package]] +name = "slab" +version = "0.4.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a2ae44ef20feb57a68b23d846850f861394c2e02dc425a50098ae8c90267589" + +[[package]] +name = "smallvec" +version = "1.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" + +[[package]] +name = "socket2" +version = "0.5.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e22376abed350d73dd1cd119b57ffccad95b4e585a7cda43e286245ce23c0678" +dependencies = [ + "libc", + "windows-sys 0.52.0", +] + +[[package]] +name = "socket2" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17129e116933cf371d018bb80ae557e889637989d8638274fb25622827b03881" +dependencies = [ + "libc", + "windows-sys 0.60.2", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + +[[package]] +name = "syn" +version = "2.0.111" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "390cc9a294ab71bdb1aa2e99d13be9c753cd2d7bd6560c77118597410c4d2e87" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "sync_wrapper" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" +dependencies = [ + "futures-core", +] + +[[package]] +name = "synstructure" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tempfile" +version = "3.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "655da9c7eb6305c55742045d5a8d2037996d61d8de95806335c7c86ce0f82e9c" +dependencies = [ + "fastrand", + "getrandom 0.3.4", + "once_cell", + "rustix", + "windows-sys 0.61.2", +] + +[[package]] +name = "thiserror" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" +dependencies = [ + "thiserror-impl 1.0.69", +] + +[[package]] +name = "thiserror" +version = "2.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f63587ca0f12b72a0600bcba1d40081f830876000bb46dd2337a3051618f4fc8" +dependencies = [ + "thiserror-impl 2.0.17", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ff15c8ecd7de3849db632e14d18d2571fa09dfc5ed93479bc4485c7a517c913" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tinystr" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42d3e9c45c09de15d06dd8acf5f4e0e399e85927b7f00711024eb7ae10fa4869" +dependencies = [ + "displaydoc", + "zerovec", +] + +[[package]] +name = "tinyvec" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa5fdc3bce6191a1dbc8c02d5c8bffcf557bafa17c124c5264a458f1b0613fa" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + +[[package]] +name = "tokio" +version = "1.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff360e02eab121e0bc37a2d3b4d4dc622e6eda3a8e5253d5435ecf5bd4c68408" +dependencies = [ + "bytes", + "libc", + "mio", + "parking_lot", + "pin-project-lite", + "signal-hook-registry", + "socket2 0.6.1", + "tokio-macros", + "windows-sys 0.61.2", +] + +[[package]] +name = "tokio-macros" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af407857209536a95c8e56f8231ef2c2e2aff839b22e07a1ffcbc617e9db9fa5" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tokio-rustls" +version = "0.26.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1729aa945f29d91ba541258c8df89027d5792d85a8841fb65e8bf0f4ede4ef61" +dependencies = [ + "rustls", + "tokio", +] + +[[package]] +name = "toml" +version = "0.9.10+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0825052159284a1a8b4d6c0c86cbc801f2da5afd2b225fa548c72f2e74002f48" +dependencies = [ + "indexmap", + "serde_core", + "serde_spanned", + "toml_datetime", + "toml_parser", + "toml_writer", + "winnow", +] + +[[package]] +name = "toml_datetime" +version = "0.7.5+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92e1cfed4a3038bc5a127e35a2d360f145e1f4b971b551a2ba5fd7aedf7e1347" +dependencies = [ + "serde_core", +] + +[[package]] +name = "toml_parser" +version = "1.0.6+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3198b4b0a8e11f09dd03e133c0280504d0801269e9afa46362ffde1cbeebf44" +dependencies = [ + "winnow", +] + +[[package]] +name = "toml_writer" +version = "1.0.6+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab16f14aed21ee8bfd8ec22513f7287cd4a91aa92e44edfe2c17ddd004e92607" + +[[package]] +name = "tower" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d039ad9159c98b70ecfd540b2573b97f7f52c3e8d9f8ad57a24b916a536975f9" +dependencies = [ + "futures-core", + "futures-util", + "pin-project-lite", + "sync_wrapper", + "tokio", + "tower-layer", + "tower-service", +] + +[[package]] +name = "tower-http" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4e6559d53cc268e5031cd8429d05415bc4cb4aefc4aa5d6cc35fbf5b924a1f8" +dependencies = [ + "bitflags", + "bytes", + "futures-util", + "http", + "http-body", + "iri-string", + "pin-project-lite", + "tower", + "tower-layer", + "tower-service", +] + +[[package]] +name = "tower-layer" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" + +[[package]] +name = "tower-service" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" + +[[package]] +name = "tracing" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" +dependencies = [ + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tracing-core" +version = "0.1.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" +dependencies = [ + "once_cell", +] + +[[package]] +name = "try-lock" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" + +[[package]] +name = "unicode-ident" +version = "1.0.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5" + +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + +[[package]] +name = "url" +version = "2.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08bc136a29a3d1758e07a9cca267be308aeebf5cfd5a10f3f67ab2097683ef5b" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", + "serde", +] + +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + +[[package]] +name = "want" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" +dependencies = [ + "try-lock", +] + +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + +[[package]] +name = "wasip2" +version = "1.0.1+wasi-0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0562428422c63773dad2c345a1882263bbf4d65cf3f42e90921f787ef5ad58e7" +dependencies = [ + "wit-bindgen", +] + +[[package]] +name = "wasm-bindgen" +version = "0.2.106" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d759f433fa64a2d763d1340820e46e111a7a5ab75f993d1852d70b03dbb80fd" +dependencies = [ + "cfg-if", + "once_cell", + "rustversion", + "wasm-bindgen-macro", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.56" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "836d9622d604feee9e5de25ac10e3ea5f2d65b41eac0d9ce72eb5deae707ce7c" +dependencies = [ + "cfg-if", + "js-sys", + "once_cell", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.106" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48cb0d2638f8baedbc542ed444afc0644a29166f1595371af4fecf8ce1e7eeb3" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.106" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cefb59d5cd5f92d9dcf80e4683949f15ca4b511f4ac0a6e14d4e1ac60c6ecd40" +dependencies = [ + "bumpalo", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.106" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cbc538057e648b67f72a982e708d485b2efa771e1ac05fec311f9f63e5800db4" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "web-sys" +version = "0.3.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b32828d774c412041098d182a8b38b16ea816958e07cf40eec2bc080ae137ac" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "web-time" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "webpki-roots" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2878ef029c47c6e8cf779119f20fcf52bde7ad42a731b2a304bc221df17571e" +dependencies = [ + "rustls-pki-types", +] + +[[package]] +name = "widestring" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72069c3113ab32ab29e5584db3c6ec55d416895e60715417b5b883a357c3e471" + +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets 0.48.5", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" +dependencies = [ + "windows-targets 0.53.5", +] + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", + "windows_i686_gnullvm 0.52.6", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", +] + +[[package]] +name = "windows-targets" +version = "0.53.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4945f9f551b88e0d65f3db0bc25c33b8acea4d9e41163edf90dcd0b19f9069f3" +dependencies = [ + "windows-link", + "windows_aarch64_gnullvm 0.53.1", + "windows_aarch64_msvc 0.53.1", + "windows_i686_gnu 0.53.1", + "windows_i686_gnullvm 0.53.1", + "windows_i686_msvc 0.53.1", + "windows_x86_64_gnu 0.53.1", + "windows_x86_64_gnullvm 0.53.1", + "windows_x86_64_msvc 0.53.1", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9d8416fa8b42f5c947f8482c43e7d89e73a173cead56d044f6a56104a6d1b53" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9d782e804c2f632e395708e99a94275910eb9100b2114651e04744e9b125006" + +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnu" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "960e6da069d81e09becb0ca57a65220ddff016ff2d6af6a223cf372a506593a3" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa7359d10048f68ab8b09fa71c3daccfb0e9b559aed648a8f95469c27057180c" + +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_i686_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e7ac75179f18232fe9c285163565a57ef8d3c89254a30685b57d83a38d326c2" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c3842cdd74a865a8066ab39c8a7a473c0778a3f29370b5fd6b4b9aa7df4a499" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ffa179e2d07eee8ad8f57493436566c7cc30ac536a3379fdf008f47f6bb7ae1" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650" + +[[package]] +name = "winnow" +version = "0.7.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a5364e9d77fcdeeaa6062ced926ee3381faa2ee02d3eb83a5c27a8825540829" + +[[package]] +name = "winreg" +version = "0.50.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" +dependencies = [ + "cfg-if", + "windows-sys 0.48.0", +] + +[[package]] +name = "wit-bindgen" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f17a85883d4e6d00e8a97c586de764dabcc06133f7f1d55dce5cdc070ad7fe59" + +[[package]] +name = "writeable" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9edde0db4769d2dc68579893f2306b26c6ecfbe0ef499b013d731b7b9247e0b9" + +[[package]] +name = "yoke" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72d6e5c6afb84d73944e5cedb052c4680d5657337201555f9f2a16b7406d4954" +dependencies = [ + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b659052874eb698efe5b9e8cf382204678a0086ebf46982b79d6ca3182927e5d" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + +[[package]] +name = "zerocopy" +version = "0.8.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd74ec98b9250adb3ca554bdde269adf631549f51d8a8f8f0a10b50f1cb298c3" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8a8d209fdf45cf5138cbb5a506f6b52522a25afccc534d1475dad8e31105c6a" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "zerofrom" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50cc42e0333e05660c3587f3bf9d0478688e15d870fab3346451ce7f8c9fbea5" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + +[[package]] +name = "zeroize" +version = "1.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0" + +[[package]] +name = "zerotrie" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a59c17a5562d507e4b54960e8569ebee33bee890c70aa3fe7b97e85a9fd7851" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", +] + +[[package]] +name = "zerovec" +version = "0.11.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c28719294829477f525be0186d13efa9a3c602f7ec202ca9e353d310fb9a002" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eadce39539ca5cb3985590102671f2567e659fca9666581ad3411d59207951f3" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "zmij" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0095ecd462946aa3927d9297b63ef82fb9a5316d7a37d134eeb36e58228615a" diff --git a/interop/Cargo.toml b/interop/Cargo.toml new file mode 100644 index 00000000..084b63f8 --- /dev/null +++ b/interop/Cargo.toml @@ -0,0 +1,22 @@ +[package] +name = "http-native" +version = "0.1.0" +edition = "2021" +rust-version = "1.83.0" + +[lib] +crate-type = ["cdylib", "staticlib"] +name = "http_native" + +[dependencies] +reqwest = { version = "0.12", features = ["blocking", "json", "rustls-tls"], default-features = false } +tokio = { version = "1.42", features = ["full"] } +hickory-resolver = "0.24" + +[profile.release] +opt-level = 3 +lto = true +codegen-units = 1 + +[build-dependencies] +cbindgen = "0.29.2" \ No newline at end of file diff --git a/interop/build.rs b/interop/build.rs new file mode 100644 index 00000000..812447ad --- /dev/null +++ b/interop/build.rs @@ -0,0 +1,18 @@ +extern crate cbindgen; + +use std::env; +use std::path::PathBuf; + +fn main() { + let crate_dir = env::var("CARGO_MANIFEST_DIR").unwrap(); + let output_file = PathBuf::from(&crate_dir).join("http_native.h"); + + cbindgen::Builder::new() + .with_crate(crate_dir) + .with_language(cbindgen::Language::C) + .with_include_guard("HTTP_NATIVE_H") + .with_cpp_compat(true) + .generate() + .expect("Unable to generate bindings") + .write_to_file(output_file); +} \ No newline at end of file diff --git a/interop/cbindgen.toml b/interop/cbindgen.toml new file mode 100644 index 00000000..b438f353 --- /dev/null +++ b/interop/cbindgen.toml @@ -0,0 +1,15 @@ +language = "C" +include_guard = "HTTP_NATIVE_H" +autogen_warning = "/* Warning, this file is autogenerated by cbindgen. Don't modify this manually. */" +include_version = true +namespace = "http_native" +cpp_compat = true +style = "both" + +[export] +include = ["DnsResult", "HttpResponse", "HttpRequest"] + +[export.rename] +"DnsResult" = "DnsResult" +"HttpResponse" = "HttpResponse" +"HttpRequest" = "HttpRequest" diff --git a/interop/http_native.h b/interop/http_native.h new file mode 100644 index 00000000..9e73a44e --- /dev/null +++ b/interop/http_native.h @@ -0,0 +1,57 @@ +#ifndef HTTP_NATIVE_H +#define HTTP_NATIVE_H + +#include +#include +#include +#include + +typedef struct DnsResult { + char **addresses; + uintptr_t count; + char *error; +} DnsResult; + +typedef struct HttpResponse { + char *body; + uint16_t status_code; + char *error; +} HttpResponse; + +typedef struct HttpRequest { + const char *url; + const char *method; + char **headers; + uintptr_t headers_count; + const char *body; + uintptr_t body_len; + uint64_t timeout_ms; +} HttpRequest; + +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + +struct DnsResult *dns_resolve(const char *hostname, + const char *const *dns_servers, + uintptr_t dns_servers_count); + +void dns_result_free(struct DnsResult *result); + +struct HttpResponse *http_request_execute(const struct HttpRequest *request); + +void http_response_free(struct HttpResponse *response); + +int32_t unix_socket_connect(const char *path); + +int32_t unix_socket_connect(const char *_path); + +void free_cstring(char *ptr); + +struct DnsResult *dns_resolve_simple(const char *hostname); + +#ifdef __cplusplus +} // extern "C" +#endif // __cplusplus + +#endif /* HTTP_NATIVE_H */ diff --git a/interop/src/lib.rs b/interop/src/lib.rs new file mode 100644 index 00000000..342416a6 --- /dev/null +++ b/interop/src/lib.rs @@ -0,0 +1,361 @@ +use hickory_resolver::config::{NameServerConfig, ResolverConfig, ResolverOpts}; +use hickory_resolver::TokioAsyncResolver; +use reqwest::Client; +use std::ffi::{CStr, CString}; +use std::net::{IpAddr, SocketAddr}; +use std::os::raw::c_char; +use std::time::Duration; + +#[cfg(unix)] +use std::os::unix::net::UnixStream; +#[cfg(unix)] +use std::path::Path; + +#[repr(C)] +pub struct DnsResult { + pub addresses: *mut *mut c_char, + pub count: usize, + pub error: *mut c_char, +} + +#[repr(C)] +pub struct HttpResponse { + pub body: *mut c_char, + pub status_code: u16, + pub error: *mut c_char, +} + +#[repr(C)] +pub struct HttpRequest { + pub url: *const c_char, + pub method: *const c_char, + pub headers: *mut *mut c_char, + pub headers_count: usize, + pub body: *const c_char, + pub body_len: usize, + pub timeout_ms: u64, +} + +#[no_mangle] +pub extern "C" fn dns_resolve( + hostname: *const c_char, + dns_servers: *const *const c_char, + dns_servers_count: usize, +) -> *mut DnsResult { + let hostname = unsafe { + match CStr::from_ptr(hostname).to_str() { + Ok(s) => s, + Err(_) => return create_dns_error("Invalid hostname encoding"), + } + }; + + let dns_server_ips: Vec = if dns_servers_count > 0 { + (0..dns_servers_count) + .filter_map(|i| unsafe { + let server_ptr = *dns_servers.add(i); + CStr::from_ptr(server_ptr) + .to_str() + .ok() + .and_then(|s| s.parse::().ok()) + }) + .collect() + } else { + vec![] + }; + + let rt = match tokio::runtime::Runtime::new() { + Ok(rt) => rt, + Err(_) => return create_dns_error("Failed to create runtime"), + }; + + rt.block_on(async { + let resolver = if dns_server_ips.is_empty() { + match TokioAsyncResolver::tokio_from_system_conf() { + Ok(r) => r, + Err(e) => return create_dns_error(&format!("Failed to create system resolver: {}", e)), + } + } else { + let mut config = ResolverConfig::new(); + + for ip in dns_server_ips { + let socket_addr = SocketAddr::new(ip, 53); + let name_server = NameServerConfig { + socket_addr, + protocol: hickory_resolver::config::Protocol::Udp, + tls_dns_name: None, + trust_negative_responses: true, + bind_addr: None, + }; + config.add_name_server(name_server); + } + + let opts = ResolverOpts::default(); + + TokioAsyncResolver::tokio(config, opts) + }; + + match resolver.lookup_ip(hostname).await { + Ok(lookup) => { + let addresses: Vec = lookup + .iter() + .map(|ip| ip.to_string()) + .collect(); + + if addresses.is_empty() { + return create_dns_error("No addresses found"); + } + + let c_addresses: Vec<*mut c_char> = addresses + .into_iter() + .map(|addr| { + CString::new(addr).unwrap().into_raw() + }) + .collect(); + + let count = c_addresses.len(); + let addresses_ptr = Box::into_raw(c_addresses.into_boxed_slice()) as *mut *mut c_char; + + Box::into_raw(Box::new(DnsResult { + addresses: addresses_ptr, + count, + error: std::ptr::null_mut(), + })) + } + Err(e) => create_dns_error(&format!("DNS lookup failed: {}", e)), + } + }) +} + +fn create_dns_error(message: &str) -> *mut DnsResult { + Box::into_raw(Box::new(DnsResult { + addresses: std::ptr::null_mut(), + count: 0, + error: CString::new(message).unwrap().into_raw(), + })) +} + +#[no_mangle] +pub extern "C" fn dns_result_free(result: *mut DnsResult) { + if result.is_null() { + return; + } + + unsafe { + let result = Box::from_raw(result); + + if !result.error.is_null() { + let _ = CString::from_raw(result.error); + } + + if !result.addresses.is_null() { + let addresses = Vec::from_raw_parts( + result.addresses, + result.count, + result.count, + ); + for addr in addresses { + if !addr.is_null() { + let _ = CString::from_raw(addr); + } + } + } + } +} + +#[no_mangle] +pub extern "C" fn http_request_execute(request: *const HttpRequest) -> *mut HttpResponse { + if request.is_null() { + return create_http_error("Null request", 0); + } + + let request = unsafe { &*request }; + + let url = unsafe { + match CStr::from_ptr(request.url).to_str() { + Ok(s) => s, + Err(_) => return create_http_error("Invalid URL encoding", 0), + } + }; + + let method = unsafe { + match CStr::from_ptr(request.method).to_str() { + Ok(s) => s, + Err(_) => return create_http_error("Invalid method encoding", 0), + } + }; + + let rt = match tokio::runtime::Runtime::new() { + Ok(rt) => rt, + Err(_) => return create_http_error("Failed to create runtime", 0), + }; + + rt.block_on(async { + let client = match Client::builder() + .timeout(Duration::from_millis(request.timeout_ms)) + .build() + { + Ok(c) => c, + Err(e) => return create_http_error(&format!("Failed to create client: {}", e), 0), + }; + + let mut req_builder = match method { + "GET" => client.get(url), + "POST" => client.post(url), + "PUT" => client.put(url), + "DELETE" => client.delete(url), + "PATCH" => client.patch(url), + "HEAD" => client.head(url), + _ => return create_http_error("Unsupported HTTP method", 0), + }; + + for i in 0..request.headers_count { + unsafe { + let header_ptr = *request.headers.add(i); + if let Ok(header_str) = CStr::from_ptr(header_ptr).to_str() { + if let Some((key, value)) = header_str.split_once(':') { + req_builder = req_builder.header(key.trim(), value.trim()); + } + } + } + } + + if !request.body.is_null() && request.body_len > 0 { + let body_slice = unsafe { + std::slice::from_raw_parts(request.body as *const u8, request.body_len) + }; + req_builder = req_builder.body(body_slice.to_vec()); + } + + match req_builder.send().await { + Ok(response) => { + let status = response.status().as_u16(); + match response.text().await { + Ok(body) => { + let body_cstring = match CString::new(body) { + Ok(s) => s, + Err(_) => return create_http_error("Response contains null bytes", status), + }; + + Box::into_raw(Box::new(HttpResponse { + body: body_cstring.into_raw(), + status_code: status, + error: std::ptr::null_mut(), + })) + } + Err(e) => create_http_error(&format!("Failed to read response: {}", e), status), + } + } + Err(e) => create_http_error(&format!("Request failed: {}", e), 0), + } + }) +} + +fn create_http_error(message: &str, status: u16) -> *mut HttpResponse { + Box::into_raw(Box::new(HttpResponse { + body: std::ptr::null_mut(), + status_code: status, + error: CString::new(message).unwrap().into_raw(), + })) +} + +#[no_mangle] +pub extern "C" fn http_response_free(response: *mut HttpResponse) { + if response.is_null() { + return; + } + + unsafe { + let response = Box::from_raw(response); + + if !response.body.is_null() { + let _ = CString::from_raw(response.body); + } + + if !response.error.is_null() { + let _ = CString::from_raw(response.error); + } + } +} + +#[cfg(unix)] +#[no_mangle] +pub extern "C" fn unix_socket_connect(path: *const c_char) -> i32 { + let path_str = unsafe { + match CStr::from_ptr(path).to_str() { + Ok(s) => s, + Err(_) => return -1, + } + }; + + match UnixStream::connect(Path::new(path_str)) { + Ok(_) => 0, + Err(_) => -1, + } +} + +#[cfg(not(unix))] +#[no_mangle] +pub extern "C" fn unix_socket_connect(_path: *const c_char) -> i32 { + -2 // Not supported on this platform +} + +#[no_mangle] +pub extern "C" fn free_cstring(ptr: *mut c_char) { + if !ptr.is_null() { + unsafe { + let _ = CString::from_raw(ptr); + } + } +} + +#[no_mangle] +pub extern "C" fn dns_resolve_simple( + hostname: *const c_char, +) -> *mut DnsResult { + let hostname = unsafe { + match CStr::from_ptr(hostname).to_str() { + Ok(s) => s, + Err(_) => return create_dns_error("Invalid hostname encoding"), + } + }; + + let rt = match tokio::runtime::Runtime::new() { + Ok(rt) => rt, + Err(_) => return create_dns_error("Failed to create runtime"), + }; + + rt.block_on(async { + let resolver = match TokioAsyncResolver::tokio_from_system_conf() { + Ok(r) => r, + Err(e) => return create_dns_error(&format!("Failed to create resolver: {}", e)), + }; + + match resolver.lookup_ip(hostname).await { + Ok(lookup) => { + let addresses: Vec = lookup + .iter() + .map(|ip| ip.to_string()) + .collect(); + + if addresses.is_empty() { + return create_dns_error("No addresses found"); + } + + let c_addresses: Vec<*mut c_char> = addresses + .into_iter() + .map(|addr| CString::new(addr).unwrap().into_raw()) + .collect(); + + let count = c_addresses.len(); + let addresses_ptr = Box::into_raw(c_addresses.into_boxed_slice()) as *mut *mut c_char; + + Box::into_raw(Box::new(DnsResult { + addresses: addresses_ptr, + count, + error: std::ptr::null_mut(), + })) + } + Err(e) => create_dns_error(&format!("DNS lookup failed: {}", e)), + } + }) +} \ No newline at end of file diff --git a/lib/.run/Run Windows.run.xml b/lib/.run/Run Windows.run.xml new file mode 100644 index 00000000..1b4d92bf --- /dev/null +++ b/lib/.run/Run Windows.run.xml @@ -0,0 +1,27 @@ + + + + + + + false + true + false + false + false + false + false + + + \ No newline at end of file diff --git a/api/docker-kotlin.api b/lib/api/docker-kotlin.api similarity index 100% rename from api/docker-kotlin.api rename to lib/api/docker-kotlin.api diff --git a/api/docker-kotlin.klib.api b/lib/api/docker-kotlin.klib.api similarity index 100% rename from api/docker-kotlin.klib.api rename to lib/api/docker-kotlin.klib.api diff --git a/build.gradle.kts b/lib/build.gradle.kts similarity index 73% rename from build.gradle.kts rename to lib/build.gradle.kts index 2ce4a3e9..710350cb 100644 --- a/build.gradle.kts +++ b/lib/build.gradle.kts @@ -1,3 +1,5 @@ +import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget + plugins { alias(libs.plugins.kotlin.multiplatform) alias(libs.plugins.kotlinx.serialization) @@ -50,8 +52,7 @@ kotlin { } } - linuxX64() - macosX64() + mingwX64() sourceSets { val commonMain by getting { @@ -96,14 +97,33 @@ kotlin { } } - val nativeTest by creating { - dependsOn(commonTest) - } + val nativeTest by creating { dependsOn(commonTest) } - val linuxX64Main by getting { dependsOn(nativeMain) } - val linuxX64Test by getting { dependsOn(nativeTest) } - val macosX64Main by getting { dependsOn(nativeMain) } - val macosX64Test by getting { dependsOn(nativeTest) } + val mingwX64Main by getting { dependsOn(nativeMain) } + val mingwX64Test by getting { dependsOn(nativeTest) } + } + + targets.withType { + val interopDir = layout.projectDirectory.dir("../interop") + compilations["main"].cinterops { + val libhttp by creating { + defFile("src/nativeInterop/cinterop/http_native.def") + packageName("me.devnatan.dockerkt.interop") + includeDirs.allHeaders("src/nativeInterop/cinterop") + + val platform = this@withType.name + when (platform) { + "mingwX64", "mingwX64Main" -> { + extraOpts( + "-libraryPath", "$interopDir/target/x86_64-pc-windows-gnu/debug", + ) + } + else -> extraOpts( + "-libraryPath", "$interopDir/target/debug" + ) + } + } + } } } diff --git a/gradle.properties b/lib/gradle.properties similarity index 95% rename from gradle.properties rename to lib/gradle.properties index 5af7d002..45a0d28e 100644 --- a/gradle.properties +++ b/lib/gradle.properties @@ -5,6 +5,7 @@ org.gradle.caching=true org.gradle.parallel=true org.gradle.unsafe.configuration-cache=true kotlin.mpp.applyDefaultHierarchyTemplate=false +kotlin.mpp.enableCInteropCommonization=true POM_NAME=docker-kotlin POM_DESCRIPTION=Docker Engine Remote API client diff --git a/gradle/libs.versions.toml b/lib/gradle/libs.versions.toml similarity index 100% rename from gradle/libs.versions.toml rename to lib/gradle/libs.versions.toml diff --git a/gradle/wrapper/gradle-wrapper.jar b/lib/gradle/wrapper/gradle-wrapper.jar similarity index 100% rename from gradle/wrapper/gradle-wrapper.jar rename to lib/gradle/wrapper/gradle-wrapper.jar diff --git a/gradle/wrapper/gradle-wrapper.properties b/lib/gradle/wrapper/gradle-wrapper.properties similarity index 100% rename from gradle/wrapper/gradle-wrapper.properties rename to lib/gradle/wrapper/gradle-wrapper.properties diff --git a/gradlew b/lib/gradlew old mode 100755 new mode 100644 similarity index 100% rename from gradlew rename to lib/gradlew diff --git a/gradlew.bat b/lib/gradlew.bat similarity index 100% rename from gradlew.bat rename to lib/gradlew.bat diff --git a/settings.gradle.kts b/lib/settings.gradle.kts similarity index 100% rename from settings.gradle.kts rename to lib/settings.gradle.kts diff --git a/src/commonMain/kotlin/me/devnatan/dockerkt/DockerClient.kt b/lib/src/commonMain/kotlin/me/devnatan/dockerkt/DockerClient.kt similarity index 100% rename from src/commonMain/kotlin/me/devnatan/dockerkt/DockerClient.kt rename to lib/src/commonMain/kotlin/me/devnatan/dockerkt/DockerClient.kt diff --git a/src/commonMain/kotlin/me/devnatan/dockerkt/DockerClientConfig.kt b/lib/src/commonMain/kotlin/me/devnatan/dockerkt/DockerClientConfig.kt similarity index 100% rename from src/commonMain/kotlin/me/devnatan/dockerkt/DockerClientConfig.kt rename to lib/src/commonMain/kotlin/me/devnatan/dockerkt/DockerClientConfig.kt diff --git a/src/commonMain/kotlin/me/devnatan/dockerkt/DockerClientFactory.kt b/lib/src/commonMain/kotlin/me/devnatan/dockerkt/DockerClientFactory.kt similarity index 100% rename from src/commonMain/kotlin/me/devnatan/dockerkt/DockerClientFactory.kt rename to lib/src/commonMain/kotlin/me/devnatan/dockerkt/DockerClientFactory.kt diff --git a/src/commonMain/kotlin/me/devnatan/dockerkt/Exception.kt b/lib/src/commonMain/kotlin/me/devnatan/dockerkt/Exception.kt similarity index 100% rename from src/commonMain/kotlin/me/devnatan/dockerkt/Exception.kt rename to lib/src/commonMain/kotlin/me/devnatan/dockerkt/Exception.kt diff --git a/src/commonMain/kotlin/me/devnatan/dockerkt/Platform.kt b/lib/src/commonMain/kotlin/me/devnatan/dockerkt/Platform.kt similarity index 100% rename from src/commonMain/kotlin/me/devnatan/dockerkt/Platform.kt rename to lib/src/commonMain/kotlin/me/devnatan/dockerkt/Platform.kt diff --git a/src/commonMain/kotlin/me/devnatan/dockerkt/io/Http.kt b/lib/src/commonMain/kotlin/me/devnatan/dockerkt/io/Http.kt similarity index 100% rename from src/commonMain/kotlin/me/devnatan/dockerkt/io/Http.kt rename to lib/src/commonMain/kotlin/me/devnatan/dockerkt/io/Http.kt diff --git a/src/commonMain/kotlin/me/devnatan/dockerkt/io/Sockets.kt b/lib/src/commonMain/kotlin/me/devnatan/dockerkt/io/Sockets.kt similarity index 100% rename from src/commonMain/kotlin/me/devnatan/dockerkt/io/Sockets.kt rename to lib/src/commonMain/kotlin/me/devnatan/dockerkt/io/Sockets.kt diff --git a/src/commonMain/kotlin/me/devnatan/dockerkt/io/TarFile.kt b/lib/src/commonMain/kotlin/me/devnatan/dockerkt/io/TarFile.kt similarity index 100% rename from src/commonMain/kotlin/me/devnatan/dockerkt/io/TarFile.kt rename to lib/src/commonMain/kotlin/me/devnatan/dockerkt/io/TarFile.kt diff --git a/src/commonMain/kotlin/me/devnatan/dockerkt/models/BlkioWeightDevice.kt b/lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/BlkioWeightDevice.kt similarity index 100% rename from src/commonMain/kotlin/me/devnatan/dockerkt/models/BlkioWeightDevice.kt rename to lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/BlkioWeightDevice.kt diff --git a/src/commonMain/kotlin/me/devnatan/dockerkt/models/DeviceMapping.kt b/lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/DeviceMapping.kt similarity index 100% rename from src/commonMain/kotlin/me/devnatan/dockerkt/models/DeviceMapping.kt rename to lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/DeviceMapping.kt diff --git a/src/commonMain/kotlin/me/devnatan/dockerkt/models/DeviceRequest.kt b/lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/DeviceRequest.kt similarity index 100% rename from src/commonMain/kotlin/me/devnatan/dockerkt/models/DeviceRequest.kt rename to lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/DeviceRequest.kt diff --git a/src/commonMain/kotlin/me/devnatan/dockerkt/models/ExposedPort.kt b/lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/ExposedPort.kt similarity index 100% rename from src/commonMain/kotlin/me/devnatan/dockerkt/models/ExposedPort.kt rename to lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/ExposedPort.kt diff --git a/src/commonMain/kotlin/me/devnatan/dockerkt/models/GraphDriverData.kt b/lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/GraphDriverData.kt similarity index 100% rename from src/commonMain/kotlin/me/devnatan/dockerkt/models/GraphDriverData.kt rename to lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/GraphDriverData.kt diff --git a/src/commonMain/kotlin/me/devnatan/dockerkt/models/HealthConfig.kt b/lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/HealthConfig.kt similarity index 100% rename from src/commonMain/kotlin/me/devnatan/dockerkt/models/HealthConfig.kt rename to lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/HealthConfig.kt diff --git a/src/commonMain/kotlin/me/devnatan/dockerkt/models/Healthcheck.kt b/lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/Healthcheck.kt similarity index 100% rename from src/commonMain/kotlin/me/devnatan/dockerkt/models/Healthcheck.kt rename to lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/Healthcheck.kt diff --git a/src/commonMain/kotlin/me/devnatan/dockerkt/models/HostConfig.kt b/lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/HostConfig.kt similarity index 100% rename from src/commonMain/kotlin/me/devnatan/dockerkt/models/HostConfig.kt rename to lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/HostConfig.kt diff --git a/src/commonMain/kotlin/me/devnatan/dockerkt/models/IdOnlyResponse.kt b/lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/IdOnlyResponse.kt similarity index 100% rename from src/commonMain/kotlin/me/devnatan/dockerkt/models/IdOnlyResponse.kt rename to lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/IdOnlyResponse.kt diff --git a/src/commonMain/kotlin/me/devnatan/dockerkt/models/LogConfig.kt b/lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/LogConfig.kt similarity index 100% rename from src/commonMain/kotlin/me/devnatan/dockerkt/models/LogConfig.kt rename to lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/LogConfig.kt diff --git a/src/commonMain/kotlin/me/devnatan/dockerkt/models/Mount.kt b/lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/Mount.kt similarity index 100% rename from src/commonMain/kotlin/me/devnatan/dockerkt/models/Mount.kt rename to lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/Mount.kt diff --git a/src/commonMain/kotlin/me/devnatan/dockerkt/models/PortBinding.kt b/lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/PortBinding.kt similarity index 100% rename from src/commonMain/kotlin/me/devnatan/dockerkt/models/PortBinding.kt rename to lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/PortBinding.kt diff --git a/src/commonMain/kotlin/me/devnatan/dockerkt/models/ProcessConfig.kt b/lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/ProcessConfig.kt similarity index 100% rename from src/commonMain/kotlin/me/devnatan/dockerkt/models/ProcessConfig.kt rename to lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/ProcessConfig.kt diff --git a/src/commonMain/kotlin/me/devnatan/dockerkt/models/RegistryConfig.kt b/lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/RegistryConfig.kt similarity index 100% rename from src/commonMain/kotlin/me/devnatan/dockerkt/models/RegistryConfig.kt rename to lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/RegistryConfig.kt diff --git a/src/commonMain/kotlin/me/devnatan/dockerkt/models/ResizeTTYOptions.kt b/lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/ResizeTTYOptions.kt similarity index 100% rename from src/commonMain/kotlin/me/devnatan/dockerkt/models/ResizeTTYOptions.kt rename to lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/ResizeTTYOptions.kt diff --git a/src/commonMain/kotlin/me/devnatan/dockerkt/models/Resource.kt b/lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/Resource.kt similarity index 100% rename from src/commonMain/kotlin/me/devnatan/dockerkt/models/Resource.kt rename to lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/Resource.kt diff --git a/src/commonMain/kotlin/me/devnatan/dockerkt/models/ResourceLimit.kt b/lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/ResourceLimit.kt similarity index 100% rename from src/commonMain/kotlin/me/devnatan/dockerkt/models/ResourceLimit.kt rename to lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/ResourceLimit.kt diff --git a/src/commonMain/kotlin/me/devnatan/dockerkt/models/RestartPolicy.kt b/lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/RestartPolicy.kt similarity index 100% rename from src/commonMain/kotlin/me/devnatan/dockerkt/models/RestartPolicy.kt rename to lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/RestartPolicy.kt diff --git a/src/commonMain/kotlin/me/devnatan/dockerkt/models/Streaming.kt b/lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/Streaming.kt similarity index 100% rename from src/commonMain/kotlin/me/devnatan/dockerkt/models/Streaming.kt rename to lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/Streaming.kt diff --git a/src/commonMain/kotlin/me/devnatan/dockerkt/models/ThrottleDevice.kt b/lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/ThrottleDevice.kt similarity index 100% rename from src/commonMain/kotlin/me/devnatan/dockerkt/models/ThrottleDevice.kt rename to lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/ThrottleDevice.kt diff --git a/src/commonMain/kotlin/me/devnatan/dockerkt/models/container/Container.kt b/lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/container/Container.kt similarity index 100% rename from src/commonMain/kotlin/me/devnatan/dockerkt/models/container/Container.kt rename to lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/container/Container.kt diff --git a/src/commonMain/kotlin/me/devnatan/dockerkt/models/container/ContainerArchiveInfo.kt b/lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/container/ContainerArchiveInfo.kt similarity index 100% rename from src/commonMain/kotlin/me/devnatan/dockerkt/models/container/ContainerArchiveInfo.kt rename to lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/container/ContainerArchiveInfo.kt diff --git a/src/commonMain/kotlin/me/devnatan/dockerkt/models/container/ContainerConfig.kt b/lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/container/ContainerConfig.kt similarity index 100% rename from src/commonMain/kotlin/me/devnatan/dockerkt/models/container/ContainerConfig.kt rename to lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/container/ContainerConfig.kt diff --git a/src/commonMain/kotlin/me/devnatan/dockerkt/models/container/ContainerCreateOptions.kt b/lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/container/ContainerCreateOptions.kt similarity index 100% rename from src/commonMain/kotlin/me/devnatan/dockerkt/models/container/ContainerCreateOptions.kt rename to lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/container/ContainerCreateOptions.kt diff --git a/src/commonMain/kotlin/me/devnatan/dockerkt/models/container/ContainerCreateResult.kt b/lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/container/ContainerCreateResult.kt similarity index 100% rename from src/commonMain/kotlin/me/devnatan/dockerkt/models/container/ContainerCreateResult.kt rename to lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/container/ContainerCreateResult.kt diff --git a/src/commonMain/kotlin/me/devnatan/dockerkt/models/container/ContainerListOptions.kt b/lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/container/ContainerListOptions.kt similarity index 100% rename from src/commonMain/kotlin/me/devnatan/dockerkt/models/container/ContainerListOptions.kt rename to lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/container/ContainerListOptions.kt diff --git a/src/commonMain/kotlin/me/devnatan/dockerkt/models/container/ContainerLogsOptions.kt b/lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/container/ContainerLogsOptions.kt similarity index 100% rename from src/commonMain/kotlin/me/devnatan/dockerkt/models/container/ContainerLogsOptions.kt rename to lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/container/ContainerLogsOptions.kt diff --git a/src/commonMain/kotlin/me/devnatan/dockerkt/models/container/ContainerPrune.kt b/lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/container/ContainerPrune.kt similarity index 100% rename from src/commonMain/kotlin/me/devnatan/dockerkt/models/container/ContainerPrune.kt rename to lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/container/ContainerPrune.kt diff --git a/src/commonMain/kotlin/me/devnatan/dockerkt/models/container/ContainerRemoveOptions.kt b/lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/container/ContainerRemoveOptions.kt similarity index 100% rename from src/commonMain/kotlin/me/devnatan/dockerkt/models/container/ContainerRemoveOptions.kt rename to lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/container/ContainerRemoveOptions.kt diff --git a/src/commonMain/kotlin/me/devnatan/dockerkt/models/container/ContainerState.kt b/lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/container/ContainerState.kt similarity index 100% rename from src/commonMain/kotlin/me/devnatan/dockerkt/models/container/ContainerState.kt rename to lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/container/ContainerState.kt diff --git a/src/commonMain/kotlin/me/devnatan/dockerkt/models/container/ContainerSummary.kt b/lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/container/ContainerSummary.kt similarity index 100% rename from src/commonMain/kotlin/me/devnatan/dockerkt/models/container/ContainerSummary.kt rename to lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/container/ContainerSummary.kt diff --git a/src/commonMain/kotlin/me/devnatan/dockerkt/models/container/ContainerWaitResult.kt b/lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/container/ContainerWaitResult.kt similarity index 100% rename from src/commonMain/kotlin/me/devnatan/dockerkt/models/container/ContainerWaitResult.kt rename to lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/container/ContainerWaitResult.kt diff --git a/src/commonMain/kotlin/me/devnatan/dockerkt/models/exec/ExecCreateOptions.kt b/lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/exec/ExecCreateOptions.kt similarity index 100% rename from src/commonMain/kotlin/me/devnatan/dockerkt/models/exec/ExecCreateOptions.kt rename to lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/exec/ExecCreateOptions.kt diff --git a/src/commonMain/kotlin/me/devnatan/dockerkt/models/exec/ExecInspectResponse.kt b/lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/exec/ExecInspectResponse.kt similarity index 100% rename from src/commonMain/kotlin/me/devnatan/dockerkt/models/exec/ExecInspectResponse.kt rename to lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/exec/ExecInspectResponse.kt diff --git a/src/commonMain/kotlin/me/devnatan/dockerkt/models/exec/ExecStartOptions.kt b/lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/exec/ExecStartOptions.kt similarity index 100% rename from src/commonMain/kotlin/me/devnatan/dockerkt/models/exec/ExecStartOptions.kt rename to lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/exec/ExecStartOptions.kt diff --git a/src/commonMain/kotlin/me/devnatan/dockerkt/models/image/Image.kt b/lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/image/Image.kt similarity index 100% rename from src/commonMain/kotlin/me/devnatan/dockerkt/models/image/Image.kt rename to lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/image/Image.kt diff --git a/src/commonMain/kotlin/me/devnatan/dockerkt/models/image/ImageBuildOptions.kt b/lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/image/ImageBuildOptions.kt similarity index 100% rename from src/commonMain/kotlin/me/devnatan/dockerkt/models/image/ImageBuildOptions.kt rename to lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/image/ImageBuildOptions.kt diff --git a/src/commonMain/kotlin/me/devnatan/dockerkt/models/image/ImagePull.kt b/lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/image/ImagePull.kt similarity index 100% rename from src/commonMain/kotlin/me/devnatan/dockerkt/models/image/ImagePull.kt rename to lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/image/ImagePull.kt diff --git a/src/commonMain/kotlin/me/devnatan/dockerkt/models/image/ImageRootFs.kt b/lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/image/ImageRootFs.kt similarity index 100% rename from src/commonMain/kotlin/me/devnatan/dockerkt/models/image/ImageRootFs.kt rename to lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/image/ImageRootFs.kt diff --git a/src/commonMain/kotlin/me/devnatan/dockerkt/models/image/ImageSummary.kt b/lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/image/ImageSummary.kt similarity index 100% rename from src/commonMain/kotlin/me/devnatan/dockerkt/models/image/ImageSummary.kt rename to lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/image/ImageSummary.kt diff --git a/src/commonMain/kotlin/me/devnatan/dockerkt/models/network/EndpointSettings.kt b/lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/network/EndpointSettings.kt similarity index 100% rename from src/commonMain/kotlin/me/devnatan/dockerkt/models/network/EndpointSettings.kt rename to lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/network/EndpointSettings.kt diff --git a/src/commonMain/kotlin/me/devnatan/dockerkt/models/network/IPAM.kt b/lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/network/IPAM.kt similarity index 100% rename from src/commonMain/kotlin/me/devnatan/dockerkt/models/network/IPAM.kt rename to lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/network/IPAM.kt diff --git a/src/commonMain/kotlin/me/devnatan/dockerkt/models/network/Network.kt b/lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/network/Network.kt similarity index 100% rename from src/commonMain/kotlin/me/devnatan/dockerkt/models/network/Network.kt rename to lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/network/Network.kt diff --git a/src/commonMain/kotlin/me/devnatan/dockerkt/models/network/NetworkContainer.kt b/lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/network/NetworkContainer.kt similarity index 100% rename from src/commonMain/kotlin/me/devnatan/dockerkt/models/network/NetworkContainer.kt rename to lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/network/NetworkContainer.kt diff --git a/src/commonMain/kotlin/me/devnatan/dockerkt/models/network/NetworkCreateOptions.kt b/lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/network/NetworkCreateOptions.kt similarity index 100% rename from src/commonMain/kotlin/me/devnatan/dockerkt/models/network/NetworkCreateOptions.kt rename to lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/network/NetworkCreateOptions.kt diff --git a/src/commonMain/kotlin/me/devnatan/dockerkt/models/network/NetworkInspectOptions.kt b/lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/network/NetworkInspectOptions.kt similarity index 100% rename from src/commonMain/kotlin/me/devnatan/dockerkt/models/network/NetworkInspectOptions.kt rename to lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/network/NetworkInspectOptions.kt diff --git a/src/commonMain/kotlin/me/devnatan/dockerkt/models/network/NetworkListFilters.kt b/lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/network/NetworkListFilters.kt similarity index 100% rename from src/commonMain/kotlin/me/devnatan/dockerkt/models/network/NetworkListFilters.kt rename to lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/network/NetworkListFilters.kt diff --git a/src/commonMain/kotlin/me/devnatan/dockerkt/models/network/NetworkPruneOptions.kt b/lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/network/NetworkPruneOptions.kt similarity index 100% rename from src/commonMain/kotlin/me/devnatan/dockerkt/models/network/NetworkPruneOptions.kt rename to lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/network/NetworkPruneOptions.kt diff --git a/src/commonMain/kotlin/me/devnatan/dockerkt/models/network/NetworkingConfig.kt b/lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/network/NetworkingConfig.kt similarity index 100% rename from src/commonMain/kotlin/me/devnatan/dockerkt/models/network/NetworkingConfig.kt rename to lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/network/NetworkingConfig.kt diff --git a/src/commonMain/kotlin/me/devnatan/dockerkt/models/secret/Secret.kt b/lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/secret/Secret.kt similarity index 100% rename from src/commonMain/kotlin/me/devnatan/dockerkt/models/secret/Secret.kt rename to lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/secret/Secret.kt diff --git a/src/commonMain/kotlin/me/devnatan/dockerkt/models/secret/SecretListFilters.kt b/lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/secret/SecretListFilters.kt similarity index 100% rename from src/commonMain/kotlin/me/devnatan/dockerkt/models/secret/SecretListFilters.kt rename to lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/secret/SecretListFilters.kt diff --git a/src/commonMain/kotlin/me/devnatan/dockerkt/models/secret/SecretSpec.kt b/lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/secret/SecretSpec.kt similarity index 100% rename from src/commonMain/kotlin/me/devnatan/dockerkt/models/secret/SecretSpec.kt rename to lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/secret/SecretSpec.kt diff --git a/src/commonMain/kotlin/me/devnatan/dockerkt/models/system/Event.kt b/lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/system/Event.kt similarity index 100% rename from src/commonMain/kotlin/me/devnatan/dockerkt/models/system/Event.kt rename to lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/system/Event.kt diff --git a/src/commonMain/kotlin/me/devnatan/dockerkt/models/system/MonitorEventsOptions.kt b/lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/system/MonitorEventsOptions.kt similarity index 100% rename from src/commonMain/kotlin/me/devnatan/dockerkt/models/system/MonitorEventsOptions.kt rename to lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/system/MonitorEventsOptions.kt diff --git a/src/commonMain/kotlin/me/devnatan/dockerkt/models/system/SystemPingData.kt b/lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/system/SystemPingData.kt similarity index 100% rename from src/commonMain/kotlin/me/devnatan/dockerkt/models/system/SystemPingData.kt rename to lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/system/SystemPingData.kt diff --git a/src/commonMain/kotlin/me/devnatan/dockerkt/models/system/SystemVersion.kt b/lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/system/SystemVersion.kt similarity index 100% rename from src/commonMain/kotlin/me/devnatan/dockerkt/models/system/SystemVersion.kt rename to lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/system/SystemVersion.kt diff --git a/src/commonMain/kotlin/me/devnatan/dockerkt/models/volume/Volume.kt b/lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/volume/Volume.kt similarity index 100% rename from src/commonMain/kotlin/me/devnatan/dockerkt/models/volume/Volume.kt rename to lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/volume/Volume.kt diff --git a/src/commonMain/kotlin/me/devnatan/dockerkt/models/volume/VolumeCreateOptions.kt b/lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/volume/VolumeCreateOptions.kt similarity index 100% rename from src/commonMain/kotlin/me/devnatan/dockerkt/models/volume/VolumeCreateOptions.kt rename to lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/volume/VolumeCreateOptions.kt diff --git a/src/commonMain/kotlin/me/devnatan/dockerkt/models/volume/VolumeListOptions.kt b/lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/volume/VolumeListOptions.kt similarity index 100% rename from src/commonMain/kotlin/me/devnatan/dockerkt/models/volume/VolumeListOptions.kt rename to lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/volume/VolumeListOptions.kt diff --git a/src/commonMain/kotlin/me/devnatan/dockerkt/models/volume/VolumeListResponse.kt b/lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/volume/VolumeListResponse.kt similarity index 100% rename from src/commonMain/kotlin/me/devnatan/dockerkt/models/volume/VolumeListResponse.kt rename to lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/volume/VolumeListResponse.kt diff --git a/src/commonMain/kotlin/me/devnatan/dockerkt/models/volume/VolumePruneOptions.kt b/lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/volume/VolumePruneOptions.kt similarity index 100% rename from src/commonMain/kotlin/me/devnatan/dockerkt/models/volume/VolumePruneOptions.kt rename to lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/volume/VolumePruneOptions.kt diff --git a/src/commonMain/kotlin/me/devnatan/dockerkt/models/volume/VolumePruneResponse.kt b/lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/volume/VolumePruneResponse.kt similarity index 100% rename from src/commonMain/kotlin/me/devnatan/dockerkt/models/volume/VolumePruneResponse.kt rename to lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/volume/VolumePruneResponse.kt diff --git a/src/commonMain/kotlin/me/devnatan/dockerkt/models/volume/VolumeRemoveOptions.kt b/lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/volume/VolumeRemoveOptions.kt similarity index 100% rename from src/commonMain/kotlin/me/devnatan/dockerkt/models/volume/VolumeRemoveOptions.kt rename to lib/src/commonMain/kotlin/me/devnatan/dockerkt/models/volume/VolumeRemoveOptions.kt diff --git a/lib/src/commonMain/kotlin/me/devnatan/dockerkt/native/CustomDnsResolver.kt b/lib/src/commonMain/kotlin/me/devnatan/dockerkt/native/CustomDnsResolver.kt new file mode 100644 index 00000000..09d188aa --- /dev/null +++ b/lib/src/commonMain/kotlin/me/devnatan/dockerkt/native/CustomDnsResolver.kt @@ -0,0 +1,6 @@ +package me.devnatan.dockerkt.native + +public expect class CustomDnsResolver { + + public suspend fun resolve(hostname: String, dnsServers: List = emptyList()): Result> +} \ No newline at end of file diff --git a/lib/src/commonMain/kotlin/me/devnatan/dockerkt/native/NativeHttpClient.kt b/lib/src/commonMain/kotlin/me/devnatan/dockerkt/native/NativeHttpClient.kt new file mode 100644 index 00000000..afe89743 --- /dev/null +++ b/lib/src/commonMain/kotlin/me/devnatan/dockerkt/native/NativeHttpClient.kt @@ -0,0 +1,28 @@ +package me.devnatan.dockerkt.native + +import io.ktor.client.engine.* +import io.ktor.client.request.HttpRequestData +import io.ktor.client.request.HttpResponseData +import io.ktor.utils.io.InternalAPI +import kotlinx.coroutines.CoroutineDispatcher +import kotlin.coroutines.CoroutineContext +import kotlin.time.Duration +import kotlin.time.Duration.Companion.seconds + +public class NativeHttpEngineConfig : HttpClientEngineConfig() { + public var customDnsServers: List = emptyList() + public var unixSocketPath: String? = null + public var requestTimeout: Duration = 5.seconds +} + +public expect class NativeHttpEngine(config: NativeHttpEngineConfig) : HttpClientEngine { + override val dispatcher: CoroutineDispatcher + override val config: HttpClientEngineConfig + + @InternalAPI + override suspend fun execute(data: HttpRequestData): HttpResponseData + override val coroutineContext: CoroutineContext + override fun close() +} + +public expect val NativeHttpEngineFactory: HttpClientEngineFactory \ No newline at end of file diff --git a/src/commonMain/kotlin/me/devnatan/dockerkt/resource/ResourcePaths.kt b/lib/src/commonMain/kotlin/me/devnatan/dockerkt/resource/ResourcePaths.kt similarity index 100% rename from src/commonMain/kotlin/me/devnatan/dockerkt/resource/ResourcePaths.kt rename to lib/src/commonMain/kotlin/me/devnatan/dockerkt/resource/ResourcePaths.kt diff --git a/src/commonMain/kotlin/me/devnatan/dockerkt/resource/container/ContainerException.kt b/lib/src/commonMain/kotlin/me/devnatan/dockerkt/resource/container/ContainerException.kt similarity index 100% rename from src/commonMain/kotlin/me/devnatan/dockerkt/resource/container/ContainerException.kt rename to lib/src/commonMain/kotlin/me/devnatan/dockerkt/resource/container/ContainerException.kt diff --git a/src/commonMain/kotlin/me/devnatan/dockerkt/resource/container/ContainerResource.kt b/lib/src/commonMain/kotlin/me/devnatan/dockerkt/resource/container/ContainerResource.kt similarity index 100% rename from src/commonMain/kotlin/me/devnatan/dockerkt/resource/container/ContainerResource.kt rename to lib/src/commonMain/kotlin/me/devnatan/dockerkt/resource/container/ContainerResource.kt diff --git a/src/commonMain/kotlin/me/devnatan/dockerkt/resource/container/ContainerResourceExt.kt b/lib/src/commonMain/kotlin/me/devnatan/dockerkt/resource/container/ContainerResourceExt.kt similarity index 100% rename from src/commonMain/kotlin/me/devnatan/dockerkt/resource/container/ContainerResourceExt.kt rename to lib/src/commonMain/kotlin/me/devnatan/dockerkt/resource/container/ContainerResourceExt.kt diff --git a/src/commonMain/kotlin/me/devnatan/dockerkt/resource/exec/ExecException.kt b/lib/src/commonMain/kotlin/me/devnatan/dockerkt/resource/exec/ExecException.kt similarity index 100% rename from src/commonMain/kotlin/me/devnatan/dockerkt/resource/exec/ExecException.kt rename to lib/src/commonMain/kotlin/me/devnatan/dockerkt/resource/exec/ExecException.kt diff --git a/src/commonMain/kotlin/me/devnatan/dockerkt/resource/exec/ExecResource.kt b/lib/src/commonMain/kotlin/me/devnatan/dockerkt/resource/exec/ExecResource.kt similarity index 100% rename from src/commonMain/kotlin/me/devnatan/dockerkt/resource/exec/ExecResource.kt rename to lib/src/commonMain/kotlin/me/devnatan/dockerkt/resource/exec/ExecResource.kt diff --git a/src/commonMain/kotlin/me/devnatan/dockerkt/resource/exec/ExecResourceExt.kt b/lib/src/commonMain/kotlin/me/devnatan/dockerkt/resource/exec/ExecResourceExt.kt similarity index 100% rename from src/commonMain/kotlin/me/devnatan/dockerkt/resource/exec/ExecResourceExt.kt rename to lib/src/commonMain/kotlin/me/devnatan/dockerkt/resource/exec/ExecResourceExt.kt diff --git a/src/commonMain/kotlin/me/devnatan/dockerkt/resource/image/ImageException.kt b/lib/src/commonMain/kotlin/me/devnatan/dockerkt/resource/image/ImageException.kt similarity index 100% rename from src/commonMain/kotlin/me/devnatan/dockerkt/resource/image/ImageException.kt rename to lib/src/commonMain/kotlin/me/devnatan/dockerkt/resource/image/ImageException.kt diff --git a/src/commonMain/kotlin/me/devnatan/dockerkt/resource/image/ImageResource.kt b/lib/src/commonMain/kotlin/me/devnatan/dockerkt/resource/image/ImageResource.kt similarity index 100% rename from src/commonMain/kotlin/me/devnatan/dockerkt/resource/image/ImageResource.kt rename to lib/src/commonMain/kotlin/me/devnatan/dockerkt/resource/image/ImageResource.kt diff --git a/src/commonMain/kotlin/me/devnatan/dockerkt/resource/network/NetworkException.kt b/lib/src/commonMain/kotlin/me/devnatan/dockerkt/resource/network/NetworkException.kt similarity index 100% rename from src/commonMain/kotlin/me/devnatan/dockerkt/resource/network/NetworkException.kt rename to lib/src/commonMain/kotlin/me/devnatan/dockerkt/resource/network/NetworkException.kt diff --git a/src/commonMain/kotlin/me/devnatan/dockerkt/resource/network/NetworkResource.kt b/lib/src/commonMain/kotlin/me/devnatan/dockerkt/resource/network/NetworkResource.kt similarity index 100% rename from src/commonMain/kotlin/me/devnatan/dockerkt/resource/network/NetworkResource.kt rename to lib/src/commonMain/kotlin/me/devnatan/dockerkt/resource/network/NetworkResource.kt diff --git a/src/commonMain/kotlin/me/devnatan/dockerkt/resource/secret/SecretException.kt b/lib/src/commonMain/kotlin/me/devnatan/dockerkt/resource/secret/SecretException.kt similarity index 100% rename from src/commonMain/kotlin/me/devnatan/dockerkt/resource/secret/SecretException.kt rename to lib/src/commonMain/kotlin/me/devnatan/dockerkt/resource/secret/SecretException.kt diff --git a/src/commonMain/kotlin/me/devnatan/dockerkt/resource/secret/SecretResource.kt b/lib/src/commonMain/kotlin/me/devnatan/dockerkt/resource/secret/SecretResource.kt similarity index 100% rename from src/commonMain/kotlin/me/devnatan/dockerkt/resource/secret/SecretResource.kt rename to lib/src/commonMain/kotlin/me/devnatan/dockerkt/resource/secret/SecretResource.kt diff --git a/src/commonMain/kotlin/me/devnatan/dockerkt/resource/swarm/SwarmException.kt b/lib/src/commonMain/kotlin/me/devnatan/dockerkt/resource/swarm/SwarmException.kt similarity index 100% rename from src/commonMain/kotlin/me/devnatan/dockerkt/resource/swarm/SwarmException.kt rename to lib/src/commonMain/kotlin/me/devnatan/dockerkt/resource/swarm/SwarmException.kt diff --git a/src/commonMain/kotlin/me/devnatan/dockerkt/resource/system/SystemResource.kt b/lib/src/commonMain/kotlin/me/devnatan/dockerkt/resource/system/SystemResource.kt similarity index 100% rename from src/commonMain/kotlin/me/devnatan/dockerkt/resource/system/SystemResource.kt rename to lib/src/commonMain/kotlin/me/devnatan/dockerkt/resource/system/SystemResource.kt diff --git a/src/commonMain/kotlin/me/devnatan/dockerkt/resource/volume/VolumeResource.kt b/lib/src/commonMain/kotlin/me/devnatan/dockerkt/resource/volume/VolumeResource.kt similarity index 100% rename from src/commonMain/kotlin/me/devnatan/dockerkt/resource/volume/VolumeResource.kt rename to lib/src/commonMain/kotlin/me/devnatan/dockerkt/resource/volume/VolumeResource.kt diff --git a/src/commonMain/kotlin/me/devnatan/dockerkt/util/Json.kt b/lib/src/commonMain/kotlin/me/devnatan/dockerkt/util/Json.kt similarity index 100% rename from src/commonMain/kotlin/me/devnatan/dockerkt/util/Json.kt rename to lib/src/commonMain/kotlin/me/devnatan/dockerkt/util/Json.kt diff --git a/src/commonMain/kotlin/me/devnatan/dockerkt/util/ListAsMapToEmptyObjectsSerializer.kt b/lib/src/commonMain/kotlin/me/devnatan/dockerkt/util/ListAsMapToEmptyObjectsSerializer.kt similarity index 100% rename from src/commonMain/kotlin/me/devnatan/dockerkt/util/ListAsMapToEmptyObjectsSerializer.kt rename to lib/src/commonMain/kotlin/me/devnatan/dockerkt/util/ListAsMapToEmptyObjectsSerializer.kt diff --git a/src/commonTest/kotlin/me/devnatan/dockerkt/Client.kt b/lib/src/commonTest/kotlin/me/devnatan/dockerkt/Client.kt similarity index 100% rename from src/commonTest/kotlin/me/devnatan/dockerkt/Client.kt rename to lib/src/commonTest/kotlin/me/devnatan/dockerkt/Client.kt diff --git a/src/commonTest/kotlin/me/devnatan/dockerkt/TestUtils.kt b/lib/src/commonTest/kotlin/me/devnatan/dockerkt/TestUtils.kt similarity index 100% rename from src/commonTest/kotlin/me/devnatan/dockerkt/TestUtils.kt rename to lib/src/commonTest/kotlin/me/devnatan/dockerkt/TestUtils.kt diff --git a/src/commonTest/kotlin/me/devnatan/dockerkt/resource/ResourceIT.kt b/lib/src/commonTest/kotlin/me/devnatan/dockerkt/resource/ResourceIT.kt similarity index 100% rename from src/commonTest/kotlin/me/devnatan/dockerkt/resource/ResourceIT.kt rename to lib/src/commonTest/kotlin/me/devnatan/dockerkt/resource/ResourceIT.kt diff --git a/src/commonTest/kotlin/me/devnatan/dockerkt/resource/container/InspectContainerIT.kt b/lib/src/commonTest/kotlin/me/devnatan/dockerkt/resource/container/InspectContainerIT.kt similarity index 100% rename from src/commonTest/kotlin/me/devnatan/dockerkt/resource/container/InspectContainerIT.kt rename to lib/src/commonTest/kotlin/me/devnatan/dockerkt/resource/container/InspectContainerIT.kt diff --git a/src/commonTest/kotlin/me/devnatan/dockerkt/resource/container/LogContainerIT.kt b/lib/src/commonTest/kotlin/me/devnatan/dockerkt/resource/container/LogContainerIT.kt similarity index 100% rename from src/commonTest/kotlin/me/devnatan/dockerkt/resource/container/LogContainerIT.kt rename to lib/src/commonTest/kotlin/me/devnatan/dockerkt/resource/container/LogContainerIT.kt diff --git a/src/commonTest/kotlin/me/devnatan/dockerkt/resource/container/RemoveContainerIT.kt b/lib/src/commonTest/kotlin/me/devnatan/dockerkt/resource/container/RemoveContainerIT.kt similarity index 100% rename from src/commonTest/kotlin/me/devnatan/dockerkt/resource/container/RemoveContainerIT.kt rename to lib/src/commonTest/kotlin/me/devnatan/dockerkt/resource/container/RemoveContainerIT.kt diff --git a/src/commonTest/kotlin/me/devnatan/dockerkt/resource/container/StartContainerIT.kt b/lib/src/commonTest/kotlin/me/devnatan/dockerkt/resource/container/StartContainerIT.kt similarity index 100% rename from src/commonTest/kotlin/me/devnatan/dockerkt/resource/container/StartContainerIT.kt rename to lib/src/commonTest/kotlin/me/devnatan/dockerkt/resource/container/StartContainerIT.kt diff --git a/src/commonTest/kotlin/me/devnatan/dockerkt/resource/exec/ExecContainerIT.kt b/lib/src/commonTest/kotlin/me/devnatan/dockerkt/resource/exec/ExecContainerIT.kt similarity index 100% rename from src/commonTest/kotlin/me/devnatan/dockerkt/resource/exec/ExecContainerIT.kt rename to lib/src/commonTest/kotlin/me/devnatan/dockerkt/resource/exec/ExecContainerIT.kt diff --git a/src/commonTest/kotlin/me/devnatan/dockerkt/resource/image/ImageIT.kt b/lib/src/commonTest/kotlin/me/devnatan/dockerkt/resource/image/ImageIT.kt similarity index 100% rename from src/commonTest/kotlin/me/devnatan/dockerkt/resource/image/ImageIT.kt rename to lib/src/commonTest/kotlin/me/devnatan/dockerkt/resource/image/ImageIT.kt diff --git a/src/commonTest/kotlin/me/devnatan/dockerkt/resource/network/NetworkResourceIT.kt b/lib/src/commonTest/kotlin/me/devnatan/dockerkt/resource/network/NetworkResourceIT.kt similarity index 100% rename from src/commonTest/kotlin/me/devnatan/dockerkt/resource/network/NetworkResourceIT.kt rename to lib/src/commonTest/kotlin/me/devnatan/dockerkt/resource/network/NetworkResourceIT.kt diff --git a/src/commonTest/kotlin/me/devnatan/dockerkt/resource/secret/SecretResourceIT.kt b/lib/src/commonTest/kotlin/me/devnatan/dockerkt/resource/secret/SecretResourceIT.kt similarity index 100% rename from src/commonTest/kotlin/me/devnatan/dockerkt/resource/secret/SecretResourceIT.kt rename to lib/src/commonTest/kotlin/me/devnatan/dockerkt/resource/secret/SecretResourceIT.kt diff --git a/src/commonTest/kotlin/me/devnatan/dockerkt/resource/system/SystemPingIT.kt b/lib/src/commonTest/kotlin/me/devnatan/dockerkt/resource/system/SystemPingIT.kt similarity index 100% rename from src/commonTest/kotlin/me/devnatan/dockerkt/resource/system/SystemPingIT.kt rename to lib/src/commonTest/kotlin/me/devnatan/dockerkt/resource/system/SystemPingIT.kt diff --git a/src/commonTest/kotlin/me/devnatan/dockerkt/resource/system/SystemVersionIT.kt b/lib/src/commonTest/kotlin/me/devnatan/dockerkt/resource/system/SystemVersionIT.kt similarity index 100% rename from src/commonTest/kotlin/me/devnatan/dockerkt/resource/system/SystemVersionIT.kt rename to lib/src/commonTest/kotlin/me/devnatan/dockerkt/resource/system/SystemVersionIT.kt diff --git a/src/commonTest/kotlin/me/devnatan/dockerkt/resource/volume/VolumeResourceIT.kt b/lib/src/commonTest/kotlin/me/devnatan/dockerkt/resource/volume/VolumeResourceIT.kt similarity index 100% rename from src/commonTest/kotlin/me/devnatan/dockerkt/resource/volume/VolumeResourceIT.kt rename to lib/src/commonTest/kotlin/me/devnatan/dockerkt/resource/volume/VolumeResourceIT.kt diff --git a/src/commonTest/kotlin/me/devnatan/dockerkt/util/JsonTest.kt b/lib/src/commonTest/kotlin/me/devnatan/dockerkt/util/JsonTest.kt similarity index 100% rename from src/commonTest/kotlin/me/devnatan/dockerkt/util/JsonTest.kt rename to lib/src/commonTest/kotlin/me/devnatan/dockerkt/util/JsonTest.kt diff --git a/src/jvmMain/kotlin/me/devnatan/dockerkt/DockerClient.jvm.kt b/lib/src/jvmMain/kotlin/me/devnatan/dockerkt/DockerClient.jvm.kt similarity index 100% rename from src/jvmMain/kotlin/me/devnatan/dockerkt/DockerClient.jvm.kt rename to lib/src/jvmMain/kotlin/me/devnatan/dockerkt/DockerClient.jvm.kt diff --git a/src/jvmMain/kotlin/me/devnatan/dockerkt/Platform.jvm.kt b/lib/src/jvmMain/kotlin/me/devnatan/dockerkt/Platform.jvm.kt similarity index 100% rename from src/jvmMain/kotlin/me/devnatan/dockerkt/Platform.jvm.kt rename to lib/src/jvmMain/kotlin/me/devnatan/dockerkt/Platform.jvm.kt diff --git a/src/jvmMain/kotlin/me/devnatan/dockerkt/io/CompressArchiveUtil.kt b/lib/src/jvmMain/kotlin/me/devnatan/dockerkt/io/CompressArchiveUtil.kt similarity index 100% rename from src/jvmMain/kotlin/me/devnatan/dockerkt/io/CompressArchiveUtil.kt rename to lib/src/jvmMain/kotlin/me/devnatan/dockerkt/io/CompressArchiveUtil.kt diff --git a/src/jvmMain/kotlin/me/devnatan/dockerkt/io/Flow.jvm.kt b/lib/src/jvmMain/kotlin/me/devnatan/dockerkt/io/Flow.jvm.kt similarity index 100% rename from src/jvmMain/kotlin/me/devnatan/dockerkt/io/Flow.jvm.kt rename to lib/src/jvmMain/kotlin/me/devnatan/dockerkt/io/Flow.jvm.kt diff --git a/src/jvmMain/kotlin/me/devnatan/dockerkt/io/Http.jvm.kt b/lib/src/jvmMain/kotlin/me/devnatan/dockerkt/io/Http.jvm.kt similarity index 100% rename from src/jvmMain/kotlin/me/devnatan/dockerkt/io/Http.jvm.kt rename to lib/src/jvmMain/kotlin/me/devnatan/dockerkt/io/Http.jvm.kt diff --git a/src/jvmMain/kotlin/me/devnatan/dockerkt/io/Sockets.jvm.kt b/lib/src/jvmMain/kotlin/me/devnatan/dockerkt/io/Sockets.jvm.kt similarity index 100% rename from src/jvmMain/kotlin/me/devnatan/dockerkt/io/Sockets.jvm.kt rename to lib/src/jvmMain/kotlin/me/devnatan/dockerkt/io/Sockets.jvm.kt diff --git a/src/jvmMain/kotlin/me/devnatan/dockerkt/io/TarFile.jvm.kt b/lib/src/jvmMain/kotlin/me/devnatan/dockerkt/io/TarFile.jvm.kt similarity index 100% rename from src/jvmMain/kotlin/me/devnatan/dockerkt/io/TarFile.jvm.kt rename to lib/src/jvmMain/kotlin/me/devnatan/dockerkt/io/TarFile.jvm.kt diff --git a/src/jvmMain/kotlin/me/devnatan/dockerkt/resource/container/ContainerResource.jvm.kt b/lib/src/jvmMain/kotlin/me/devnatan/dockerkt/resource/container/ContainerResource.jvm.kt similarity index 100% rename from src/jvmMain/kotlin/me/devnatan/dockerkt/resource/container/ContainerResource.jvm.kt rename to lib/src/jvmMain/kotlin/me/devnatan/dockerkt/resource/container/ContainerResource.jvm.kt diff --git a/lib/src/nativeInterop/cinterop/http_native.def b/lib/src/nativeInterop/cinterop/http_native.def new file mode 100644 index 00000000..a225bb75 --- /dev/null +++ b/lib/src/nativeInterop/cinterop/http_native.def @@ -0,0 +1,10 @@ +headers = http_native.h +headerFilter = http_native.h +package = me.devnatan.dockerkt.interop + +staticLibraries.mingw = libhttp_native.a + +libraryPaths.mingw = ../../../interop/target/x86_64-pc-windows-gnu/debug + +linkerOpts.mingw = -lws2_32 -luserenv -lbcrypt -lntdll -liphlpapi +--- \ No newline at end of file diff --git a/lib/src/nativeInterop/cinterop/http_native.h b/lib/src/nativeInterop/cinterop/http_native.h new file mode 100644 index 00000000..9e73a44e --- /dev/null +++ b/lib/src/nativeInterop/cinterop/http_native.h @@ -0,0 +1,57 @@ +#ifndef HTTP_NATIVE_H +#define HTTP_NATIVE_H + +#include +#include +#include +#include + +typedef struct DnsResult { + char **addresses; + uintptr_t count; + char *error; +} DnsResult; + +typedef struct HttpResponse { + char *body; + uint16_t status_code; + char *error; +} HttpResponse; + +typedef struct HttpRequest { + const char *url; + const char *method; + char **headers; + uintptr_t headers_count; + const char *body; + uintptr_t body_len; + uint64_t timeout_ms; +} HttpRequest; + +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + +struct DnsResult *dns_resolve(const char *hostname, + const char *const *dns_servers, + uintptr_t dns_servers_count); + +void dns_result_free(struct DnsResult *result); + +struct HttpResponse *http_request_execute(const struct HttpRequest *request); + +void http_response_free(struct HttpResponse *response); + +int32_t unix_socket_connect(const char *path); + +int32_t unix_socket_connect(const char *_path); + +void free_cstring(char *ptr); + +struct DnsResult *dns_resolve_simple(const char *hostname); + +#ifdef __cplusplus +} // extern "C" +#endif // __cplusplus + +#endif /* HTTP_NATIVE_H */ diff --git a/src/nativeMain/kotlin/me/devnatan/dockerkt/DockerClient.native.kt b/lib/src/nativeMain/kotlin/me/devnatan/dockerkt/DockerClient.native.kt similarity index 100% rename from src/nativeMain/kotlin/me/devnatan/dockerkt/DockerClient.native.kt rename to lib/src/nativeMain/kotlin/me/devnatan/dockerkt/DockerClient.native.kt diff --git a/src/nativeMain/kotlin/me/devnatan/dockerkt/Platform.native.kt b/lib/src/nativeMain/kotlin/me/devnatan/dockerkt/Platform.native.kt similarity index 100% rename from src/nativeMain/kotlin/me/devnatan/dockerkt/Platform.native.kt rename to lib/src/nativeMain/kotlin/me/devnatan/dockerkt/Platform.native.kt diff --git a/src/nativeMain/kotlin/me/devnatan/dockerkt/io/Http.native.kt b/lib/src/nativeMain/kotlin/me/devnatan/dockerkt/io/Http.native.kt similarity index 100% rename from src/nativeMain/kotlin/me/devnatan/dockerkt/io/Http.native.kt rename to lib/src/nativeMain/kotlin/me/devnatan/dockerkt/io/Http.native.kt diff --git a/src/nativeMain/kotlin/me/devnatan/dockerkt/io/TarFile.native.kt b/lib/src/nativeMain/kotlin/me/devnatan/dockerkt/io/TarFile.native.kt similarity index 100% rename from src/nativeMain/kotlin/me/devnatan/dockerkt/io/TarFile.native.kt rename to lib/src/nativeMain/kotlin/me/devnatan/dockerkt/io/TarFile.native.kt diff --git a/lib/src/nativeMain/kotlin/me/devnatan/dockerkt/native/CustomDnsResolver.native.kt b/lib/src/nativeMain/kotlin/me/devnatan/dockerkt/native/CustomDnsResolver.native.kt new file mode 100644 index 00000000..9d0a8524 --- /dev/null +++ b/lib/src/nativeMain/kotlin/me/devnatan/dockerkt/native/CustomDnsResolver.native.kt @@ -0,0 +1,52 @@ +@file:OptIn(ExperimentalNativeApi::class, ExperimentalForeignApi::class) +package me.devnatan.dockerkt.native + +import kotlinx.cinterop.* +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.withContext +import me.devnatan.dockerkt.interop.dns_resolve +import me.devnatan.dockerkt.interop.dns_result_free +import kotlin.experimental.ExperimentalNativeApi + +@OptIn(ExperimentalForeignApi::class) +public actual class CustomDnsResolver { + public actual suspend fun resolve( + hostname: String, + dnsServers: List + ): Result> = withContext(Dispatchers.Default) { + memScoped { + val dnsServersArray = if (dnsServers.isNotEmpty()) { + allocArrayOf(dnsServers.map { it.cstr.ptr }) + } else { + null + } + + val result = dns_resolve( + hostname, + dnsServersArray, + dnsServers.size.toULong() + ) ?: return@withContext Result.failure(Exception("DNS resolution returned null")) + + try { + val dnsResult = result.pointed + + if (dnsResult.error != null) { + val errorMsg = dnsResult.error!!.toKString() + return@withContext Result.failure(Exception(errorMsg)) + } + + val addresses = mutableListOf() + for (i in 0 until dnsResult.count.toInt()) { + val addrPtr = dnsResult.addresses!![i] + if (addrPtr != null) { + addresses.add(addrPtr.toKString()) + } + } + + Result.success(addresses) + } finally { + dns_result_free(result) + } + } + } +} diff --git a/lib/src/nativeMain/kotlin/me/devnatan/dockerkt/native/NativeHttpClient.native.kt b/lib/src/nativeMain/kotlin/me/devnatan/dockerkt/native/NativeHttpClient.native.kt new file mode 100644 index 00000000..9a638fb4 --- /dev/null +++ b/lib/src/nativeMain/kotlin/me/devnatan/dockerkt/native/NativeHttpClient.native.kt @@ -0,0 +1,160 @@ +@file:OptIn(ExperimentalForeignApi::class) +package me.devnatan.dockerkt.native + +import io.ktor.client.engine.HttpClientEngine +import io.ktor.client.engine.HttpClientEngineConfig +import io.ktor.client.engine.HttpClientEngineFactory +import io.ktor.client.request.HttpRequestData +import io.ktor.client.request.HttpResponseData +import io.ktor.http.Headers +import io.ktor.http.HttpProtocolVersion +import io.ktor.http.HttpStatusCode +import io.ktor.http.content.OutgoingContent +import io.ktor.util.date.GMTDate +import io.ktor.utils.io.ByteReadChannel +import io.ktor.utils.io.InternalAPI +import kotlinx.cinterop.CPointer +import kotlinx.cinterop.ExperimentalForeignApi +import kotlinx.cinterop.MemScope +import kotlinx.cinterop.alloc +import kotlinx.cinterop.allocArrayOf +import kotlinx.cinterop.cstr +import kotlinx.cinterop.memScoped +import kotlinx.cinterop.pointed +import kotlinx.cinterop.ptr +import kotlinx.cinterop.toKString +import kotlinx.coroutines.CoroutineDispatcher +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.SupervisorJob +import kotlinx.coroutines.withContext +import me.devnatan.dockerkt.interop.HttpRequest +import me.devnatan.dockerkt.interop.HttpResponse +import me.devnatan.dockerkt.interop.http_request_execute +import me.devnatan.dockerkt.interop.http_response_free +import me.devnatan.dockerkt.interop.unix_socket_connect +import kotlin.collections.map +import kotlin.coroutines.CoroutineContext + +public actual class NativeHttpEngine actual constructor( + config: NativeHttpEngineConfig, +) : HttpClientEngine { + + actual override val config: HttpClientEngineConfig = config + private val dnsResolver = CustomDnsResolver() + + actual override val dispatcher: CoroutineDispatcher = Dispatchers.Default + + actual override val coroutineContext: CoroutineContext + get() = dispatcher + SupervisorJob() + + @InternalAPI + actual override suspend fun execute(data: HttpRequestData): HttpResponseData { + return withContext(dispatcher) { + val host = data.url.host + + require(config is NativeHttpEngineConfig) + + if (config.customDnsServers.isNotEmpty()) { + dnsResolver.resolve(host, config.customDnsServers).getOrThrow() + } + + if (config.unixSocketPath != null) { + memScoped { + val result = unix_socket_connect(config.unixSocketPath) + if (result != 0) { + throw Exception("Failed to connect to Unix socket: $result") + } + } + } + + val httpRequest = memScoped { prepareHttpRequest(data) } + + val response = http_request_execute(httpRequest) + ?: throw Exception("HTTP request returned null") + + try { + parseHttpResponse(response, data) + } finally { + http_response_free(response) + freeHttpRequest(httpRequest) + } + } + } + + @OptIn(InternalAPI::class) + private fun MemScope.prepareHttpRequest(data: HttpRequestData): CPointer { + val method = data.method.value + val url = data.url.toString() + + val headersList = data.headers.entries().flatMap { (key, values) -> + values.map { value -> "$key: $value" } + } + val headersArray = allocArrayOf(headersList.map { it.cstr.ptr }) + + val bodyContent = data.body + val (bodyPtr, bodyLen) = when (bodyContent) { + is OutgoingContent.ByteArrayContent -> { + val bytes = bodyContent.bytes() + val ptr = allocArrayOf(bytes) + ptr to bytes.size.toULong() + } + is OutgoingContent.ReadChannelContent -> { + // TODO Implement ReadChannelContent + null to 0UL + } + is OutgoingContent.WriteChannelContent -> { + null to 0UL + } + is OutgoingContent.NoContent -> null to 0UL + else -> null to 0UL + } + + val request = alloc() + request.url = url.cstr.ptr + request.method = method.cstr.ptr + request.headers = headersArray + request.headers_count = headersList.size.toULong() + request.body = bodyPtr + request.body_len = bodyLen + request.timeout_ms = (config as NativeHttpEngineConfig).requestTimeout.inWholeMilliseconds.toULong() + + return request.ptr + } + + private fun parseHttpResponse( + response: CPointer, + requestData: HttpRequestData + ): HttpResponseData { + val httpResponse = response.pointed + + if (httpResponse.error != null) { + val errorMsg = httpResponse.error!!.toKString() + throw Exception("HTTP error: $errorMsg") + } + + val statusCode = HttpStatusCode.fromValue(httpResponse.status_code.toInt()) + val body = httpResponse.body?.toKString() ?: "" + + return HttpResponseData( + statusCode = statusCode, + requestTime = GMTDate(), + headers = Headers.Empty, + version = HttpProtocolVersion.HTTP_1_1, + body = ByteReadChannel(body.encodeToByteArray()), + callContext = coroutineContext + ) + } + + private fun freeHttpRequest(request: CPointer) { + } + + actual override fun close() { + } +} + +public actual val NativeHttpEngineFactory: HttpClientEngineFactory = object : HttpClientEngineFactory { + override fun create(block: NativeHttpEngineConfig.() -> Unit): HttpClientEngine { + val config = NativeHttpEngineConfig().apply(block) + return NativeHttpEngine(config) + } +} \ No newline at end of file diff --git a/src/nativeMain/kotlin/me/devnatan/dockerkt/resource/container/ContainerResource.native.kt b/lib/src/nativeMain/kotlin/me/devnatan/dockerkt/resource/container/ContainerResource.native.kt similarity index 100% rename from src/nativeMain/kotlin/me/devnatan/dockerkt/resource/container/ContainerResource.native.kt rename to lib/src/nativeMain/kotlin/me/devnatan/dockerkt/resource/container/ContainerResource.native.kt