diff --git a/Cargo-component.lock b/Cargo-component.lock deleted file mode 100644 index 00bc239d..00000000 --- a/Cargo-component.lock +++ /dev/null @@ -1,3 +0,0 @@ -# This file is automatically generated by cargo-component. -# It is not intended for manual editing. -version = 1 diff --git a/Cargo.lock b/Cargo.lock index 33f3c6cc..e1d6d8d6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -12,22 +12,13 @@ dependencies = [ "regex", ] -[[package]] -name = "addr2line" -version = "0.20.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4fa78e18c64fce05e902adecd7a5eed15a5e0a3439f7b0e169f0252214865e3" -dependencies = [ - "gimli 0.27.3", -] - [[package]] name = "addr2line" version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" dependencies = [ - "gimli 0.28.0", + "gimli", ] [[package]] @@ -246,12 +237,12 @@ version = "0.3.69" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" dependencies = [ - "addr2line 0.21.0", + "addr2line", "cc", "cfg-if", "libc", "miniz_oxide", - "object 0.32.1", + "object", "rustc-demangle", ] @@ -453,6 +444,18 @@ dependencies = [ "windows-sys", ] +[[package]] +name = "cap-net-ext" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ffc30dee200c20b4dcb80572226f42658e1d9c4b668656d7cc59c33d50e396e" +dependencies = [ + "cap-primitives", + "cap-std", + "rustix 0.38.13", + "smallvec 1.11.0", +] + [[package]] name = "cap-primitives" version = "2.0.0" @@ -745,18 +748,18 @@ dependencies = [ [[package]] name = "cranelift-bforest" -version = "0.99.1" +version = "0.101.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7348010242a23d0285e5f852f13b07f9540a50f13ab6e92fd047b88490bf5ee" +checksum = "2b5bb9245ec7dcc04d03110e538d31f0969d301c9d673145f4b4d5c3478539a3" dependencies = [ "cranelift-entity", ] [[package]] name = "cranelift-codegen" -version = "0.99.1" +version = "0.101.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38849e3b19bc9a6dbf8bc188876b76e6ba288089a5567be573de50f44801375c" +checksum = "ebb18d10e5ddac43ba4ca8fd4e310938569c3e484cc01b6372b27dc5bb4dfd28" dependencies = [ "bumpalo", "cranelift-bforest", @@ -765,8 +768,8 @@ dependencies = [ "cranelift-control", "cranelift-entity", "cranelift-isle", - "gimli 0.27.3", - "hashbrown 0.13.2", + "gimli", + "hashbrown 0.14.0", "log", "regalloc2", "smallvec 1.11.0", @@ -775,42 +778,43 @@ dependencies = [ [[package]] name = "cranelift-codegen-meta" -version = "0.99.1" +version = "0.101.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3de51da572e65cb712a47b7413c50208cac61a4201560038de929d9a7f4fadf" +checksum = "7a3ce6d22982c1b9b6b012654258bab1a13947bb12703518bef06b1a4867c3d6" dependencies = [ "cranelift-codegen-shared", ] [[package]] name = "cranelift-codegen-shared" -version = "0.99.1" +version = "0.101.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d75f869ae826055a5064d4a400abde7806eb86d89765dbae51d42846df23121a" +checksum = "47220fd4f9a0ce23541652b6f16f83868d282602c600d14934b2a4c166b4bd80" [[package]] name = "cranelift-control" -version = "0.99.1" +version = "0.101.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdf6631316ad6ccfd60055740ad25326330d31407a983a454e45c5a62f64d101" +checksum = "ed5a4c42672aea9b6e820046b52e47a1c05d3394a6cdf4cb3c3c4b702f954bd2" dependencies = [ "arbitrary", ] [[package]] name = "cranelift-entity" -version = "0.99.1" +version = "0.101.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d1d6a38935ee64551a7c8da4cc759fdcaba1d951ec56336737c0459ed5a05d2" +checksum = "0b4e9a3296fc827f9d35135dc2c0c8dd8d8359eb1ef904bae2d55d5bcb0c9f94" dependencies = [ "serde", + "serde_derive", ] [[package]] name = "cranelift-frontend" -version = "0.99.1" +version = "0.101.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba73c410c2d52e28fc4b49aab955a1c2f58580ff37a3b0641e23bccd6049e4b5" +checksum = "33ec537d0f0b8e084517f3e7bfa1d89af343d7c7df455573fca9f272d4e01267" dependencies = [ "cranelift-codegen", "log", @@ -820,15 +824,15 @@ dependencies = [ [[package]] name = "cranelift-isle" -version = "0.99.1" +version = "0.101.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61acaa7646020e0444bb3a22d212a5bae0e3b3969b18e1276a037ccd6493a8fd" +checksum = "45bab6d69919d210a50331d35cc6ce111567bc040aebac63a8ae130d0400a075" [[package]] name = "cranelift-native" -version = "0.99.1" +version = "0.101.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "543f52ef487498253ebe5df321373c5c314da74ada0e92f13451b6f887194f87" +checksum = "f32e81605f352cf37af5463f11cd7deec7b6572741931a8d372f7fdd4a744f5d" dependencies = [ "cranelift-codegen", "libc", @@ -837,9 +841,9 @@ dependencies = [ [[package]] name = "cranelift-wasm" -version = "0.99.1" +version = "0.101.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "788c27f41f31a50a9a3546b91253ad9495cd54df0d6533b3f3dcb4fb7a988f69" +checksum = "0edaa4cbec1bc787395c074233df2652dd62f3e29d3ee60329514a0a51e6b045" dependencies = [ "cranelift-codegen", "cranelift-entity", @@ -847,7 +851,7 @@ dependencies = [ "itertools 0.10.5", "log", "smallvec 1.11.0", - "wasmparser 0.110.0", + "wasmparser 0.115.0", "wasmtime-types", ] @@ -1334,19 +1338,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "env_logger" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85cdab6a89accf66733ad5a1693a4dcced6aeff64602b634530dd73c1f3ee9f0" -dependencies = [ - "humantime", - "is-terminal", - "log", - "regex", - "termcolor", -] - [[package]] name = "equivalent" version = "1.0.1" @@ -1704,9 +1695,9 @@ dependencies = [ [[package]] name = "fallible-iterator" -version = "0.2.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" +checksum = "2acce4a10f12dc2fb14a218589d4f1f62ef011b2d0cc4b3cb1bba8e94da14649" [[package]] name = "fastrand" @@ -1741,16 +1732,6 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a481586acf778f1b1455424c343f71124b048ffa5f4fc3f8f6ae9dc432dcb3c7" -[[package]] -name = "file-per-thread-logger" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a3cc21c33af89af0930c8cae4ade5e6fdc17b5d2c97b3d2e2edb67a1cf683f3" -dependencies = [ - "env_logger", - "log", -] - [[package]] name = "fixed-hash" version = "0.8.0" @@ -2009,22 +1990,16 @@ dependencies = [ "polyval 0.6.1", ] -[[package]] -name = "gimli" -version = "0.27.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6c80984affa11d98d1b88b66ac8853f143217b399d3c74116778ff8fdb4ed2e" -dependencies = [ - "fallible-iterator", - "indexmap 1.9.3", - "stable_deref_trait", -] - [[package]] name = "gimli" version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0" +dependencies = [ + "fallible-iterator", + "indexmap 2.0.0", + "stable_deref_trait", +] [[package]] name = "glob" @@ -2094,6 +2069,9 @@ name = "hashbrown" version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a" +dependencies = [ + "ahash", +] [[package]] name = "hashers" @@ -2220,12 +2198,6 @@ version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" -[[package]] -name = "humantime" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" - [[package]] name = "hyper" version = "0.14.27" @@ -2945,24 +2917,15 @@ dependencies = [ "syn 2.0.32", ] -[[package]] -name = "object" -version = "0.31.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bda667d9f2b5051b8833f59f3bf748b28ef54f850f4fcb389a252aa383866d1" -dependencies = [ - "crc32fast", - "hashbrown 0.13.2", - "indexmap 1.9.3", - "memchr", -] - [[package]] name = "object" version = "0.32.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0" dependencies = [ + "crc32fast", + "hashbrown 0.14.0", + "indexmap 2.0.0", "memchr", ] @@ -3479,17 +3442,6 @@ dependencies = [ "trust-dns-proto", ] -[[package]] -name = "pulldown-cmark" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77a1a2f1f0a7ecff9c31abbe177637be0e97a0aef46cf8738ece09327985d998" -dependencies = [ - "bitflags 1.3.2", - "memchr", - "unicase", -] - [[package]] name = "quote" version = "1.0.33" @@ -4578,15 +4530,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "termcolor" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6" -dependencies = [ - "winapi-util", -] - [[package]] name = "thiserror" version = "1.0.48" @@ -5216,9 +5159,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasi-cap-std-sync" -version = "12.0.1" +version = "14.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cef338a20bd9e5e469a37b192b2a954c4dde83ea896c8eaf45df8c84cdf7be5" +checksum = "3fd94e147b273348ec68ae412b8bc17a4d372b9e070535b98e3e2c5a3ffd8e83" dependencies = [ "anyhow", "async-trait", @@ -5229,7 +5172,6 @@ dependencies = [ "fs-set-times", "io-extras", "io-lifetimes 2.0.2", - "is-terminal", "once_cell", "rustix 0.38.13", "system-interface", @@ -5240,9 +5182,9 @@ dependencies = [ [[package]] name = "wasi-common" -version = "12.0.1" +version = "14.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb9c753bdf98fdc592fc729bda2248996f5dd1be71f4e01bf8c08225acb7b6bb" +checksum = "8d5166f7432ee36d06aa9f9bd7990a00330401fdbc75be7887ea952a299b9a19" dependencies = [ "anyhow", "bitflags 2.4.0", @@ -5326,18 +5268,9 @@ checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" [[package]] name = "wasm-encoder" -version = "0.31.1" +version = "0.35.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41763f20eafed1399fff1afb466496d3a959f58241436cfdc17e3f5ca954de16" -dependencies = [ - "leb128", -] - -[[package]] -name = "wasm-encoder" -version = "0.32.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ba64e81215916eaeb48fee292f29401d69235d62d8b8fd92a7b2844ec5ae5f7" +checksum = "9ca90ba1b5b0a70d3d49473c5579951f3bddc78d47b59256d2f9d4922b150aca" dependencies = [ "leb128", ] @@ -5369,19 +5302,9 @@ dependencies = [ [[package]] name = "wasmparser" -version = "0.110.0" +version = "0.115.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1dfcdb72d96f01e6c85b6bf20102e7423bdbaad5c337301bab2bbf253d26413c" -dependencies = [ - "indexmap 2.0.0", - "semver", -] - -[[package]] -name = "wasmparser" -version = "0.112.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e986b010f47fcce49cf8ea5d5f9e5d2737832f12b53ae8ae785bbe895d0877bf" +checksum = "e06c0641a4add879ba71ccb3a1e4278fd546f76f1eafb21d8f7b07733b547cd5" dependencies = [ "indexmap 2.0.0", "semver", @@ -5399,19 +5322,19 @@ dependencies = [ [[package]] name = "wasmprinter" -version = "0.2.64" +version = "0.2.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34ddf5892036cd4b780d505eff1194a0cbc10ed896097656fdcea3744b5e7c2f" +checksum = "8f98260aa20f939518bcec1fac32c78898d5c68872e7363a4651f21f791b6c7e" dependencies = [ "anyhow", - "wasmparser 0.112.0", + "wasmparser 0.116.0", ] [[package]] name = "wasmtime" -version = "12.0.1" +version = "14.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e38ee12eaafb34198cce001e2ea0a83d3884db5cf8e3af08864f108a2fb57c85" +checksum = "ca54f6090ce46973f33a79f265924b204f248f91aec09229bce53d19d567c1a6" dependencies = [ "anyhow", "async-trait", @@ -5423,16 +5346,17 @@ dependencies = [ "indexmap 2.0.0", "libc", "log", - "object 0.31.1", + "object", "once_cell", "paste", "psm", "rayon", "serde", + "serde_derive", "serde_json", "target-lexicon", - "wasm-encoder 0.31.1", - "wasmparser 0.110.0", + "wasm-encoder 0.35.0", + "wasmparser 0.115.0", "wasmtime-cache", "wasmtime-component-macro", "wasmtime-component-util", @@ -5448,27 +5372,27 @@ dependencies = [ [[package]] name = "wasmtime-asm-macros" -version = "12.0.1" +version = "14.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82313f9dce6f64dd08a7b51bef57411741b7eaef6b4611f77b91b6213a99808b" +checksum = "54984bc0b5689da87a43d7c181d23092b4d5cfcbb7ae3eb6b917dd55865d95e6" dependencies = [ "cfg-if", ] [[package]] name = "wasmtime-cache" -version = "12.0.1" +version = "14.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d22677d863d88d0ee05a07bfe28fdc5525149b6ea5a108f1fa2796fa86d75b8" +checksum = "1a4df7655bb73b592189033ab046aa47c1da486d70bc9c1ebf45e55ac030bdf4" dependencies = [ "anyhow", "base64 0.21.4", "bincode", "directories-next", - "file-per-thread-logger", "log", "rustix 0.38.13", "serde", + "serde_derive", "sha2 0.10.7", "toml 0.5.11", "windows-sys", @@ -5477,9 +5401,9 @@ dependencies = [ [[package]] name = "wasmtime-component-macro" -version = "12.0.1" +version = "14.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2b6da03d55c656066ebc93d27ce54de11fcd2d3157e7490c6196a65aa1e9bc0" +checksum = "64de99fb7c4c383832b85efcaae95f7094a5c505d80146227ce97ab436cbac68" dependencies = [ "anyhow", "proc-macro2", @@ -5487,34 +5411,35 @@ dependencies = [ "syn 2.0.32", "wasmtime-component-util", "wasmtime-wit-bindgen", - "wit-parser 0.9.2", + "wit-parser", ] [[package]] name = "wasmtime-component-util" -version = "12.0.1" +version = "14.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b54327f9ce6a46c6841c43d93c4fa366cd0beb0f075743b120d31a3d6afe34fd" +checksum = "9f9141a8df069e106eee0c3a8173c0809cf1a4b5630628cfb1f25ab114720093" [[package]] name = "wasmtime-cranelift" -version = "12.0.1" +version = "14.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76d52e14e5453e82708816e992140c59e511bbf7c0868ee654100e2792483f56" +checksum = "1cf3cee8be02f5006d21b773ffd6802f96a0b7d661ff2ad8a01fb93df458b1aa" dependencies = [ "anyhow", + "cfg-if", "cranelift-codegen", "cranelift-control", "cranelift-entity", "cranelift-frontend", "cranelift-native", "cranelift-wasm", - "gimli 0.27.3", + "gimli", "log", - "object 0.31.1", + "object", "target-lexicon", "thiserror", - "wasmparser 0.110.0", + "wasmparser 0.115.0", "wasmtime-cranelift-shared", "wasmtime-environ", "wasmtime-versioned-export-macros", @@ -5522,37 +5447,38 @@ dependencies = [ [[package]] name = "wasmtime-cranelift-shared" -version = "12.0.1" +version = "14.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ddb7f34fff5b4a01aa2e55373fceb1b59d5f981abca44afdd63d7dd39689047" +checksum = "420fd2a69bc162957f4c94f21c7fa08ecf60d916f4e87b56332507c555da381d" dependencies = [ "anyhow", "cranelift-codegen", "cranelift-control", "cranelift-native", - "gimli 0.27.3", - "object 0.31.1", + "gimli", + "object", "target-lexicon", "wasmtime-environ", ] [[package]] name = "wasmtime-environ" -version = "12.0.1" +version = "14.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad336809866b743410ac86ec0bdc34899d6f1af5d3deed97188e90503ff527d7" +checksum = "fb6a445ce2b2810127caee6c1b79b8da4ae57712b05556a674592c18b7500a14" dependencies = [ "anyhow", "cranelift-entity", - "gimli 0.27.3", + "gimli", "indexmap 2.0.0", "log", - "object 0.31.1", + "object", "serde", + "serde_derive", "target-lexicon", "thiserror", - "wasm-encoder 0.31.1", - "wasmparser 0.110.0", + "wasm-encoder 0.35.0", + "wasmparser 0.115.0", "wasmprinter", "wasmtime-component-util", "wasmtime-types", @@ -5560,9 +5486,9 @@ dependencies = [ [[package]] name = "wasmtime-fiber" -version = "12.0.1" +version = "14.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcc69f0a316db37482ebc83669236ea7c943d0b49a1a23f763061c9fc9d07d0b" +checksum = "345a8b061c9eab459e10b9112df9fc357d5a9e8b5b1004bc5fc674fba9be6d2a" dependencies = [ "cc", "cfg-if", @@ -5574,22 +5500,23 @@ dependencies = [ [[package]] name = "wasmtime-jit" -version = "12.0.1" +version = "14.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2004b30ea1ad9fd288bce54af19ef08281250e1087f0b5ffc6ca06bacd821edb" +checksum = "1f0f6586c61125fbfc13c3108c3dd565d21f314dd5bac823b9a5b7ab576d21f1" dependencies = [ - "addr2line 0.20.0", + "addr2line", "anyhow", "bincode", "cfg-if", "cpp_demangle", - "gimli 0.27.3", + "gimli", "ittapi", "log", - "object 0.31.1", + "object", "rustc-demangle", "rustix 0.38.13", "serde", + "serde_derive", "target-lexicon", "wasmtime-environ", "wasmtime-jit-debug", @@ -5600,11 +5527,11 @@ dependencies = [ [[package]] name = "wasmtime-jit-debug" -version = "12.0.1" +version = "14.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54aa8081162b13a96f47ab40f9aa03fc02dad38ee10b1418243ac8517c5af6d3" +checksum = "109a9e46afe33580b952b14a4207354355f19bcdf0b47485b397b68409eaf553" dependencies = [ - "object 0.31.1", + "object", "once_cell", "rustix 0.38.13", "wasmtime-versioned-export-macros", @@ -5612,9 +5539,9 @@ dependencies = [ [[package]] name = "wasmtime-jit-icache-coherence" -version = "12.0.1" +version = "14.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2922462d01f5c112bbc4e6eb95ee68447a6031c0b90cc2ad69b890060b3842d9" +checksum = "f67e6be36375c39cff57ed3b137ab691afbf2d9ba8ee1c01f77888413f218749" dependencies = [ "cfg-if", "libc", @@ -5623,9 +5550,9 @@ dependencies = [ [[package]] name = "wasmtime-runtime" -version = "12.0.1" +version = "14.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "536c34c4abbe22c40f631067b57ca14d719faf3f63ae0d504014a4d15a4b980b" +checksum = "1d07986b2327b5e7f535ed638fbde25990fc8f85400194fda0d26db71c7b685e" dependencies = [ "anyhow", "cc", @@ -5641,32 +5568,34 @@ dependencies = [ "rand", "rustix 0.38.13", "sptr", - "wasm-encoder 0.31.1", + "wasm-encoder 0.35.0", "wasmtime-asm-macros", "wasmtime-environ", "wasmtime-fiber", "wasmtime-jit-debug", "wasmtime-versioned-export-macros", + "wasmtime-wmemcheck", "windows-sys", ] [[package]] name = "wasmtime-types" -version = "12.0.1" +version = "14.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec6f1e74eb5ef817043b243eae37cc0e424c256c4069ab2c5afd9f3fe91a12ee" +checksum = "e810a0d2e869abd1cb42bd232990f6bd211672b3d202d2ae7e70ffb97ed70ea3" dependencies = [ "cranelift-entity", "serde", + "serde_derive", "thiserror", - "wasmparser 0.110.0", + "wasmparser 0.115.0", ] [[package]] name = "wasmtime-versioned-export-macros" -version = "12.0.1" +version = "14.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39ca36fa6cad8ef885bc27d7d50c8b1cb7da0534251188a824f4953b07875703" +checksum = "09b5575a75e711ca6c36bb9ad647c93541cdc8e34218031acba5da3f35919dd3" dependencies = [ "proc-macro2", "quote", @@ -5675,28 +5604,32 @@ dependencies = [ [[package]] name = "wasmtime-wasi" -version = "12.0.1" +version = "14.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "269f4f2192b18037729b617eadb512e95510f1b0cd8fb4990aef286c9bb3dfb9" +checksum = "1e6730a2853226292cee755a36549dd1a443b324cf99319cb390af1afed6cb8a" dependencies = [ "anyhow", "async-trait", "bitflags 2.4.0", "bytes", "cap-fs-ext", + "cap-net-ext", "cap-rand", "cap-std", "cap-time-ext", "fs-set-times", "futures", "io-extras", + "io-lifetimes 2.0.2", "libc", + "log", "once_cell", "rustix 0.38.13", "system-interface", "thiserror", "tokio", "tracing", + "url", "wasi-cap-std-sync", "wasi-common", "wasmtime", @@ -5706,16 +5639,16 @@ dependencies = [ [[package]] name = "wasmtime-winch" -version = "12.0.1" +version = "14.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9d016c3f1d0c8ac905bfda51936cb6dae040e0d8edc75b7a1ef9f21773a19f6" +checksum = "c1c1b6abbba5a01739bef9f00a87b419414a7dd99b795823d93fb12fc2bf994a" dependencies = [ "anyhow", "cranelift-codegen", - "gimli 0.27.3", - "object 0.31.1", + "gimli", + "object", "target-lexicon", - "wasmparser 0.110.0", + "wasmparser 0.115.0", "wasmtime-cranelift-shared", "wasmtime-environ", "winch-codegen", @@ -5723,16 +5656,22 @@ dependencies = [ [[package]] name = "wasmtime-wit-bindgen" -version = "12.0.1" +version = "14.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbd55caadebae32cf18541e5077b3f042a171bb9988ea0040d0569f26a63227d" +checksum = "9d214ca7513d76af2872ad5bba4b0dcc0225821931745fdcb4fc30dd34bc3bf7" dependencies = [ "anyhow", "heck", "indexmap 2.0.0", - "wit-parser 0.9.2", + "wit-parser", ] +[[package]] +name = "wasmtime-wmemcheck" +version = "14.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9dafab2db172a53e23940e0fa3078c202f567ee5f13f4b42f66b694fab43c658" + [[package]] name = "wast" version = "35.0.2" @@ -5744,23 +5683,23 @@ dependencies = [ [[package]] name = "wast" -version = "64.0.0" +version = "67.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a259b226fd6910225aa7baeba82f9d9933b6d00f2ce1b49b80fa4214328237cc" +checksum = "36c2933efd77ff2398b83817a98984ffe4b67aefd9aa1d2c8e68e19b553f1c38" dependencies = [ "leb128", "memchr", "unicode-width", - "wasm-encoder 0.32.0", + "wasm-encoder 0.36.1", ] [[package]] name = "wat" -version = "1.0.71" +version = "1.0.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53253d920ab413fca1c7dc2161d601c79b4fdf631d0ba51dd4343bf9b556c3f6" +checksum = "c02905d13751dcb18f4e19f489d37a1bf139f519feaeef28d072a41a78e69a74" dependencies = [ - "wast 64.0.0", + "wast 67.0.0", ] [[package]] @@ -5790,9 +5729,9 @@ checksum = "14247bb57be4f377dfb94c72830b8ce8fc6beac03cf4bf7b9732eadd414123fc" [[package]] name = "wiggle" -version = "12.0.1" +version = "14.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "166189cd49163adc9a1e2a33b33625eb934d06e518c318905c3a5140d9bc1d45" +checksum = "7f6ce56a4019ce3d8592c298029a75abe6887d1c95a078a4c53ec77a0628262d" dependencies = [ "anyhow", "async-trait", @@ -5805,9 +5744,9 @@ dependencies = [ [[package]] name = "wiggle-generate" -version = "12.0.1" +version = "14.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a67571bd77bff962190744adb29e72a1157d30e8d34fbb2c1c7b0ad7627be020" +checksum = "e585a4b1e84195031c77d8484af99cd93f129f45d519e83cb8cc75e9a420cfd3" dependencies = [ "anyhow", "heck", @@ -5820,9 +5759,9 @@ dependencies = [ [[package]] name = "wiggle-macro" -version = "12.0.1" +version = "14.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5677f7d740bc41f9f6af4a6a719a07fbe1aa8ec66e0ec1ca4d3617f2b27d5361" +checksum = "c6f321dbce722989d65c3082dba479fa392c7b7a1a4c3adc2a39545dd5aa452f" dependencies = [ "proc-macro2", "quote", @@ -5863,17 +5802,17 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "winch-codegen" -version = "0.10.1" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38e6f2f344ec89998f047d0aa3aec77088eb8e33c91f5efdd191b140fda6fa40" +checksum = "f112bebb367a544d20c254083798087f22ceeb426168a970b955e8436f749dca" dependencies = [ "anyhow", "cranelift-codegen", - "gimli 0.27.3", + "gimli", "regalloc2", "smallvec 1.11.0", "target-lexicon", - "wasmparser 0.110.0", + "wasmparser 0.115.0", "wasmtime-environ", ] @@ -5984,7 +5923,7 @@ dependencies = [ [[package]] name = "wit-bindgen" version = "0.13.1" -source = "git+https://github.com/bytecodealliance/wit-bindgen#5390bab780733f1660d14c254ec985df2816bf1d" +source = "git+https://github.com/bytecodealliance/wit-bindgen?rev=5390bab780733f1660d14c254ec985df2816bf1d#5390bab780733f1660d14c254ec985df2816bf1d" dependencies = [ "bitflags 2.4.0", "wit-bindgen-rust-macro", @@ -5993,17 +5932,17 @@ dependencies = [ [[package]] name = "wit-bindgen-core" version = "0.13.1" -source = "git+https://github.com/bytecodealliance/wit-bindgen#5390bab780733f1660d14c254ec985df2816bf1d" +source = "git+https://github.com/bytecodealliance/wit-bindgen?rev=5390bab780733f1660d14c254ec985df2816bf1d#5390bab780733f1660d14c254ec985df2816bf1d" dependencies = [ "anyhow", "wit-component", - "wit-parser 0.12.2", + "wit-parser", ] [[package]] name = "wit-bindgen-rust" version = "0.13.2" -source = "git+https://github.com/bytecodealliance/wit-bindgen#5390bab780733f1660d14c254ec985df2816bf1d" +source = "git+https://github.com/bytecodealliance/wit-bindgen?rev=5390bab780733f1660d14c254ec985df2816bf1d#5390bab780733f1660d14c254ec985df2816bf1d" dependencies = [ "anyhow", "heck", @@ -6015,7 +5954,7 @@ dependencies = [ [[package]] name = "wit-bindgen-rust-macro" version = "0.13.1" -source = "git+https://github.com/bytecodealliance/wit-bindgen#5390bab780733f1660d14c254ec985df2816bf1d" +source = "git+https://github.com/bytecodealliance/wit-bindgen?rev=5390bab780733f1660d14c254ec985df2816bf1d#5390bab780733f1660d14c254ec985df2816bf1d" dependencies = [ "anyhow", "proc-macro2", @@ -6042,23 +5981,7 @@ dependencies = [ "wasm-encoder 0.36.1", "wasm-metadata", "wasmparser 0.116.0", - "wit-parser 0.12.2", -] - -[[package]] -name = "wit-parser" -version = "0.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "541efa2046e544de53a9da1e2f6299e63079840360c9e106f1f8275a97771318" -dependencies = [ - "anyhow", - "id-arena", - "indexmap 2.0.0", - "log", - "pulldown-cmark", - "semver", - "unicode-xid", - "url", + "wit-parser", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 5df58169..a874d904 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -64,6 +64,6 @@ url = "*" uqbar_process_lib = { path = "process_lib" } uuid = { version = "1.1.2", features = ["serde", "v4"] } warp = "0.3.5" -wasmtime = "12.0.1" -wasmtime-wasi = "12.0.1" +wasmtime = "14.0.4" +wasmtime-wasi = "14.0.4" zip = "0.6" diff --git a/build.rs b/build.rs index 1366c0fc..6e341bde 100644 --- a/build.rs +++ b/build.rs @@ -153,7 +153,7 @@ fn main() { let entry_path = entry.unwrap().path(); let package_name = entry_path.file_name().unwrap().to_str().unwrap(); - if package_name != "homepage" { + if !["homepage", "http_proxy", "qns_indexer", "terminal"].contains(&package_name) { continue; } diff --git a/modules/homepage/Cargo-component.lock b/modules/homepage/Cargo-component.lock deleted file mode 100644 index 00bc239d..00000000 --- a/modules/homepage/Cargo-component.lock +++ /dev/null @@ -1,3 +0,0 @@ -# This file is automatically generated by cargo-component. -# It is not intended for manual editing. -version = 1 diff --git a/modules/homepage/Cargo.lock b/modules/homepage/Cargo.lock index ab1f6a96..8204a107 100644 --- a/modules/homepage/Cargo.lock +++ b/modules/homepage/Cargo.lock @@ -19,9 +19,9 @@ dependencies = [ [[package]] name = "bitflags" -version = "2.4.0" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635" +checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" [[package]] name = "cfg-if" @@ -122,9 +122,9 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "proc-macro2" -version = "1.0.66" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" +checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" dependencies = [ "unicode-ident", ] @@ -182,18 +182,18 @@ checksum = "836fa6a3e1e547f9a2c4040802ec865b5d85f4014efe00555d7090a3dcaa1090" [[package]] name = "serde" -version = "1.0.188" +version = "1.0.191" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf9e0fcba69a370eed61bcf2b728575f726b50b55cba78064753d708ddc7549e" +checksum = "a834c4821019838224821468552240d4d95d14e751986442c816572d39a080c9" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.188" +version = "1.0.191" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2" +checksum = "46fa52d5646bce91b680189fe5b1c049d2ea38dabb4e2e7c8d00ca12cfbfbcfd" dependencies = [ "proc-macro2", "quote", @@ -202,9 +202,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.106" +version = "1.0.108" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2cc66a619ed80bf7a0f6b17dd063a84b88f6dea1813737cf469aef1d081142c2" +checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b" dependencies = [ "itoa", "ryu", @@ -228,9 +228,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.32" +version = "2.0.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "239814284fd6f1a4ffe4ca893952cdd93c224b6a1571c9a9eadd670295c0c9e2" +checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a" dependencies = [ "proc-macro2", "quote", @@ -239,9 +239,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.11" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "unicode-segmentation" @@ -310,7 +310,7 @@ dependencies = [ [[package]] name = "wit-bindgen" version = "0.13.1" -source = "git+https://github.com/bytecodealliance/wit-bindgen#23e0c1463f31cb53fb390a7c744a3ced282a579a" +source = "git+https://github.com/bytecodealliance/wit-bindgen?rev=5390bab780733f1660d14c254ec985df2816bf1d#5390bab780733f1660d14c254ec985df2816bf1d" dependencies = [ "bitflags", "wit-bindgen-rust-macro", @@ -319,7 +319,7 @@ dependencies = [ [[package]] name = "wit-bindgen-core" version = "0.13.1" -source = "git+https://github.com/bytecodealliance/wit-bindgen#23e0c1463f31cb53fb390a7c744a3ced282a579a" +source = "git+https://github.com/bytecodealliance/wit-bindgen?rev=5390bab780733f1660d14c254ec985df2816bf1d#5390bab780733f1660d14c254ec985df2816bf1d" dependencies = [ "anyhow", "wit-component", @@ -329,7 +329,7 @@ dependencies = [ [[package]] name = "wit-bindgen-rust" version = "0.13.2" -source = "git+https://github.com/bytecodealliance/wit-bindgen#23e0c1463f31cb53fb390a7c744a3ced282a579a" +source = "git+https://github.com/bytecodealliance/wit-bindgen?rev=5390bab780733f1660d14c254ec985df2816bf1d#5390bab780733f1660d14c254ec985df2816bf1d" dependencies = [ "anyhow", "heck", @@ -341,7 +341,7 @@ dependencies = [ [[package]] name = "wit-bindgen-rust-macro" version = "0.13.1" -source = "git+https://github.com/bytecodealliance/wit-bindgen#23e0c1463f31cb53fb390a7c744a3ced282a579a" +source = "git+https://github.com/bytecodealliance/wit-bindgen?rev=5390bab780733f1660d14c254ec985df2816bf1d#5390bab780733f1660d14c254ec985df2816bf1d" dependencies = [ "anyhow", "proc-macro2", diff --git a/modules/homepage/Cargo.toml b/modules/homepage/Cargo.toml index c04d5a0c..5393be2c 100644 --- a/modules/homepage/Cargo.toml +++ b/modules/homepage/Cargo.toml @@ -15,7 +15,7 @@ anyhow = "1.0" bincode = "1.3.3" serde = {version = "1.0", features = ["derive"] } serde_json = "1.0" -wit-bindgen = { git = "https://github.com/bytecodealliance/wit-bindgen", version = "0.13.0" } +wit-bindgen = { git = "https://github.com/bytecodealliance/wit-bindgen", rev = "5390bab780733f1660d14c254ec985df2816bf1d" } uqbar_process_lib = { path = "../../process_lib" } [lib] diff --git a/modules/http_proxy/Cargo-component.lock b/modules/http_proxy/Cargo-component.lock deleted file mode 100644 index 00bc239d..00000000 --- a/modules/http_proxy/Cargo-component.lock +++ /dev/null @@ -1,3 +0,0 @@ -# This file is automatically generated by cargo-component. -# It is not intended for manual editing. -version = 1 diff --git a/modules/http_proxy/Cargo.lock b/modules/http_proxy/Cargo.lock index a8af8774..eb0a1c80 100644 --- a/modules/http_proxy/Cargo.lock +++ b/modules/http_proxy/Cargo.lock @@ -19,39 +19,15 @@ dependencies = [ [[package]] name = "bitflags" -version = "1.3.2" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" [[package]] -name = "bitflags" -version = "2.4.0" +name = "cfg-if" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635" - -[[package]] -name = "cargo-component-bindings" -version = "0.1.0" -source = "git+https://github.com/bytecodealliance/cargo-component#aa6e3c1168273b5cf6221fa0206f07f2ffb8567d" -dependencies = [ - "cargo-component-macro", - "wit-bindgen", -] - -[[package]] -name = "cargo-component-macro" -version = "0.1.0" -source = "git+https://github.com/bytecodealliance/cargo-component#aa6e3c1168273b5cf6221fa0206f07f2ffb8567d" -dependencies = [ - "heck", - "proc-macro2", - "quote", - "syn", - "wit-bindgen-core", - "wit-bindgen-rust", - "wit-bindgen-rust-lib", - "wit-component", -] +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "equivalent" @@ -60,19 +36,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] -name = "form_urlencoded" -version = "1.2.0" +name = "getrandom" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652" +checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" dependencies = [ - "percent-encoding", + "cfg-if", + "libc", + "wasi", ] [[package]] name = "hashbrown" -version = "0.14.0" +version = "0.14.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a" +checksum = "f93e7192158dbcda357bdec5fb5788eebf8bbac027f3f33e719d29135ae84156" [[package]] name = "heck" @@ -85,13 +63,13 @@ dependencies = [ [[package]] name = "http_proxy" -version = "0.1.0" +version = "0.2.0" dependencies = [ "anyhow", "bincode", - "cargo-component-bindings", "serde", "serde_json", + "uqbar_process_lib", "wit-bindgen", ] @@ -101,21 +79,11 @@ version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "25a2bc672d1148e28034f176e01fffebb08b35768468cc954630da77a1449005" -[[package]] -name = "idna" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" -dependencies = [ - "unicode-bidi", - "unicode-normalization", -] - [[package]] name = "indexmap" -version = "2.0.0" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5477fe2230a79769d8dc68e0eabf5437907c0457a5614a9e8dddb67f65eb65d" +checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" dependencies = [ "equivalent", "hashbrown", @@ -134,6 +102,12 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67" +[[package]] +name = "libc" +version = "0.2.150" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c" + [[package]] name = "log" version = "0.4.20" @@ -141,37 +115,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" [[package]] -name = "memchr" -version = "2.6.3" +name = "ppv-lite86" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f232d6ef707e1956a43342693d2a31e72989554d58299d7a88738cc95b0d35c" - -[[package]] -name = "percent-encoding" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" +checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "proc-macro2" -version = "1.0.66" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" +checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" dependencies = [ "unicode-ident", ] -[[package]] -name = "pulldown-cmark" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77a1a2f1f0a7ecff9c31abbe177637be0e97a0aef46cf8738ece09327985d998" -dependencies = [ - "bitflags 1.3.2", - "memchr", - "unicase", -] - [[package]] name = "quote" version = "1.0.33" @@ -181,6 +138,36 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha", + "rand_core", +] + +[[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", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom", +] + [[package]] name = "ryu" version = "1.0.15" @@ -189,24 +176,24 @@ checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" [[package]] name = "semver" -version = "1.0.18" +version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0293b4b29daaf487284529cc2f5675b8e57c61f70167ba415a463651fd6a918" +checksum = "836fa6a3e1e547f9a2c4040802ec865b5d85f4014efe00555d7090a3dcaa1090" [[package]] name = "serde" -version = "1.0.188" +version = "1.0.191" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf9e0fcba69a370eed61bcf2b728575f726b50b55cba78064753d708ddc7549e" +checksum = "a834c4821019838224821468552240d4d95d14e751986442c816572d39a080c9" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.188" +version = "1.0.191" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2" +checksum = "46fa52d5646bce91b680189fe5b1c049d2ea38dabb4e2e7c8d00ca12cfbfbcfd" dependencies = [ "proc-macro2", "quote", @@ -215,9 +202,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.105" +version = "1.0.108" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "693151e1ac27563d6dbcec9dee9fbd5da8539b20fa14ad3752b2e6d363ace360" +checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b" dependencies = [ "itoa", "ryu", @@ -226,9 +213,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.11.0" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9" +checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a" [[package]] name = "spdx" @@ -241,59 +228,20 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.31" +version = "2.0.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "718fa2415bcb8d8bd775917a1bf12a7931b6dfa890753378538118181e0cb398" +checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a" dependencies = [ "proc-macro2", "quote", "unicode-ident", ] -[[package]] -name = "tinyvec" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" -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 = "unicase" -version = "2.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7d2d4dafb69621809a81864c9c1b864479e1235c0dd4e199924b9742439ed89" -dependencies = [ - "version_check", -] - -[[package]] -name = "unicode-bidi" -version = "0.3.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" - [[package]] name = "unicode-ident" -version = "1.0.11" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" - -[[package]] -name = "unicode-normalization" -version = "0.1.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" -dependencies = [ - "tinyvec", -] +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "unicode-segmentation" @@ -308,40 +256,41 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" [[package]] -name = "url" -version = "2.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "143b538f18257fac9cad154828a57c6bf5157e1aa604d4816b5995bf6de87ae5" +name = "uqbar_process_lib" +version = "0.2.0" dependencies = [ - "form_urlencoded", - "idna", - "percent-encoding", + "anyhow", + "bincode", + "rand", + "serde", + "wit-bindgen", ] [[package]] -name = "version_check" -version = "0.9.4" +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-encoder" -version = "0.32.0" +version = "0.36.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ba64e81215916eaeb48fee292f29401d69235d62d8b8fd92a7b2844ec5ae5f7" +checksum = "822b645bf4f2446b949776ffca47e2af60b167209ffb70814ef8779d299cd421" dependencies = [ "leb128", ] [[package]] name = "wasm-metadata" -version = "0.10.3" +version = "0.10.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08dc59d1fa569150851542143ca79438ca56845ccb31696c70225c638e063471" +checksum = "2167ce53b2faa16a92c6cafd4942cff16c9a4fa0c5a5a0a41131ee4e49fc055f" dependencies = [ "anyhow", "indexmap", "serde", + "serde_derive", "serde_json", "spdx", "wasm-encoder", @@ -350,9 +299,9 @@ dependencies = [ [[package]] name = "wasmparser" -version = "0.112.0" +version = "0.116.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e986b010f47fcce49cf8ea5d5f9e5d2737832f12b53ae8ae785bbe895d0877bf" +checksum = "a58e28b80dd8340cb07b8242ae654756161f6fc8d0038123d679b7b99964fa50" dependencies = [ "indexmap", "semver", @@ -360,19 +309,17 @@ dependencies = [ [[package]] name = "wit-bindgen" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8a3e8e965dc50e6eb4410d9a11720719fadc6a1713803ea5f3be390b81c8279" +version = "0.13.1" +source = "git+https://github.com/bytecodealliance/wit-bindgen?rev=5390bab780733f1660d14c254ec985df2816bf1d#5390bab780733f1660d14c254ec985df2816bf1d" dependencies = [ - "bitflags 2.4.0", + "bitflags", "wit-bindgen-rust-macro", ] [[package]] name = "wit-bindgen-core" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77255512565dfbd0b61de466e854918041d1da53c7bc049d6188c6e02643dc1e" +version = "0.13.1" +source = "git+https://github.com/bytecodealliance/wit-bindgen?rev=5390bab780733f1660d14c254ec985df2816bf1d#5390bab780733f1660d14c254ec985df2816bf1d" dependencies = [ "anyhow", "wit-component", @@ -381,54 +328,42 @@ dependencies = [ [[package]] name = "wit-bindgen-rust" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "399c60e6ea8598d1380e792f13d557007834f0fb799fea6503408cbc5debb4ae" +version = "0.13.2" +source = "git+https://github.com/bytecodealliance/wit-bindgen?rev=5390bab780733f1660d14c254ec985df2816bf1d#5390bab780733f1660d14c254ec985df2816bf1d" dependencies = [ "anyhow", "heck", "wasm-metadata", "wit-bindgen-core", - "wit-bindgen-rust-lib", "wit-component", ] -[[package]] -name = "wit-bindgen-rust-lib" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd9fb7a43c7dc28b0b727d6ae01bf369981229b7539e768fba2b7a4df13feeeb" -dependencies = [ - "heck", - "wit-bindgen-core", -] - [[package]] name = "wit-bindgen-rust-macro" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44cea5ed784da06da0e55836a6c160e7502dbe28771c2368a595e8606243bf22" +version = "0.13.1" +source = "git+https://github.com/bytecodealliance/wit-bindgen?rev=5390bab780733f1660d14c254ec985df2816bf1d#5390bab780733f1660d14c254ec985df2816bf1d" dependencies = [ "anyhow", "proc-macro2", + "quote", "syn", "wit-bindgen-core", "wit-bindgen-rust", - "wit-bindgen-rust-lib", "wit-component", ] [[package]] name = "wit-component" -version = "0.14.0" +version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66d9f2d16dd55d1a372dcfd4b7a466ea876682a5a3cb97e71ec9eef04affa876" +checksum = "480cc1a078b305c1b8510f7c455c76cbd008ee49935f3a6c5fd5e937d8d95b1e" dependencies = [ "anyhow", - "bitflags 2.4.0", + "bitflags", "indexmap", "log", "serde", + "serde_derive", "serde_json", "wasm-encoder", "wasm-metadata", @@ -438,16 +373,17 @@ dependencies = [ [[package]] name = "wit-parser" -version = "0.11.0" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61e8b849bea13cc2315426b16efe6eb6813466d78f5fde69b0bb150c9c40e0dc" +checksum = "43771ee863a16ec4ecf9da0fc65c3bbd4a1235c8e3da5f094b562894843dfa76" dependencies = [ "anyhow", "id-arena", "indexmap", "log", - "pulldown-cmark", "semver", + "serde", + "serde_derive", + "serde_json", "unicode-xid", - "url", ] diff --git a/modules/http_proxy/Cargo.toml b/modules/http_proxy/Cargo.toml index 1d78d2ce..08aa21dc 100644 --- a/modules/http_proxy/Cargo.toml +++ b/modules/http_proxy/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "http_proxy" -version = "0.1.0" +version = "0.2.0" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html @@ -11,20 +11,15 @@ opt-level = "s" lto = true [dependencies] -anyhow = "1.0.72" +anyhow = "1.0" bincode = "1.3.3" -cargo-component-bindings = { git = "https://github.com/bytecodealliance/cargo-component" } serde = {version = "1.0", features = ["derive"] } serde_json = "1.0" -wit-bindgen = { version = "0.11.0", default_features = false } +wit-bindgen = { git = "https://github.com/bytecodealliance/wit-bindgen", rev = "5390bab780733f1660d14c254ec985df2816bf1d" } +uqbar_process_lib = { path = "../../process_lib" } [lib] crate-type = ["cdylib"] [package.metadata.component] -package = "component:uq-process" - -[package.metadata.component.target] -path = "wit" - -[package.metadata.component.dependencies] +package = "uqbar:process" diff --git a/modules/http_proxy/src/lib.rs b/modules/http_proxy/src/lib.rs index 289bbad4..bba2e600 100644 --- a/modules/http_proxy/src/lib.rs +++ b/modules/http_proxy/src/lib.rs @@ -1,42 +1,60 @@ -cargo_component_bindings::generate!(); - -use serde::{Deserialize, Serialize}; use serde_json::json; use std::collections::HashMap; - -use bindings::component::uq_process::types::*; -use bindings::{ - get_payload, print_to_terminal, receive, send_request, send_requests, send_response, Guest, +use uqbar_process_lib::{ + get_payload, receive, println, Address, Message, Payload, Request, Response, }; -#[allow(dead_code)] -mod process_lib; +wit_bindgen::generate!({ + path: "../../wit", + world: "process", + exports: { + world: Component, + }, +}); + +struct Component; +impl Guest for Component { + fn init(our: String) { + let our = Address::from_str(&our).unwrap(); + //print_to_terminal(1, "http_proxy: start"); + + match main(our) { + Ok(_) => {} + Err(e) => { + println!("http_proxy: ended with error: {:?}", e); + } + } + } +} const PROXY_HOME_PAGE: &str = include_str!("http_proxy.html"); -struct Component; - -fn send_http_response(status: u16, headers: HashMap, payload_bytes: Vec) { - send_response( - &Response { - inherit: false, - ipc: serde_json::json!({ - "status": status, - "headers": headers, - }) - .to_string() - .as_bytes() - .to_vec(), - metadata: None, - }, - Some(&Payload { - mime: Some("text/html".to_string()), - bytes: payload_bytes, - }), - ) +fn serialize_json_message(message: &serde_json::Value) -> anyhow::Result> { + Ok(serde_json::to_vec(message)?) } -fn send_not_found() { +fn send_http_response( + status: u16, + headers: HashMap, + payload_bytes: Vec, +) -> anyhow::Result<()> { + Response::new() + .ipc( + &json!({ + "status": status, + "headers": headers, + }), + serialize_json_message, + )? + .payload(Payload { + mime: Some("text/html".to_string()), + bytes: payload_bytes, + }) + .send()?; + Ok(()) +} + +fn send_not_found() -> anyhow::Result<()> { send_http_response( 404, HashMap::new(), @@ -44,359 +62,232 @@ fn send_not_found() { ) } -impl Guest for Component { - fn init(our: Address) { - print_to_terminal(1, "http_proxy: start"); +fn main(our: Address) -> anyhow::Result<()> { + let mut registrations: HashMap = HashMap::new(); - let mut registrations: HashMap = HashMap::new(); + // bind to all of our favorite paths + for path in ["/", "/static/*", "/list", "/register", "/serve/:username/*"] { + Request::new() + .ipc( + &json!({ + "BindPath": { + "path": path, + "authenticated": true, + "local_only": false + } + }), + serialize_json_message, + )? + .send()?; + } - let bindings_address = Address { - node: our.node.clone(), - process: ProcessId::from_str("http_server:sys:uqbar").unwrap(), + loop { + let Ok((_source, message)) = receive() else { + //print_to_terminal(0, "http_proxy: got network error"); + let mut headers = HashMap::new(); + headers.insert("Content-Type".to_string(), "text/html".to_string()); + send_http_response( + 503, + headers, + format!("

