diff --git a/.cargo/config.toml b/.cargo/config.toml index b05ddc5..4e55162 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,8 +1,5 @@ [target.x86_64-unknown-linux-musl] linker = "clang" -[target.x86_64-unknown-linux-gnu] -linker = "clang" - [target.x86_64-unknown-freebsd] linker = "x86_64-unknown-freebsd-clang" diff --git a/Cargo.lock b/Cargo.lock index 33e030d..503507b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -26,6 +26,30 @@ dependencies = [ "memchr", ] +[[package]] +name = "android-tzdata" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" + +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + +[[package]] +name = "ansi_term" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" +dependencies = [ + "winapi", +] + [[package]] name = "any_spawner" version = "0.2.0" @@ -63,9 +87,15 @@ checksum = "3f934833b4b7233644e5848f235df3f57ed8c80f1528a26c3dfa13d2147fa056" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.96", ] +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + [[package]] name = "attribute-derive" version = "0.10.3" @@ -77,7 +107,7 @@ dependencies = [ "manyhow", "proc-macro2", "quote", - "syn", + "syn 2.0.96", ] [[package]] @@ -93,7 +123,18 @@ dependencies = [ "proc-macro2", "quote", "quote-use", - "syn", + "syn 2.0.96", +] + +[[package]] +name = "atty" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" +dependencies = [ + "hermit-abi 0.1.19", + "libc", + "winapi", ] [[package]] @@ -158,6 +199,26 @@ dependencies = [ "tracing", ] +[[package]] +name = "axum-server" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56bac90848f6a9393ac03c63c640925c4b7c8ca21654de40d53f55964667c7d8" +dependencies = [ + "bytes", + "futures-util", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-util", + "pin-project-lite", + "tokio", + "tokio-rustls", + "tower 0.4.13", + "tower-service", +] + [[package]] name = "backtrace" version = "0.3.74" @@ -185,7 +246,7 @@ version = "0.69.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "271383c67ccabffb7381723dea0672a673f292304fcb45c01cc648c7a8d58088" dependencies = [ - "bitflags", + "bitflags 2.8.0", "cexpr", "clang-sys", "itertools 0.12.1", @@ -198,10 +259,16 @@ dependencies = [ "regex", "rustc-hash 1.1.0", "shlex", - "syn", + "syn 2.0.96", "which", ] +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + [[package]] name = "bitflags" version = "2.8.0" @@ -256,6 +323,18 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +[[package]] +name = "chrono" +version = "0.4.39" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e36cc9d416881d2e24f9a963be5fb1cd90966419ac844274161d10488b3e825" +dependencies = [ + "android-tzdata", + "iana-time-zone", + "num-traits", + "windows-targets", +] + [[package]] name = "clang-sys" version = "1.8.1" @@ -267,6 +346,21 @@ dependencies = [ "libloading", ] +[[package]] +name = "clap" +version = "2.34.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c" +dependencies = [ + "ansi_term", + "atty", + "bitflags 1.3.2", + "strsim", + "textwrap", + "unicode-width", + "vec_map", +] + [[package]] name = "codee" version = "0.2.0" @@ -351,6 +445,12 @@ dependencies = [ "unicode-segmentation", ] +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + [[package]] name = "crossbeam-utils" version = "0.8.21" @@ -379,7 +479,7 @@ checksum = "62d671cc41a825ebabc75757b62d3d168c577f9149b2d49ece1dad1f72119d25" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.96", ] [[package]] @@ -390,7 +490,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.96", ] [[package]] @@ -532,7 +632,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.96", ] [[package]] @@ -628,6 +728,25 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "493913a18c0d7bebb75127a26a432162c59edbe06f6cf712001e3e769345e8b5" +[[package]] +name = "h2" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccae279728d634d083c00f6099cb58f01cc99c145b84b8be2f6c74618d79922e" +dependencies = [ + "atomic-waker", + "bytes", + "fnv", + "futures-core", + "futures-sink", + "http", + "indexmap", + "slab", + "tokio", + "tokio-util", + "tracing", +] + [[package]] name = "hashbrown" version = "0.14.5" @@ -640,6 +759,24 @@ version = "0.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" +[[package]] +name = "heck" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" +dependencies = [ + "unicode-segmentation", +] + +[[package]] +name = "hermit-abi" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" +dependencies = [ + "libc", +] + [[package]] name = "hermit-abi" version = "0.3.9" @@ -741,6 +878,7 @@ dependencies = [ "bytes", "futures-channel", "futures-util", + "h2", "http", "http-body", "httparse", @@ -767,6 +905,29 @@ dependencies = [ "tower-service", ] +[[package]] +name = "iana-time-zone" +version = "0.1.61" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "235e081f3925a06703c2d0117ea8b91f042756fd6e7a6e5d901e8ca1a996b220" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "wasm-bindgen", + "windows-core", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + [[package]] name = "icu_collections" version = "1.5.0" @@ -882,7 +1043,7 @@ checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.96", ] [[package]] @@ -1079,7 +1240,7 @@ dependencies = [ "quote", "rstml", "serde", - "syn", + "syn 2.0.96", "walkdir", ] @@ -1116,7 +1277,7 @@ dependencies = [ "quote", "rstml", "server_fn_macro", - "syn", + "syn 2.0.96", "uuid", ] @@ -1251,7 +1412,7 @@ dependencies = [ "manyhow-macros", "proc-macro2", "quote", - "syn", + "syn 2.0.96", ] [[package]] @@ -1265,6 +1426,15 @@ dependencies = [ "quote", ] +[[package]] +name = "matchers" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" +dependencies = [ + "regex-automata 0.1.10", +] + [[package]] name = "matchit" version = "0.7.3" @@ -1360,13 +1530,32 @@ dependencies = [ "minimal-lexical", ] +[[package]] +name = "nu-ansi-term" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" +dependencies = [ + "overload", + "winapi", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + [[package]] name = "num_cpus" version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" dependencies = [ - "hermit-abi", + "hermit-abi 0.3.9", "libc", ] @@ -1401,6 +1590,12 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8c04f5d74368e4d0dfe06c45c8627c81bd7c317d52762d118fb9b3076f6420fd" +[[package]] +name = "overload" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" + [[package]] name = "packets" version = "0.1.0" @@ -1481,7 +1676,7 @@ checksum = "d56a66c0c55993aa927429d0f8a0abfd74f084e4d9c192cffed01e418d83eefb" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.96", ] [[package]] @@ -1512,7 +1707,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6924ced06e1f7dfe3fa48d57b9f74f55d8915f5036121bef647ef4b204895fac" dependencies = [ "proc-macro2", - "syn", + "syn 2.0.96", ] [[package]] @@ -1524,6 +1719,7 @@ dependencies = [ "proc-macro-error-attr", "proc-macro2", "quote", + "syn 1.0.109", "version_check", ] @@ -1557,7 +1753,7 @@ dependencies = [ "proc-macro-error-attr2", "proc-macro2", "quote", - "syn", + "syn 2.0.96", ] [[package]] @@ -1588,7 +1784,7 @@ checksum = "af066a9c399a26e020ada66a034357a868728e72cd426f3adcd35f80d88d88c8" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.96", "version_check", "yansi", ] @@ -1621,7 +1817,7 @@ dependencies = [ "proc-macro-utils", "proc-macro2", "quote", - "syn", + "syn 2.0.96", ] [[package]] @@ -1700,7 +1896,7 @@ dependencies = [ "proc-macro-error2", "proc-macro2", "quote", - "syn", + "syn 2.0.96", ] [[package]] @@ -1709,7 +1905,7 @@ version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "03a862b389f93e68874fbf580b9de08dd02facb9a788ebadaf4a3fd33cf58834" dependencies = [ - "bitflags", + "bitflags 2.8.0", ] [[package]] @@ -1720,8 +1916,17 @@ checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" dependencies = [ "aho-corasick", "memchr", - "regex-automata", - "regex-syntax", + "regex-automata 0.4.9", + "regex-syntax 0.8.5", +] + +[[package]] +name = "regex-automata" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" +dependencies = [ + "regex-syntax 0.6.29", ] [[package]] @@ -1732,15 +1937,36 @@ checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" dependencies = [ "aho-corasick", "memchr", - "regex-syntax", + "regex-syntax 0.8.5", ] +[[package]] +name = "regex-syntax" +version = "0.6.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" + [[package]] name = "regex-syntax" version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" +[[package]] +name = "ring" +version = "0.17.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d" +dependencies = [ + "cc", + "cfg-if", + "getrandom", + "libc", + "spin", + "untrusted", + "windows-sys 0.52.0", +] + [[package]] name = "rstml" version = "0.12.0" @@ -1751,7 +1977,7 @@ dependencies = [ "proc-macro2", "proc-macro2-diagnostics", "quote", - "syn", + "syn 2.0.96", "syn_derive", "thiserror 1.0.69", ] @@ -1780,13 +2006,43 @@ version = "0.38.43" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a78891ee6bf2340288408954ac787aa063d8e8817e9f53abb37c695c6d834ef6" dependencies = [ - "bitflags", + "bitflags 2.8.0", "errno", "libc", "linux-raw-sys", "windows-sys 0.59.0", ] +[[package]] +name = "rustls" +version = "0.23.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f287924602bf649d949c63dc8ac8b235fa5387d394020705b80c4eb597ce5b8" +dependencies = [ + "once_cell", + "rustls-pki-types", + "rustls-webpki", + "subtle", + "zeroize", +] + +[[package]] +name = "rustls-pki-types" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2bf47e6ff922db3825eb750c4e2ff784c6ff8fb9e13046ef6a1d1c5401b0b37" + +[[package]] +name = "rustls-webpki" +version = "0.102.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64ca1bc8749bd4cf37b5ce386cc146580777b4e8572c7b97baf22c83f444bee9" +dependencies = [ + "ring", + "rustls-pki-types", + "untrusted", +] + [[package]] name = "rustversion" version = "1.0.19" @@ -1840,7 +2096,7 @@ checksum = "5a9bf7cf98d04a2b28aead066b7496853d4779c9cc183c440dbac457641e19a0" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.96", ] [[package]] @@ -1943,7 +2199,7 @@ dependencies = [ "convert_case", "proc-macro2", "quote", - "syn", + "syn 2.0.96", "xxhash-rust", ] @@ -1954,7 +2210,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f07dfd1744a5f5612f00f69fe035b0bfafdf12bb46d76e785673078a9e56b170" dependencies = [ "server_fn_macro", - "syn", + "syn 2.0.96", +] + +[[package]] +name = "sharded-slab" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" +dependencies = [ + "lazy_static", ] [[package]] @@ -2023,17 +2288,21 @@ version = "2.0.0" name = "sparse-server" version = "0.1.0" dependencies = [ + "anyhow", "axum", + "axum-server", "console_error_panic_hook", "http", "leptos", "leptos_axum", "leptos_meta", "leptos_router", + "structopt", "thiserror 1.0.69", "tokio", "tower 0.4.13", "tower-http 0.5.2", + "tracing-subscriber", "wasm-bindgen", ] @@ -2057,6 +2326,53 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" +[[package]] +name = "strsim" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" + +[[package]] +name = "structopt" +version = "0.3.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c6b5c64445ba8094a6ab0c3cd2ad323e07171012d9c98b0b15651daf1787a10" +dependencies = [ + "clap", + "lazy_static", + "structopt-derive", +] + +[[package]] +name = "structopt-derive" +version = "0.4.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcb5ae327f9cc13b68763b5749770cb9e048a99bd9dfdfa58d0cf05d5f64afe0" +dependencies = [ + "heck", + "proc-macro-error", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + [[package]] name = "syn" version = "2.0.96" @@ -2077,7 +2393,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn", + "syn 2.0.96", ] [[package]] @@ -2094,7 +2410,7 @@ checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.96", ] [[package]] @@ -2129,6 +2445,15 @@ dependencies = [ "web-sys", ] +[[package]] +name = "textwrap" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" +dependencies = [ + "unicode-width", +] + [[package]] name = "thiserror" version = "1.0.69" @@ -2155,7 +2480,7 @@ checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.96", ] [[package]] @@ -2166,7 +2491,17 @@ checksum = "26afc1baea8a989337eeb52b6e72a039780ce45c3edfcc9c5b9d112feeb173c2" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.96", +] + +[[package]] +name = "thread_local" +version = "1.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b9ef9bad013ada3808854ceac7b46812a6465ba368859a37e2100283d2d719c" +dependencies = [ + "cfg-if", + "once_cell", ] [[package]] @@ -2212,7 +2547,17 @@ checksum = "6e06d43f1345a3bcd39f6a56dbb7dcab2ba47e68e8ac134855e7e2bdbaf8cab8" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.96", +] + +[[package]] +name = "tokio-rustls" +version = "0.26.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f6d0975eaace0cf0fcadee4e4aaa5da15b5c079146f2cffb67c113be122bf37" +dependencies = [ + "rustls", + "tokio", ] [[package]] @@ -2279,6 +2624,10 @@ version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" dependencies = [ + "futures-core", + "futures-util", + "pin-project", + "pin-project-lite", "tower-layer", "tower-service", "tracing", @@ -2306,7 +2655,7 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e9cd434a998747dd2c4276bc96ee2e0c7a2eadf3cae88e52be55a05fa9053f5" dependencies = [ - "bitflags", + "bitflags 2.8.0", "bytes", "futures-util", "http", @@ -2331,7 +2680,7 @@ version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "403fa3b783d4b626a8ad51d766ab03cb6d2dbfc46b1c5d4448395e6628dc9697" dependencies = [ - "bitflags", + "bitflags 2.8.0", "bytes", "futures-util", "http", @@ -2380,6 +2729,49 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e672c95779cf947c5311f83787af4fa8fffd12fb27e4993211a84bdfd9610f9c" dependencies = [ "once_cell", + "valuable", +] + +[[package]] +name = "tracing-log" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" +dependencies = [ + "log", + "once_cell", + "tracing-core", +] + +[[package]] +name = "tracing-serde" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "704b1aeb7be0d0a84fc9828cae51dab5970fee5088f83d1dd7ee6f6246fc6ff1" +dependencies = [ + "serde", + "tracing-core", +] + +[[package]] +name = "tracing-subscriber" +version = "0.3.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8189decb5ac0fa7bc8b96b7cb9b2701d60d48805aca84a238004d665fcc4008" +dependencies = [ + "chrono", + "matchers", + "nu-ansi-term", + "once_cell", + "regex", + "serde", + "sharded-slab", + "smallvec", + "thread_local", + "tracing", + "tracing-core", + "tracing-log", + "tracing-serde", ] [[package]] @@ -2399,7 +2791,7 @@ checksum = "560b82d656506509d43abe30e0ba64c56b1953ab3d4fe7ba5902747a7a3cedd5" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.96", ] [[package]] @@ -2420,12 +2812,24 @@ version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493" +[[package]] +name = "unicode-width" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" + [[package]] name = "unicode-xid" version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" +[[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.4" @@ -2464,6 +2868,18 @@ dependencies = [ "getrandom", ] +[[package]] +name = "valuable" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65" + +[[package]] +name = "vec_map" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" + [[package]] name = "version_check" version = "0.9.5" @@ -2508,7 +2924,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn", + "syn 2.0.96", "wasm-bindgen-shared", ] @@ -2542,7 +2958,7 @@ checksum = "26c6ab57572f7a24a4985830b120de1594465e5d500f24afe89e16b4e833ef68" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.96", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -2588,6 +3004,22 @@ dependencies = [ "rustix", ] +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + [[package]] name = "winapi-util" version = "0.1.9" @@ -2597,6 +3029,21 @@ dependencies = [ "windows-sys 0.59.0", ] +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows-core" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" +dependencies = [ + "windows-targets", +] + [[package]] name = "windows-sys" version = "0.52.0" @@ -2732,7 +3179,7 @@ checksum = "2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.96", "synstructure", ] @@ -2754,7 +3201,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.96", ] [[package]] @@ -2774,10 +3221,16 @@ checksum = "595eed982f7d355beb85837f651fa22e90b3c044842dc7f2c2842c086f295808" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.96", "synstructure", ] +[[package]] +name = "zeroize" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" + [[package]] name = "zerovec" version = "0.10.4" @@ -2797,5 +3250,5 @@ checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.96", ] diff --git a/README.org b/README.org new file mode 100644 index 0000000..722e137 --- /dev/null +++ b/README.org @@ -0,0 +1,18 @@ +#+TITLE: Sparse C2 framework + +* Design +* Goals +* Setup +This project uses nix flakes, so make sure to install Nix. [[Building]] is easy to do once Nix is set up, but to set up a development shell a little more work is required; run: +#+BEGIN_SRC sh +nix develop +setup-dev-environment +#+END_SRC +* Building +Run: +#+BEGIN_SRC sh +nix build +#+END_SRC +(this may take ages) +* Architecture +[[./architecture.org][Architecture]] diff --git a/architecture.org b/architecture.org new file mode 100644 index 0000000..f81f859 --- /dev/null +++ b/architecture.org @@ -0,0 +1 @@ +#+TITLE: Sparse Architecture diff --git a/flake.nix b/flake.nix index 9668440..db9ff92 100644 --- a/flake.nix +++ b/flake.nix @@ -55,25 +55,30 @@ freebsd-toolchain winpcap-drivers freebsd-libs libnl libpcap-linux-gnu libpcap-linux-musl libpcap-freebsd; - buildTools = with pkgs; [ - # Tools for local compilation - lld - zig - clang - glibc - libclang + buildTools = with pkgs; rec { + linux = [ + # Tools for local compilation + lld + zig + clang + glibc + libclang + mold - # Tools for cross compilation - pkgsCross.x86_64-freebsd.buildPackages.clang - pkgsCross.mingwW64.stdenv.cc - pkgsCross.mingwW64.windows.pthreads + # Tools for building the web UI + cargo-leptos + wasm-bindgen-cli + dart-sass + binaryen + ]; + freebsd = [ pkgsCross.x86_64-freebsd.buildPackages.clang ]; + windows = [ + pkgsCross.mingwW64.stdenv.cc + pkgsCross.mingwW64.windows.pthreads + ]; - # Tools for building the web UI - cargo-leptos - wasm-bindgen-cli - dart-sass - binaryen - ]; + all = buildTools.linux ++ buildTools.freebsd ++ buildTools.windows; + }; devShellTools = with pkgs; [ # Language servers @@ -117,8 +122,19 @@ } // system-libs); setup-zig-freebsd = pkgs.writeScriptBin "setup-zig-freebsd" '' + set -eux + cp ${outputs.packages.freebsd-zig-libc} $(${pkgs.git}/bin/git rev-parse --show-toplevel)/unix-loader/freebsd.txt ''; + + setup-dev-environment = pkgs.writeScriptBin "setup-dev-environment" '' + set -eux + + ${setup-zig-freebsd}/bin/setup-zig-freebsd + cargo build -p sparse-windows-beacon --target=x86_64-pc-windows-gnu + cargo build -p sparse-unix-beacon --target=x86_64-unknown-freebsd + cargo build -p sparse-unix-beacon --target=x86_64-unknown-linux-musl + ''; in { packages = outputs.packages; checks = outputs.checks; @@ -127,7 +143,20 @@ default = craneLib.devShell (buildEnvironment // { name = "sparse-default"; - packages = buildTools ++ devShellTools ++ [ setup-zig-freebsd ]; + packages = buildTools.all ++ devShellTools + ++ [ setup-zig-freebsd setup-dev-environment ]; + + # Added to make development easier + SPARSE_INSTALLER_LINUX = + "../../target/x86_64-unknown-linux-musl/debug/sparse-unix-beacon"; + SPARSE_INSTALLER_FREEBSD = + "../../target/x86_64-unknown-freebsd/debug/sparse-unix-beacon"; + SPARSE_BEACON_LINUX = + "../../target/x86_64-unknown-linux-musl/debug/sparse-unix-beacon"; + SPARSE_BEACON_FREEBSD = + "../../target/x86_64-unknown-freebsd/debug/sparse-unix-beacon"; + SPARSE_BEACON_WINDOWS = + "../../target/x86_64-pc-windows-gnu/debug/sparse-windows-beacon.exe"; }); }; }); diff --git a/packages.nix b/packages.nix index e4a398b..ce8ec57 100644 --- a/packages.nix +++ b/packages.nix @@ -34,8 +34,8 @@ let inherit src; strictDeps = true; - nativeBuildInputs = buildTools; - buildInputs = buildTools; + nativeBuildInputs = buildTools.linux; + buildInputs = buildTools.all; }; fileSetForBeaconCrate = pkgs.lib.fileset.toSource { @@ -104,11 +104,15 @@ let "-Ctarget-feature=+crt-static -Clink-args=--target=x86_64-unknown-freebsd -Clink-args=--sysroot=${freebsd-libs} -Clink-args=-L${freebsd-libs}/lib -Clink-args=-L${freebsd-libs}/usr/lib -Clink-args=-L${libpcap-freebsd}/lib"; doCheck = false; + + nativeBuildInputs = buildTools.linux ++ buildTools.freebsd; }; windowsArgs = commonArgs // { src = fileSetForBeaconCrate; doCheck = false; + + nativeBuildInputs = buildTools.linux ++ buildTools.windows; }; linuxCargoArtifacts = craneLib.buildDepsOnly (commonArgs // { @@ -141,14 +145,14 @@ let name = "sparse-beacon-freebsd"; cargoExtraArgs = "-p sparse-unix-beacon"; - nativeBuildInputs = buildTools; + nativeBuildInputs = buildTools.linux ++ buildTools.freebsd; CARGO_BUILD_TARGET = "x86_64-unknown-freebsd"; CARGO_BUILD_RUSTFLAGS = "-Ctarget-feature=+crt-static"; }); sparse-beacon-freebsd = - patch-freebsd-elf sparse-beacon-freebsd-sysv "bin/sparse-beacon"; + patch-freebsd-elf sparse-beacon-freebsd-sysv "bin/sparse-unix-beacon"; sparse-beacon-windows = craneLib.buildPackage (windowsArgs // { cargoArtifacts = windowsCargoArtifacts; @@ -249,7 +253,10 @@ let SPARSE_INSTALLER_LINUX = "${sparse-installer-linux}/bin/sparse-installer"; SPARSE_INSTALLER_FREEBSD = "${sparse-installer-freebsd}/bin/sparse-installer"; - SPARSE_BEACON_WINDOWS = "${sparse-beacon-windows}/bin/sparse-beacon.exe"; + SPARSE_BEACON_LINUX = "${sparse-beacon-linux}/bin/sparse-unix-beacon"; + SPARSE_BEACON_FREEBSD = "${sparse-beacon-freebsd}/bin/sparse-unix-beacon"; + SPARSE_BEACON_WINDOWS = + "${sparse-beacon-windows}/bin/sparse-windows-beacon.exe"; }); outputs = rec { diff --git a/sparse-server/.cargo/config.toml b/sparse-server/.cargo/config.toml new file mode 100644 index 0000000..bd3c77b --- /dev/null +++ b/sparse-server/.cargo/config.toml @@ -0,0 +1,5 @@ +[target.x86_64-unknown-linux-musl] +rustflags = ["-C", "link-arg=-fuse-ld=mold"] + +[target.x86_64-unknown-linux-gnu] +rustflags = ["-C", "link-arg=-fuse-ld=mold"] diff --git a/sparse-server/Cargo.toml b/sparse-server/Cargo.toml index fcff332..880d4b6 100644 --- a/sparse-server/Cargo.toml +++ b/sparse-server/Cargo.toml @@ -19,6 +19,10 @@ tower-http = { version = "0.5", features = ["fs"], optional = true } wasm-bindgen = "=0.2.95" thiserror = "1" http = "1" +axum-server = { version = "0.7.1", features = ["tokio-rustls"], optional = true } +tracing-subscriber = { version = "0.3.19", features = ["chrono", "env-filter", "serde", "tracing", "tracing-serde"], optional = true } +structopt = { version = "0.3", optional = true } +anyhow = "1.0.95" [features] hydrate = ["leptos/hydrate"] @@ -28,6 +32,9 @@ ssr = [ "dep:tower", "dep:tower-http", "dep:leptos_axum", + "dep:axum-server", + "dep:tracing-subscriber", + "dep:structopt", "leptos/ssr", "leptos_meta/ssr", "leptos_router/ssr", diff --git a/sparse-server/build.rs b/sparse-server/build.rs new file mode 100644 index 0000000..d4809bd --- /dev/null +++ b/sparse-server/build.rs @@ -0,0 +1,3 @@ +fn main() { + include!("../build_common.rs"); +} diff --git a/sparse-server/src/cli.rs b/sparse-server/src/cli.rs new file mode 100644 index 0000000..a809885 --- /dev/null +++ b/sparse-server/src/cli.rs @@ -0,0 +1,16 @@ +use std::path::PathBuf; +use structopt::StructOpt; + +#[derive(StructOpt, Debug, Clone)] +#[structopt(name = "sparse-server")] +pub struct Options { + #[structopt(subcommand)] + pub command: Option, +} + +#[derive(StructOpt, Debug, Clone)] +#[structopt()] +pub enum Command { + Serve {}, + Init {}, +} diff --git a/sparse-server/src/main.rs b/sparse-server/src/main.rs index c165347..3070910 100644 --- a/sparse-server/src/main.rs +++ b/sparse-server/src/main.rs @@ -1,39 +1,40 @@ +#[cfg(feature = "ssr")] +pub(crate) mod beacons { + pub const LINUX_BEACON: &'static [u8] = include_bytes!(std::env!("SPARSE_BEACON_LINUX")); + pub const FREEBSD_BEACON: &'static [u8] = include_bytes!(std::env!("SPARSE_BEACON_FREEBSD")); + pub const WINDOWS_BEACON: &'static [u8] = include_bytes!(std::env!("SPARSE_BEACON_WINDOWS")); + + pub const LINUX_INSTALLER: &'static [u8] = include_bytes!(std::env!("SPARSE_INSTALLER_LINUX")); + pub const FREEBSD_INSTALLER: &'static [u8] = include_bytes!(std::env!("SPARSE_INSTALLER_FREEBSD")); +} + +#[cfg(feature = "ssr")] +mod cli; + +#[cfg(feature = "ssr")] +mod webserver; #[cfg(feature = "ssr")] #[tokio::main] -async fn main() { - use axum::Router; - use leptos::logging::log; - use leptos::prelude::*; - use leptos_axum::{generate_route_list, LeptosRoutes}; - use sparse_server::app::*; +async fn main() -> anyhow::Result<()> { + use structopt::StructOpt; - let conf = get_configuration(None).unwrap(); - let addr = conf.leptos_options.site_addr; - let leptos_options = conf.leptos_options; - // Generate the list of routes in your Leptos App - let routes = generate_route_list(App); + let options = cli::Options::from_args(); - let app = Router::new() - .leptos_routes(&leptos_options, routes, { - let leptos_options = leptos_options.clone(); - move || shell(leptos_options.clone()) - }) - .fallback(leptos_axum::file_and_error_handler(shell)) - .with_state(leptos_options); + match options.command.clone() { + Some(cli::Command::Serve { }) => { + webserver::serve_web(options).await?; + } + Some(cli::Command::Init { }) => { - // run our app with hyper - // `axum::Server` is a re-export of `hyper::Server` - log!("listening on http://{}", &addr); - let listener = tokio::net::TcpListener::bind(&addr).await.unwrap(); - axum::serve(listener, app.into_make_service()) - .await - .unwrap(); + } + None => { + webserver::serve_web(options).await?; + } + } + + Ok(()) } #[cfg(not(feature = "ssr"))] -pub fn main() { - // no client-side main function - // unless we want this to work with e.g., Trunk for pure client-side testing - // see lib.rs for hydration function instead -} +pub fn main() {} diff --git a/sparse-server/src/webserver.rs b/sparse-server/src/webserver.rs new file mode 100644 index 0000000..df144b1 --- /dev/null +++ b/sparse-server/src/webserver.rs @@ -0,0 +1,38 @@ +pub async fn serve_web(options: crate::cli::Options) -> anyhow::Result<()> { + use axum::Router; + use leptos::logging::log; + use leptos::prelude::*; + use leptos_axum::{generate_route_list, LeptosRoutes}; + use sparse_server::app::*; + use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt}; + + tracing_subscriber::registry() + .with( + tracing_subscriber::EnvFilter::try_from_default_env() + .unwrap_or_else(|_| format!("{}=debug", env!("CARGO_CRATE_NAME")).into()), + ) + .with(tracing_subscriber::fmt::layer()) + .init(); + + let conf = get_configuration(None).unwrap(); + let addr = conf.leptos_options.site_addr; + let leptos_options = conf.leptos_options; + // Generate the list of routes in your Leptos App + let routes = generate_route_list(App); + + let app = Router::new() + .leptos_routes(&leptos_options, routes, { + let leptos_options = leptos_options.clone(); + move || shell(leptos_options.clone()) + }) + .fallback(leptos_axum::file_and_error_handler(shell)) + .with_state(leptos_options); + + // run our app with hyper + // `axum::Server` is a re-export of `hyper::Server` + log!("listening on http://{}", &addr); + let listener = tokio::net::TcpListener::bind(&addr).await?; + axum::serve(listener, app.into_make_service()).await?; + + Ok(()) +} diff --git a/sparse-unix-beacon/build.rs b/sparse-unix-beacon/build.rs new file mode 100644 index 0000000..d4809bd --- /dev/null +++ b/sparse-unix-beacon/build.rs @@ -0,0 +1,3 @@ +fn main() { + include!("../build_common.rs"); +}