Node Offline

").as_bytes().to_vec(), + )?; + continue; + }; + let Message::Request(request) = message else { + println!("http_proxy: got unexpected message"); + continue; }; - // , option> - let http_endpoint_binding_requests: [(Address, Request, Option, Option); - 5] = [ - ( - bindings_address.clone(), - Request { - inherit: false, - expects_response: None, - ipc: json!({ - "BindPath": { - "path": "/", - "authenticated": true, - "local_only": false - } - }) - .to_string() - .as_bytes() - .to_vec(), - metadata: None, - }, - None, - None, - ), - ( - bindings_address.clone(), - Request { - inherit: false, - expects_response: None, - ipc: json!({ - "BindPath": { - "path": "/static/*", - "authenticated": true, - "local_only": false - } - }) - .to_string() - .as_bytes() - .to_vec(), - metadata: None, - }, - None, - None, - ), - ( - bindings_address.clone(), - Request { - inherit: false, - expects_response: None, - ipc: json!({ - "BindPath": { - "path": "/list", - "authenticated": true, - "local_only": false - } - }) - .to_string() - .as_bytes() - .to_vec(), - metadata: None, - }, - None, - None, - ), - ( - bindings_address.clone(), - Request { - inherit: false, - expects_response: None, - ipc: json!({ - "BindPath": { - "path": "/register", - "authenticated": true, - "local_only": false - } - }) - .to_string() - .as_bytes() - .to_vec(), - metadata: None, - }, - None, - None, - ), - ( - bindings_address.clone(), - Request { - inherit: false, - expects_response: None, - ipc: json!({ - "BindPath": { - "path": "/serve/:username/*", - "authenticated": true, - "local_only": false - } - }) - .to_string() - .as_bytes() - .to_vec(), - metadata: None, - }, - None, - None, - ), - ]; - send_requests(&http_endpoint_binding_requests); - - loop { - let Ok((_source, message)) = receive() else { - print_to_terminal(0, "http_proxy: got network error"); - let mut headers = HashMap::new(); - headers.insert("Content-Type".to_string(), "text/html".to_string()); - send_http_response(503, headers, format!("

Node Offline

").as_bytes().to_vec()); + let message_json: serde_json::Value = match serde_json::from_slice(&request.ipc) { + Ok(v) => v, + Err(_) => { + //print_to_terminal(1, "http_proxy: failed to parse ipc JSON, skipping"); continue; - }; - let Message::Request(request) = message else { - print_to_terminal(0, "http_proxy: got unexpected message"); - continue; - }; - - let message_json: serde_json::Value = match serde_json::from_slice(&request.ipc) { - Ok(v) => v, - Err(_) => { - print_to_terminal(1, "http_proxy: failed to parse ipc JSON, skipping"); - continue; - } - }; - - print_to_terminal( - 1, - format!("http_proxy: got request: {}", message_json).as_str(), - ); - - if message_json["path"] == "/" && message_json["method"] == "GET" { - send_response( - &Response { - inherit: false, - ipc: serde_json::json!({ - "action": "response", - "status": 200, - "headers": { - "Content-Type": "text/html", - }, - }) - .to_string() - .as_bytes() - .to_vec(), - metadata: None, - }, - Some(&Payload { - mime: Some("text/html".to_string()), - bytes: PROXY_HOME_PAGE - .replace("${our}", &our.node) - .as_bytes() - .to_vec(), - }), - ); - } else if message_json["path"] == "/list" && message_json["method"] == "GET" { - send_response( - &Response { - inherit: false, - ipc: serde_json::json!({ - "action": "response", - "status": 200, - "headers": { - "Content-Type": "application/json", - }, - }) - .to_string() - .as_bytes() - .to_vec(), - metadata: None, - }, - Some(&Payload { - mime: Some("application/json".to_string()), - bytes: serde_json::json!({"registrations": registrations}) - .to_string() - .as_bytes() - .to_vec(), - }), - ); - } else if message_json["path"] == "/register" && message_json["method"] == "POST" { - let mut status = 204; - - let Some(payload) = get_payload() else { - print_to_terminal(1, "/register POST with no bytes"); - continue; - }; - - let body: serde_json::Value = match serde_json::from_slice(&payload.bytes) { - Ok(s) => s, - Err(e) => { - print_to_terminal(1, format!("Bad body format: {}", e).as_str()); - continue; - } - }; - - let username = body["username"].as_str().unwrap_or(""); - - print_to_terminal(1, format!("Register proxy for: {}", username).as_str()); - - if !username.is_empty() { - registrations.insert(username.to_string(), "foo".to_string()); - } else { - status = 400; - } - - send_response( - &Response { - inherit: false, - ipc: serde_json::json!({ - "action": "response", - "status": status, - "headers": { - "Content-Type": "text/html", - }, - }) - .to_string() - .as_bytes() - .to_vec(), - metadata: None, - }, - Some(&Payload { - mime: Some("text/html".to_string()), - bytes: (if status == 400 { - "Bad Request" - } else { - "Success" - }) - .to_string() - .as_bytes() - .to_vec(), - }), - ); - } else if message_json["path"] == "/register" && message_json["method"] == "DELETE" { - print_to_terminal(1, "HERE IN /register to delete something"); - let username = message_json["query_params"]["username"] - .as_str() - .unwrap_or(""); - - let mut status = 204; - - if !username.is_empty() { - registrations.remove(username); - } else { - status = 400; - } - - send_response( - &Response { - inherit: false, - ipc: serde_json::json!({ - "action": "response", - "status": status, - "headers": { - "Content-Type": "text/html", - }, - }) - .to_string() - .as_bytes() - .to_vec(), - metadata: None, - }, - Some(&Payload { - mime: Some("text/html".to_string()), - bytes: (if status == 400 { - "Bad Request" - } else { - "Success" - }) - .to_string() - .as_bytes() - .to_vec(), - }), - ); - } else if message_json["path"] == "/serve/:username/*" { - let username = message_json["url_params"]["username"] - .as_str() - .unwrap_or(""); - let raw_path = message_json["raw_path"].as_str().unwrap_or(""); - print_to_terminal(1, format!("proxy for user: {}", username).as_str()); - - if username.is_empty() || raw_path.is_empty() { - send_not_found(); - } else if !registrations.contains_key(username) { - send_response( - &Response { - inherit: false, - ipc: json!({ - "action": "response", - "status": 403, - "headers": { - "Content-Type": "text/html", - }, - }) - .to_string() - .as_bytes() - .to_vec(), - metadata: None, - }, - Some(&Payload { - mime: Some("text/html".to_string()), - bytes: "Not Authorized".to_string().as_bytes().to_vec(), - }), - ); - } else { - let path_parts: Vec<&str> = raw_path.split('/').collect(); - let mut proxied_path = "/".to_string(); - - if let Some(pos) = path_parts.iter().position(|&x| x == "serve") { - proxied_path = format!("/{}", path_parts[pos + 2..].join("/")); - print_to_terminal(1, format!("Path to proxy: {}", proxied_path).as_str()); - } - - let payload = get_payload(); - - send_request( - &Address { - node: username.into(), - process: ProcessId::from_str("http_server:sys:uqbar").unwrap(), - }, - &Request { - inherit: true, - expects_response: None, - ipc: json!({ - "method": message_json["method"], - "path": proxied_path, - "headers": message_json["headers"], - "proxy_path": raw_path, - "query_params": message_json["query_params"], - }) - .to_string() - .as_bytes() - .to_vec(), - metadata: None, - }, - None, - payload.as_ref(), - ); - } - } else { - send_not_found(); } + }; + + //print_to_terminal( + // 1, + // format!("http_proxy: got request: {}", message_json).as_str(), + //); + + if message_json["path"] == "/" && message_json["method"] == "GET" { + Response::new() + .ipc( + &json!({ + "action": "response", + "status": 200, + "headers": { + "Content-Type": "text/html", + }, + }), + serialize_json_message, + )? + .payload(Payload { + mime: Some("text/html".to_string()), + bytes: PROXY_HOME_PAGE + .replace("${our}", &our.node) + .as_bytes() + .to_vec(), + }) + .send()?; + } else if message_json["path"] == "/list" && message_json["method"] == "GET" { + Response::new() + .ipc( + &json!({ + "action": "response", + "status": 200, + "headers": { + "Content-Type": "application/json", + }, + }), + serialize_json_message, + )? + .payload(Payload { + mime: Some("application/json".to_string()), + bytes: serde_json::json!({"registrations": registrations}) + .to_string() + .as_bytes() + .to_vec(), + }) + .send()?; + } else if message_json["path"] == "/register" && message_json["method"] == "POST" { + let mut status = 204; + + let Some(payload) = get_payload() else { + //print_to_terminal(1, "/register POST with no bytes"); + continue; + }; + + let body: serde_json::Value = match serde_json::from_slice(&payload.bytes) { + Ok(s) => s, + Err(e) => { + //print_to_terminal(1, format!("Bad body format: {}", e).as_str()); + continue; + } + }; + + let username = body["username"].as_str().unwrap_or(""); + + //print_to_terminal(1, format!("Register proxy for: {}", username).as_str()); + + if !username.is_empty() { + registrations.insert(username.to_string(), "foo".to_string()); + } else { + status = 400; + } + + Response::new() + .ipc( + &json!({ + "action": "response", + "status": 200, + "headers": { + "Content-Type": "text/html", + }, + }), + serialize_json_message, + )? + .payload(Payload { + mime: Some("text/html".to_string()), + bytes: (if status == 400 { + "Bad Request" + } else { + "Success" + }) + .to_string() + .as_bytes() + .to_vec(), + }) + .send()?; + } else if message_json["path"] == "/register" && message_json["method"] == "DELETE" { + //print_to_terminal(1, "HERE IN /register to delete something"); + let username = message_json["query_params"]["username"] + .as_str() + .unwrap_or(""); + + let mut status = 204; + + if !username.is_empty() { + registrations.remove(username); + } else { + status = 400; + } + + Response::new() + .ipc( + &json!({ + "action": "response", + "status": status, + "headers": { + "Content-Type": "text/html", + }, + }), + serialize_json_message, + )? + .payload(Payload { + mime: Some("text/html".to_string()), + bytes: (if status == 400 { + "Bad Request" + } else { + "Success" + }) + .to_string() + .as_bytes() + .to_vec(), + }) + .send()?; + } else if message_json["path"] == "/serve/:username/*" { + let username = message_json["url_params"]["username"] + .as_str() + .unwrap_or(""); + let raw_path = message_json["raw_path"].as_str().unwrap_or(""); + //print_to_terminal(1, format!("proxy for user: {}", username).as_str()); + + if username.is_empty() || raw_path.is_empty() { + send_not_found()?; + } else if !registrations.contains_key(username) { + Response::new() + .ipc( + &json!({ + "action": "response", + "status": 403, + "headers": { + "Content-Type": "text/html", + }, + }), + serialize_json_message, + )? + .payload(Payload { + mime: Some("text/html".to_string()), + bytes: "Not Authorized".to_string().as_bytes().to_vec(), + }) + .send()?; + } else { + let path_parts: Vec<&str> = raw_path.split('/').collect(); + let mut proxied_path = "/".to_string(); + + if let Some(pos) = path_parts.iter().position(|&x| x == "serve") { + proxied_path = format!("/{}", path_parts[pos + 2..].join("/")); + //print_to_terminal(1, format!("Path to proxy: {}", proxied_path).as_str()); + } + + Request::new() + .inherit(true) + .ipc( + &json!({ + "method": message_json["method"], + "path": proxied_path, + "headers": message_json["headers"], + "proxy_path": raw_path, + "query_params": message_json["query_params"], + }), + serialize_json_message, + )? + .send()?; + } + } else { + send_not_found()?; } } } diff --git a/modules/http_proxy/src/process_lib.rs b/modules/http_proxy/src/process_lib.rs deleted file mode 120000 index 77367fe0..00000000 --- a/modules/http_proxy/src/process_lib.rs +++ /dev/null @@ -1 +0,0 @@ -../../../src/process_lib.rs \ No newline at end of file diff --git a/modules/qns_indexer/Cargo.lock b/modules/qns_indexer/Cargo.lock index fc26bb2c..61c5340a 100644 --- a/modules/qns_indexer/Cargo.lock +++ b/modules/qns_indexer/Cargo.lock @@ -113,12 +113,6 @@ version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" -[[package]] -name = "byteorder" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" - [[package]] name = "bytes" version = "1.5.0" @@ -369,7 +363,6 @@ dependencies = [ "anyhow", "bincode", "hex", - "rmp-serde", "serde", "serde_json", "uqbar_process_lib", @@ -445,28 +438,6 @@ version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da" -[[package]] -name = "rmp" -version = "0.8.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f9860a6cc38ed1da53456442089b4dfa35e7cedaa326df63017af88385e6b20" -dependencies = [ - "byteorder", - "num-traits", - "paste", -] - -[[package]] -name = "rmp-serde" -version = "1.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bffea85eea980d8a74453e5d02a8d93028f3c34725de143085a844ebe953258a" -dependencies = [ - "byteorder", - "rmp", - "serde", -] - [[package]] name = "ruint" version = "1.11.0" @@ -535,18 +506,18 @@ checksum = "836fa6a3e1e547f9a2c4040802ec865b5d85f4014efe00555d7090a3dcaa1090" [[package]] name = "serde" -version = "1.0.190" +version = "1.0.191" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91d3c334ca1ee894a2c6f6ad698fe8c435b76d504b13d436f0685d648d6d96f7" +checksum = "a834c4821019838224821468552240d4d95d14e751986442c816572d39a080c9" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.190" +version = "1.0.191" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67c5609f394e5c2bd7fc51efda478004ea80ef42fee983d5c67a65e34f32c0e3" +checksum = "46fa52d5646bce91b680189fe5b1c049d2ea38dabb4e2e7c8d00ca12cfbfbcfd" dependencies = [ "proc-macro2", "quote", @@ -702,18 +673,18 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-encoder" -version = "0.36.1" +version = "0.36.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53ae0be20bf87918df4fa831bfbbd0b491d24aee407ed86360eae4c2c5608d38" +checksum = "822b645bf4f2446b949776ffca47e2af60b167209ffb70814ef8779d299cd421" dependencies = [ "leb128", ] [[package]] name = "wasm-metadata" -version = "0.10.10" +version = "0.10.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5621910462c61a8efc3248fdfb1739bf649bb335b0df935c27b340418105f9d8" +checksum = "2167ce53b2faa16a92c6cafd4942cff16c9a4fa0c5a5a0a41131ee4e49fc055f" dependencies = [ "anyhow", "indexmap", @@ -727,9 +698,9 @@ dependencies = [ [[package]] name = "wasmparser" -version = "0.116.0" +version = "0.116.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53290b1276c5c2d47d694fb1a920538c01f51690e7e261acbe1d10c5fc306ea1" +checksum = "a58e28b80dd8340cb07b8242ae654756161f6fc8d0038123d679b7b99964fa50" dependencies = [ "indexmap", "semver", @@ -804,7 +775,7 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "wit-bindgen" version = "0.13.1" -source = "git+https://github.com/bytecodealliance/wit-bindgen#23e0c1463f31cb53fb390a7c744a3ced282a579a" +source = "git+https://github.com/bytecodealliance/wit-bindgen?rev=5390bab780733f1660d14c254ec985df2816bf1d#5390bab780733f1660d14c254ec985df2816bf1d" dependencies = [ "bitflags 2.4.1", "wit-bindgen-rust-macro", @@ -813,7 +784,7 @@ dependencies = [ [[package]] name = "wit-bindgen-core" version = "0.13.1" -source = "git+https://github.com/bytecodealliance/wit-bindgen#23e0c1463f31cb53fb390a7c744a3ced282a579a" +source = "git+https://github.com/bytecodealliance/wit-bindgen?rev=5390bab780733f1660d14c254ec985df2816bf1d#5390bab780733f1660d14c254ec985df2816bf1d" dependencies = [ "anyhow", "wit-component", @@ -823,7 +794,7 @@ dependencies = [ [[package]] name = "wit-bindgen-rust" version = "0.13.2" -source = "git+https://github.com/bytecodealliance/wit-bindgen#23e0c1463f31cb53fb390a7c744a3ced282a579a" +source = "git+https://github.com/bytecodealliance/wit-bindgen?rev=5390bab780733f1660d14c254ec985df2816bf1d#5390bab780733f1660d14c254ec985df2816bf1d" dependencies = [ "anyhow", "heck", @@ -835,7 +806,7 @@ dependencies = [ [[package]] name = "wit-bindgen-rust-macro" version = "0.13.1" -source = "git+https://github.com/bytecodealliance/wit-bindgen#23e0c1463f31cb53fb390a7c744a3ced282a579a" +source = "git+https://github.com/bytecodealliance/wit-bindgen?rev=5390bab780733f1660d14c254ec985df2816bf1d#5390bab780733f1660d14c254ec985df2816bf1d" dependencies = [ "anyhow", "proc-macro2", diff --git a/modules/qns_indexer/Cargo.toml b/modules/qns_indexer/Cargo.toml index 66d522a8..aa3d610c 100644 --- a/modules/qns_indexer/Cargo.toml +++ b/modules/qns_indexer/Cargo.toml @@ -18,7 +18,7 @@ bincode = "1.3.3" hex = "0.4.3" serde = {version = "1.0", features = ["derive"] } serde_json = "1.0" -wit-bindgen = { git = "https://github.com/bytecodealliance/wit-bindgen", version = "0.13.0" } +wit-bindgen = { git = "https://github.com/bytecodealliance/wit-bindgen", rev = "5390bab780733f1660d14c254ec985df2816bf1d" } uqbar_process_lib = { path = "../../process_lib" } [lib] diff --git a/modules/terminal/Cargo.lock b/modules/terminal/Cargo.lock index 53004782..953667c4 100644 --- a/modules/terminal/Cargo.lock +++ b/modules/terminal/Cargo.lock @@ -263,7 +263,6 @@ dependencies = [ "bincode", "rand", "serde", - "serde_json", "wit-bindgen", ] @@ -311,7 +310,7 @@ dependencies = [ [[package]] name = "wit-bindgen" version = "0.13.1" -source = "git+https://github.com/bytecodealliance/wit-bindgen#5390bab780733f1660d14c254ec985df2816bf1d" +source = "git+https://github.com/bytecodealliance/wit-bindgen?rev=5390bab780733f1660d14c254ec985df2816bf1d#5390bab780733f1660d14c254ec985df2816bf1d" dependencies = [ "bitflags", "wit-bindgen-rust-macro", @@ -320,7 +319,7 @@ dependencies = [ [[package]] name = "wit-bindgen-core" version = "0.13.1" -source = "git+https://github.com/bytecodealliance/wit-bindgen#5390bab780733f1660d14c254ec985df2816bf1d" +source = "git+https://github.com/bytecodealliance/wit-bindgen?rev=5390bab780733f1660d14c254ec985df2816bf1d#5390bab780733f1660d14c254ec985df2816bf1d" dependencies = [ "anyhow", "wit-component", @@ -330,7 +329,7 @@ dependencies = [ [[package]] name = "wit-bindgen-rust" version = "0.13.2" -source = "git+https://github.com/bytecodealliance/wit-bindgen#5390bab780733f1660d14c254ec985df2816bf1d" +source = "git+https://github.com/bytecodealliance/wit-bindgen?rev=5390bab780733f1660d14c254ec985df2816bf1d#5390bab780733f1660d14c254ec985df2816bf1d" dependencies = [ "anyhow", "heck", @@ -342,7 +341,7 @@ dependencies = [ [[package]] name = "wit-bindgen-rust-macro" version = "0.13.1" -source = "git+https://github.com/bytecodealliance/wit-bindgen#5390bab780733f1660d14c254ec985df2816bf1d" +source = "git+https://github.com/bytecodealliance/wit-bindgen?rev=5390bab780733f1660d14c254ec985df2816bf1d#5390bab780733f1660d14c254ec985df2816bf1d" dependencies = [ "anyhow", "proc-macro2", diff --git a/modules/terminal/Cargo.toml b/modules/terminal/Cargo.toml index 2796524d..1d268d17 100644 --- a/modules/terminal/Cargo.toml +++ b/modules/terminal/Cargo.toml @@ -15,7 +15,7 @@ anyhow = "1.0" bincode = "1.3.3" serde = {version = "1.0", features = ["derive"] } serde_json = "1.0" -wit-bindgen = { git = "https://github.com/bytecodealliance/wit-bindgen", version = "0.13.0" } +wit-bindgen = { git = "https://github.com/bytecodealliance/wit-bindgen", rev = "5390bab780733f1660d14c254ec985df2816bf1d" } uqbar_process_lib = { path = "../../process_lib" } [lib] diff --git a/process_lib/Cargo.toml b/process_lib/Cargo.toml index 5627e3a1..bd6e3cbb 100644 --- a/process_lib/Cargo.toml +++ b/process_lib/Cargo.toml @@ -8,4 +8,4 @@ anyhow = "1.0" bincode = "1.3.3" serde = {version = "1.0", features = ["derive"] } rand = "0.8" -wit-bindgen = { git = "https://github.com/bytecodealliance/wit-bindgen", version = "0.13.0" } +wit-bindgen = { git = "https://github.com/bytecodealliance/wit-bindgen", rev = "5390bab780733f1660d14c254ec985df2816bf1d" } diff --git a/src/kernel/mod.rs b/src/kernel/mod.rs index f4f5fc9e..68fc3ce1 100644 --- a/src/kernel/mod.rs +++ b/src/kernel/mod.rs @@ -1113,8 +1113,8 @@ async fn make_process_loop( let mut linker = Linker::new(&engine); Process::add_to_linker(&mut linker, |state: &mut ProcessWasi| state).unwrap(); - let mut table = Table::new(); - let wasi = WasiCtxBuilder::new().build(&mut table).unwrap(); + let table = Table::new(); + let wasi = WasiCtxBuilder::new().build(); // (&mut table).unwrap(); wasmtime_wasi::preview2::command::add_to_linker(&mut linker).unwrap(); // wasmtime_wasi::preview2::bindings::clocks::wall_clock::add_to_linker(&mut linker, |t| t) diff --git a/wasi_snapshot_preview1.wasm b/wasi_snapshot_preview1.wasm index 87e85057..9b621b98 100644 Binary files a/wasi_snapshot_preview1.wasm and b/wasi_snapshot_preview1.wasm differ diff --git a/wit/uqbar.wit b/wit/uqbar.wit index 821848db..1ed0a1f1 100644 --- a/wit/uqbar.wit +++ b/wit/uqbar.wit @@ -1,16 +1,16 @@ -package uqbar:process@0.3.0 +package uqbar:process@0.4.0; interface standard { // JSON is passed over WASM boundary as a string. - type json = string + type json = string; - type node-id = string + type node-id = string; // context, like ipc, is a protocol-defined serialized byte array. // it is used when building a Request to save information // that will not be part of a Response, in order to more // easily handle ("contextualize") that Response. - type context = list + type context = list; record process-id { process-name: string, @@ -102,20 +102,20 @@ interface standard { } // system utils: - print-to-terminal: func(verbosity: u8, message: string) + print-to-terminal: func(verbosity: u8, message: string); // **more will be added here with regard to blockchains** - get-eth-block: func() -> u64 + get-eth-block: func() -> u64; // process management: - set-on-panic: func(on-panic: on-panic) + set-on-panic: func(on-panic: on-panic); - get-state: func() -> option> + get-state: func() -> option>; - set-state: func(bytes: list) + set-state: func(bytes: list); - clear-state: func() + clear-state: func(); spawn: func( name: option, @@ -123,64 +123,66 @@ interface standard { on-panic: on-panic, capabilities: capabilities, public: bool - ) -> result + ) -> result; // capabilities management // gives us all our signed capabilities so we can send them to others - get-capabilities: func() -> list + get-capabilities: func() -> list; // gets a single specific capability - get-capability: func(issuer: address, params: json) -> option + get-capability: func(issuer: address, params: json) -> option; // attaches a specific signed capability to our next message - attach-capability: func(capability: signed-capability) + attach-capability: func(capability: signed-capability); // saves capabilities to our store, so we can use them - save-capabilities: func(capabilities: list) + save-capabilities: func(capabilities: list); // check to see if the sender of a prompting message has a given capability, issued by us // if the prompting message has a remote source, they must have attached it. - has-capability: func(params: json) -> bool + has-capability: func(params: json) -> bool; // generates a new capability with our process as the issuer and gives it to the target, // which must be a locally-running process. - create-capability: func(to: process-id, params: json) + create-capability: func(to: process-id, params: json); // take a signed capability and save it to a given locally-running process - share-capability: func(to: process-id, capability: signed-capability) + share-capability: func(to: process-id, capability: signed-capability); // message I/O: // ingest next message when it arrives along with its source. // almost all long-running processes will call this in a loop - receive: func() -> result, tuple>> + receive: func() -> result, tuple>>; // gets payload, if any, of the message we just received - get-payload: func() -> option + get-payload: func() -> option; // send message(s) to target(s) send-request: - func(target: address, request: request, context: option, payload: option) + func(target: address, request: request, context: option, payload: option); + send-requests: - func(requests: list, option>>) + func(requests: list, option>>); + send-response: - func(response: response, payload: option) + func(response: response, payload: option); // send a single request, then block (internally) until its response // the type is Message but will always contain Response send-and-await-response: func(target: address, request: request, payload: option) -> - result, send-error> + result, send-error>; } world lib { - import standard + import standard; } world process { - include lib + include lib; - export init: func(our: string) + export init: func(our: string); }