From 70015c4d69a5a92cdd83ff25368e2585c15a73bc Mon Sep 17 00:00:00 2001 From: Alex Emmet <111742636+Alex-Emmet@users.noreply.github.com> Date: Mon, 20 Jul 2026 15:28:13 +0200 Subject: [PATCH] [Upd] mtp update --- Cargo.lock | 1005 ++++++++++----------------- Cargo.toml | 9 +- src/main.rs | 28 +- src/server/api.rs | 88 ++- src/server/index.rs | 10 +- src/server/server.rs | 84 +-- src/sql/sql.rs | 11 +- src/transport/omikron_connection.rs | 94 +-- type-maps.yaml | 2 +- 9 files changed, 482 insertions(+), 849 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6dfdfc9..4ce5e8d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,210 +2,6 @@ # It is not intended for manual editing. version = 4 -[[package]] -name = "actix-codec" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f7b0a21988c1bf877cf4759ef5ddaac04c1c9fe808c9142ecb78ba97d97a28a" -dependencies = [ - "bitflags 2.13.0", - "bytes", - "futures-core", - "futures-sink", - "memchr", - "pin-project-lite", - "tokio", - "tokio-util", - "tracing", -] - -[[package]] -name = "actix-http" -version = "3.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48e2faa3e7418ed780cca54829d32782a4008a077230f67457caa063415e99c2" -dependencies = [ - "actix-codec", - "actix-rt", - "actix-service", - "actix-tls", - "actix-utils", - "base64", - "bitflags 2.13.0", - "brotli", - "bytes", - "bytestring", - "derive_more", - "encoding_rs", - "flate2", - "foldhash 0.2.0", - "futures-core", - "h2 0.3.27", - "http 0.2.12", - "httparse", - "httpdate", - "itoa", - "language-tags", - "local-channel", - "mime", - "percent-encoding", - "pin-project-lite", - "rand 0.10.2", - "sha1 0.11.0", - "smallvec", - "tokio", - "tokio-util", - "tracing", - "zstd", -] - -[[package]] -name = "actix-macros" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e01ed3140b2f8d422c68afa1ed2e85d996ea619c988ac834d255db32138655cb" -dependencies = [ - "quote", - "syn", -] - -[[package]] -name = "actix-router" -version = "0.5.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14f8c75c51892f18d9c46150c5ac7beb81c95f78c8b83a634d49f4ca32551fe7" -dependencies = [ - "bytestring", - "cfg-if", - "http 0.2.12", - "regex", - "regex-lite", - "serde", - "tracing", -] - -[[package]] -name = "actix-rt" -version = "2.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92589714878ca59a7626ea19734f0e07a6a875197eec751bb5d3f99e64998c63" -dependencies = [ - "futures-core", - "tokio", -] - -[[package]] -name = "actix-server" -version = "2.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a65064ea4a457eaf07f2fba30b4c695bf43b721790e9530d26cb6f9019ff7502" -dependencies = [ - "actix-rt", - "actix-service", - "actix-utils", - "futures-core", - "futures-util", - "mio", - "socket2 0.5.10", - "tokio", - "tracing", -] - -[[package]] -name = "actix-service" -version = "2.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e46f36bf0e5af44bdc4bdb36fbbd421aa98c79a9bce724e1edeb3894e10dc7f" -dependencies = [ - "futures-core", - "pin-project-lite", -] - -[[package]] -name = "actix-tls" -version = "3.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6176099de3f58fbddac916a7f8c6db297e021d706e7a6b99947785fee14abe9f" -dependencies = [ - "actix-rt", - "actix-service", - "actix-utils", - "futures-core", - "impl-more 0.1.9", - "pin-project-lite", - "rustls-pki-types", - "tokio", - "tokio-rustls", - "tokio-util", - "tracing", -] - -[[package]] -name = "actix-utils" -version = "3.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88a1dcdff1466e3c2488e1cb5c36a71822750ad43839937f85d2f4d9f8b705d8" -dependencies = [ - "local-waker", - "pin-project-lite", -] - -[[package]] -name = "actix-web" -version = "4.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df09e2d9239703dd64056359c920c7f3fba6535ec61a0059e0f44e095ffe02b4" -dependencies = [ - "actix-codec", - "actix-http", - "actix-macros", - "actix-router", - "actix-rt", - "actix-server", - "actix-service", - "actix-tls", - "actix-utils", - "actix-web-codegen", - "bytes", - "bytestring", - "cfg-if", - "cookie", - "derive_more", - "encoding_rs", - "foldhash 0.2.0", - "futures-core", - "futures-util", - "impl-more 0.3.1", - "itoa", - "language-tags", - "log", - "mime", - "once_cell", - "pin-project-lite", - "regex", - "regex-lite", - "serde", - "serde_json", - "serde_urlencoded", - "smallvec", - "socket2 0.6.4", - "time", - "tracing", - "url", -] - -[[package]] -name = "actix-web-codegen" -version = "4.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f591380e2e68490b5dfaf1dd1aa0ebe78d84ba7067078512b4ea6e4492d622b8" -dependencies = [ - "actix-router", - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "adler2" version = "2.0.1" @@ -268,30 +64,6 @@ dependencies = [ "subtle", ] -[[package]] -name = "aho-corasick" -version = "1.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301" -dependencies = [ - "memchr", -] - -[[package]] -name = "alloc-no-stdlib" -version = "2.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc7bb162ec39d46ab1ca8c77bf72e890535becd1751bb45f64c597edb4c8c6b3" - -[[package]] -name = "alloc-stdlib" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e76a019e91224d279006ff972f1e984179a6e9feb050adba6ce8274aef23195" -dependencies = [ - "alloc-no-stdlib", -] - [[package]] name = "allocator-api2" version = "0.2.21" @@ -309,9 +81,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.103" +version = "1.0.104" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a4385e2e34eb35d6b3efe798b9eb88096925d87726c0798709bf56d9ed84af3" +checksum = "330a5ed07fa54e4702c9d6c4174f74427fc0ef6e214bbd677ae50a5099946470" [[package]] name = "arbitrary" @@ -334,7 +106,7 @@ dependencies = [ "nom", "num-traits", "rusticata-macros", - "thiserror 2.0.18", + "thiserror 2.0.19", "time", ] @@ -346,7 +118,7 @@ checksum = "3109e49b1e4909e9db6515a30c633684d68cdeaa252f215214cb4fa1a5bfee2c" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.119", "synstructure", ] @@ -358,7 +130,7 @@ checksum = "7b18050c2cd6fe86c3a76584ef5e0baf286d038cda203eb6223df2cc413565f7" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.119", ] [[package]] @@ -392,7 +164,7 @@ checksum = "c96bf972d85afc50bf5ab8fe2d54d1586b4e0b46c97c50a0c9e71e2f7bcd812a" dependencies = [ "async-task", "concurrent-queue", - "fastrand 2.4.1", + "fastrand 2.5.0", "futures-lite 2.6.1", "pin-project-lite", "slab", @@ -503,6 +275,17 @@ version = "4.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b75356056920673b02621b35afd0f7dda9306d03c79a30f5c56c44cf256e3de" +[[package]] +name = "async-trait" +version = "0.1.91" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae36dc4177970ef04fde5178d3e2429882def40e57a451f919c098f72baa6cec" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.1", +] + [[package]] name = "atoi" version = "2.0.0" @@ -526,9 +309,9 @@ checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53" [[package]] name = "aws-lc-rs" -version = "1.17.1" +version = "1.17.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4342d8937fc7e5dd9b1c60292261c0670c882a2cd1719cfc11b1af41731e32ad" +checksum = "00bdb5da18dac48ca2cc7cd4a98e533e8635a58e2361d13a1a4ee3888e0d72f1" dependencies = [ "aws-lc-sys", "untrusted 0.7.1", @@ -537,9 +320,9 @@ dependencies = [ [[package]] name = "aws-lc-sys" -version = "0.42.0" +version = "0.43.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d9ceb1da931507a12f4fccea479dccd00da1943e1b4ae72d8e502d707361444" +checksum = "43103168cc76fe62678a375e722fc9cb3a0146159ac5828bc4f0dfd755c2224c" dependencies = [ "cc", "cmake", @@ -577,9 +360,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.13.0" +version = "2.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4388bee8683e3d04af747c73422af53102d2bd24d9eadb6cbc100baef4b43f8" +checksum = "b588b76d00fde79687d7646a9b5bdf3cc0f655e0bbd080335a95d7e96f3587da" dependencies = [ "serde_core", ] @@ -615,27 +398,6 @@ dependencies = [ "piper", ] -[[package]] -name = "brotli" -version = "8.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cc91aac060a7a1e25823bdccbfb6af1875b88f17c6daac97894eed8207166b3" -dependencies = [ - "alloc-no-stdlib", - "alloc-stdlib", - "brotli-decompressor", -] - -[[package]] -name = "brotli-decompressor" -version = "5.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a32acac15fe1967bc3986b2a6347dffc965602354ea6f450ad07e8bfd253583" -dependencies = [ - "alloc-no-stdlib", - "alloc-stdlib", -] - [[package]] name = "bumpalo" version = "3.20.3" @@ -650,18 +412,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.12.0" +version = "1.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ae3f5d315924270530207e2a68396c3cc547f6dca3fbdca317cfb1a51edb593" - -[[package]] -name = "bytestring" -version = "1.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86566c496f2f47d9b8147a4c8b02ffdb69c919fe0c2b2e7195d22cbba0e635c9" -dependencies = [ - "bytes", -] +checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04" [[package]] name = "bzip2" @@ -674,9 +427,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.2.66" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5d6cac793997bd970000024b2934968efe83b382de4fdcf4fcb46b6ee4ad996" +checksum = "c89588d05638b5b4594a3348a2d6c20277e43a7f5c5202b05cc56888475a47b8" dependencies = [ "find-msvc-tools", "jobserver", @@ -692,9 +445,9 @@ checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" [[package]] name = "cfg_aliases" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" +checksum = "f079e83a288787bcd14a6aea84cee5c87a67c5a3e660c30f557a3d24761b3527" [[package]] name = "chacha20" @@ -805,26 +558,6 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7c74b8349d32d297c9134b8c88677813a227df8f779daa29bfc29c183fe3dca6" -[[package]] -name = "convert_case" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "633458d4ef8c78b72454de2d54fd6ab2e60f9e02be22f3c6104cdc8a4e0fceb9" -dependencies = [ - "unicode-segmentation", -] - -[[package]] -name = "cookie" -version = "0.16.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e859cd57d0710d9e06c381b550c06e76992472a8c6d527aecd2fc673dcc231fb" -dependencies = [ - "percent-encoding", - "time", - "version_check", -] - [[package]] name = "core-foundation" version = "0.9.4" @@ -978,7 +711,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.119", ] [[package]] @@ -1020,9 +753,9 @@ dependencies = [ [[package]] name = "der" -version = "0.8.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71fd89660b2dc699704064e59e9dba0147b903e85319429e131620d022be411b" +checksum = "a69dedd701da44b0536442edf09c81a64b0ab97a7a4a5e3d1971f00027cbc63d" dependencies = [ "const-oid 0.10.2", "zeroize", @@ -1056,30 +789,7 @@ checksum = "1e567bd82dcff979e4b03460c307b3cdc9e96fde3d73bed1496d2bc75d9dd62a" dependencies = [ "proc-macro2", "quote", - "syn", -] - -[[package]] -name = "derive_more" -version = "2.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d751e9e49156b02b44f9c1815bcb94b984cdcc4396ecc32521c739452808b134" -dependencies = [ - "derive_more-impl", -] - -[[package]] -name = "derive_more-impl" -version = "2.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "799a97264921d8623a957f6c3b9011f3b5492f557bbb7a5a19b7fa6d06ba8dcb" -dependencies = [ - "convert_case", - "proc-macro2", - "quote", - "rustc_version", - "syn", - "unicode-xid", + "syn 2.0.119", ] [[package]] @@ -1114,7 +824,7 @@ checksum = "1ac70aa55017e108007fbaf5aa0f54b021c98f92ff8af59d42eda9da96e3dd4f" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.119", ] [[package]] @@ -1242,6 +952,18 @@ dependencies = [ "pin-project-lite", ] +[[package]] +name = "fastbloom" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef975e30683b2d965054bb0a836f8973857c4ebf6acf274fe46617cd285060d8" +dependencies = [ + "foldhash 0.2.0", + "libm", + "portable-atomic", + "siphasher", +] + [[package]] name = "fastrand" version = "1.9.0" @@ -1253,9 +975,9 @@ dependencies = [ [[package]] name = "fastrand" -version = "2.4.1" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f1f227452a390804cdb637b74a86990f2a7d7ba4b7d5693aac9b4dd6defd8d6" +checksum = "da7c62ceae207dd37ea5b845da6a0696c799f85e97da1ab5b7910be3c1c80223" [[package]] name = "fiat-crypto" @@ -1281,7 +1003,6 @@ version = "1.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "843fba2746e448b37e26a819579957415c8cef339bf08564fe8b7ddbd959573c" dependencies = [ - "crc32fast", "miniz_oxide", "zlib-rs", ] @@ -1331,10 +1052,25 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42703706b716c37f96a77aea830392ad231f44c9e9a67872fa5548707e11b11c" [[package]] -name = "futures-channel" -version = "0.3.32" +name = "futures" +version = "0.3.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07bbe89c50d7a535e539b8c17bc0b49bdb77747034daa8087407d655f3f7cc1d" +checksum = "a88cf1f829d945f548cf8fec32c61b1f202b6d93b45848602fc02af4b12ad218" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "262590f4fe6afeb0bc83be1daa64e52657fe185690a958af7f3ad0e92085c5ae" dependencies = [ "futures-core", "futures-sink", @@ -1342,15 +1078,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.32" +version = "0.3.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e3450815272ef58cec6d564423f6e755e25379b217b0bc688e295ba24df6b1d" +checksum = "2cd50c473c80f6d7c3670a752354b8e569b1a7cbfdc0419ec88e5edad85e0dc7" [[package]] name = "futures-executor" -version = "0.3.32" +version = "0.3.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf29c38818342a3b26b5b923639e7b1f4a61fc5e76102d4b1981c6dc7a7579d" +checksum = "6754879cc9f2c66f88c6e5c35344bb0bdb0708b0352b1201815667c7eabc7458" dependencies = [ "futures-core", "futures-task", @@ -1370,9 +1106,9 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.32" +version = "0.3.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cecba35d7ad927e23624b22ad55235f2239cfa44fd10428eecbeba6d6a717718" +checksum = "4577ecaa3c4f96589d473f679a71b596316f6641bc350038b962a5daf0085d7a" [[package]] name = "futures-lite" @@ -1395,7 +1131,7 @@ version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f78e10609fe0e0b3f4157ffab1876319b5b0db102a2c60dc4626306dc46b44ad" dependencies = [ - "fastrand 2.4.1", + "fastrand 2.5.0", "futures-core", "futures-io", "parking", @@ -1403,25 +1139,38 @@ dependencies = [ ] [[package]] -name = "futures-sink" -version = "0.3.32" +name = "futures-macro" +version = "0.3.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c39754e157331b013978ec91992bde1ac089843443c49cbc7f46150b0fad0893" +checksum = "2d6d3cde68c518367be28956066ddfef33813991b77a55005a69dae04bf3b10b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "futures-sink" +version = "0.3.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e34418ac499d6305c2fb5ad0ed2f6ac998c5f8ca209b4510f7f94242c647e307" [[package]] name = "futures-task" -version = "0.3.32" +version = "0.3.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "037711b3d59c33004d3856fbdc83b99d4ff37a24768fa1be9ce3538a1cde4393" +checksum = "b231ed28831efb4a61a08580c4bc233ec56bc009f4cd8f52da2c3cb97df0c109" [[package]] name = "futures-util" -version = "0.3.32" +version = "0.3.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "389ca41296e6190b48053de0321d02a77f32f8a5d2461dd38762c0593805c6d6" +checksum = "a77a90a256fce34da66415271e30f94ee91c57b04b8a2c042d9cf3220179deaa" dependencies = [ + "futures-channel", "futures-core", "futures-io", + "futures-macro", "futures-sink", "futures-task", "memchr", @@ -1499,25 +1248,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "h2" -version = "0.3.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0beca50380b1fc32983fc1cb4587bfa4bb9e78fc259aad4a0032d2080309222d" -dependencies = [ - "bytes", - "fnv", - "futures-core", - "futures-sink", - "futures-util", - "http 0.2.12", - "indexmap", - "slab", - "tokio", - "tokio-util", - "tracing", -] - [[package]] name = "h2" version = "0.4.15" @@ -1529,7 +1259,7 @@ dependencies = [ "fnv", "futures-core", "futures-sink", - "http 1.4.2", + "http", "indexmap", "slab", "tokio", @@ -1537,6 +1267,62 @@ dependencies = [ "tracing", ] +[[package]] +name = "h3" +version = "0.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10872b55cfb02a821b69dc7cf8dc6a71d6af25eb9a79662bec4a9d016056b3be" +dependencies = [ + "bytes", + "fastrand 2.5.0", + "futures-util", + "http", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "h3-datagram" +version = "0.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d2c9f77921668673721ae40f17c729fc48b9e38a663858097cea547484fdf0f" +dependencies = [ + "bytes", + "h3", + "pin-project-lite", +] + +[[package]] +name = "h3-quinn" +version = "0.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b2e732c8d91a74731663ac8479ab505042fbf547b9a207213ab7fbcbfc4f8b4" +dependencies = [ + "bytes", + "futures", + "h3", + "h3-datagram", + "quinn", + "tokio", + "tokio-util", +] + +[[package]] +name = "h3-webtransport" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d91a50fd582a5d67b1f756fba3cd9c66367ff4f23e1017c882f664d63b350a7" +dependencies = [ + "bytes", + "futures-util", + "h3", + "h3-datagram", + "http", + "pin-project-lite", + "tokio", + "tracing", +] + [[package]] name = "hashbrown" version = "0.14.5" @@ -1644,17 +1430,6 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1a9fcbcc408c5526c3ab80d534e5c86e7967c1fb7aa0a8c76abd1edc27deb877" -[[package]] -name = "http" -version = "0.2.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "601cbb57e577e2f5ef5be8e7b83f0f63994f25aa94d673e54a92d5c516d101f1" -dependencies = [ - "bytes", - "fnv", - "itoa", -] - [[package]] name = "http" version = "1.4.2" @@ -1667,23 +1442,23 @@ dependencies = [ [[package]] name = "http-body" -version = "1.0.1" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" +checksum = "ca2a8f2913ee65f60facd6a5905613afaa448497a0230cc41ce022d93290bc2c" dependencies = [ "bytes", - "http 1.4.2", + "http", ] [[package]] name = "http-body-util" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b021d93e26becf5dc7e1b75b1bed1fd93124b374ceb73f43d4d4eafec896a64a" +checksum = "e9f41fd6a08e4d4ec69df65976da761afd5ad5e58a9d4acb46bd1c953a9e3ff2" dependencies = [ "bytes", "futures-core", - "http 1.4.2", + "http", "http-body", "pin-project-lite", ] @@ -1694,12 +1469,6 @@ version = "1.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" -[[package]] -name = "httpdate" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" - [[package]] name = "hybrid-array" version = "0.4.13" @@ -1720,8 +1489,8 @@ dependencies = [ "bytes", "futures-channel", "futures-core", - "h2 0.4.15", - "http 1.4.2", + "h2", + "http", "http-body", "httparse", "itoa", @@ -1737,7 +1506,7 @@ version = "0.27.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "33ca68d021ef39cf6463ab54c1d0f5daf03377b70561305bb89a8f83aab66e0f" dependencies = [ - "http 1.4.2", + "http", "hyper", "hyper-util", "rustls", @@ -1756,14 +1525,14 @@ dependencies = [ "bytes", "futures-channel", "futures-util", - "http 1.4.2", + "http", "http-body", "hyper", "ipnet", "libc", "percent-encoding", "pin-project-lite", - "socket2 0.6.4", + "socket2 0.6.5", "system-configuration", "tokio", "tower-service", @@ -1874,18 +1643,6 @@ dependencies = [ "icu_properties", ] -[[package]] -name = "impl-more" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8a5a9a0ff0086c7a148acb942baaabeadf9504d10400b5a05645853729b9cd2" - -[[package]] -name = "impl-more" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35a84fd5aa25fae5c0f4a33d9cac2ca017fc622cbd089be2229993514990f870" - [[package]] name = "indexmap" version = "2.14.0" @@ -1958,7 +1715,7 @@ dependencies = [ "jni-sys", "log", "simd_cesu8", - "thiserror 2.0.18", + "thiserror 2.0.19", "walkdir", "windows-link", ] @@ -1973,7 +1730,7 @@ dependencies = [ "quote", "rustc_version", "simd_cesu8", - "syn", + "syn 2.0.119", ] [[package]] @@ -1992,7 +1749,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "38c0b942f458fe50cdac086d2f946512305e5631e720728f2a61aabcd47a6264" dependencies = [ "quote", - "syn", + "syn 2.0.119", ] [[package]] @@ -2050,12 +1807,6 @@ dependencies = [ "log", ] -[[package]] -name = "language-tags" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4345964bb142484797b161f473a503a434de77149dd8c7427788c6e13379388" - [[package]] name = "lazy_static" version = "1.5.0" @@ -2089,7 +1840,7 @@ version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c943259e342f1e06ff2da7a83eabdfe7f92ce10262688dbf1895ff0b3e6e4652" dependencies = [ - "bitflags 2.13.0", + "bitflags 2.13.1", "libc", "plain", "redox_syscall 0.9.0", @@ -2123,23 +1874,6 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "92daf443525c4cce67b150400bc2316076100ce0b3686209eb8cf3c31612e6f0" -[[package]] -name = "local-channel" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6cbc85e69b8df4b8bb8b89ec634e7189099cea8927a276b7384ce5488e53ec8" -dependencies = [ - "futures-core", - "futures-sink", - "local-waker", -] - -[[package]] -name = "local-waker" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d873d7c67ce09b42110d801813efbc9364414e356be9935700d368351657487" - [[package]] name = "lock_api" version = "0.4.14" @@ -2186,9 +1920,9 @@ dependencies = [ [[package]] name = "memchr" -version = "2.8.2" +version = "2.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88904434abc2901f197fe8cc55f0445e7ded921dba5911dad2e2b39b48e663c4" +checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98" [[package]] name = "mime" @@ -2214,12 +1948,11 @@ dependencies = [ [[package]] name = "mio" -version = "1.2.1" +version = "1.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02bd0af71c67b473010cbbc60715ee815645a4dc942899111f494b4b737d6fda" +checksum = "30d65c71f1ce40ab09135ce117d742b9f8a19ff91a41a8b57ed50bc2de59c427" dependencies = [ "libc", - "log", "wasi", "windows-sys 0.61.2", ] @@ -2279,8 +2012,8 @@ dependencies = [ [[package]] name = "mtp" -version = "0.1.0" -source = "git+https://git.methanium.net/methanium/mtp#2126a142f44634ccfdcaa297633fdb63b1d9b46d" +version = "0.2.0" +source = "git+https://git.methanium.net/methanium/mtp#04760fd88d2bc3adf548a9ec532fa228227f0a49" dependencies = [ "mtp-client", "mtp-codec", @@ -2288,50 +2021,52 @@ dependencies = [ "mtp-crypto", "mtp-files", "mtp-host", + "mtp-transport", "mtp-type-map", + "mtp-webserver", ] [[package]] name = "mtp-client" -version = "0.1.0" -source = "git+https://git.methanium.net/methanium/mtp#2126a142f44634ccfdcaa297633fdb63b1d9b46d" +version = "0.2.0" +source = "git+https://git.methanium.net/methanium/mtp#04760fd88d2bc3adf548a9ec532fa228227f0a49" dependencies = [ "mtp-codec", "mtp-common", "mtp-crypto", "mtp-transport", - "rand 0.8.6", + "rand 0.10.2", "tokio", ] [[package]] name = "mtp-codec" -version = "0.1.0" -source = "git+https://git.methanium.net/methanium/mtp#2126a142f44634ccfdcaa297633fdb63b1d9b46d" +version = "0.2.0" +source = "git+https://git.methanium.net/methanium/mtp#04760fd88d2bc3adf548a9ec532fa228227f0a49" dependencies = [ "base64", "byteorder", "mtp-common", "mtp-crypto", "mtp-type-map", - "rand 0.8.6", + "rand 0.10.2", ] [[package]] name = "mtp-common" -version = "0.1.0" -source = "git+https://git.methanium.net/methanium/mtp#2126a142f44634ccfdcaa297633fdb63b1d9b46d" +version = "0.2.0" +source = "git+https://git.methanium.net/methanium/mtp#04760fd88d2bc3adf548a9ec532fa228227f0a49" dependencies = [ "quinn", "rustls", - "thiserror 2.0.18", + "thiserror 2.0.19", "wtransport", ] [[package]] name = "mtp-crypto" -version = "0.1.0" -source = "git+https://git.methanium.net/methanium/mtp#2126a142f44634ccfdcaa297633fdb63b1d9b46d" +version = "0.2.0" +source = "git+https://git.methanium.net/methanium/mtp#04760fd88d2bc3adf548a9ec532fa228227f0a49" dependencies = [ "base64", "chacha20poly1305", @@ -2340,59 +2075,93 @@ dependencies = [ "hkdf 0.13.0", "ml-dsa", "mlkem-tls", - "rand_core 0.6.4", + "rand 0.10.2", + "rand_core 0.10.1", + "rustls", "serde", "sha2 0.11.0", "thiserror 1.0.69", + "tokio", "zeroize", ] [[package]] name = "mtp-files" -version = "0.1.0" -source = "git+https://git.methanium.net/methanium/mtp#2126a142f44634ccfdcaa297633fdb63b1d9b46d" +version = "0.2.0" +source = "git+https://git.methanium.net/methanium/mtp#04760fd88d2bc3adf548a9ec532fa228227f0a49" dependencies = [ "mtp-crypto", + "rand 0.10.2", "thiserror 1.0.69", + "zeroize", ] [[package]] name = "mtp-host" -version = "0.1.0" -source = "git+https://git.methanium.net/methanium/mtp#2126a142f44634ccfdcaa297633fdb63b1d9b46d" +version = "0.2.0" +source = "git+https://git.methanium.net/methanium/mtp#04760fd88d2bc3adf548a9ec532fa228227f0a49" dependencies = [ "mtp-codec", "mtp-common", "mtp-crypto", "mtp-transport", - "rand 0.8.6", + "rand 0.8.7", "tokio", + "tracing", + "wtransport", ] [[package]] name = "mtp-transport" -version = "0.1.0" -source = "git+https://git.methanium.net/methanium/mtp#2126a142f44634ccfdcaa297633fdb63b1d9b46d" +version = "0.2.0" +source = "git+https://git.methanium.net/methanium/mtp#04760fd88d2bc3adf548a9ec532fa228227f0a49" dependencies = [ - "log", + "async-trait", "mtp-codec", "mtp-common", + "mtp-crypto", "rcgen", "rustls", "rustls-native-certs", + "sha2 0.11.0", "tokio", + "tracing", "wtransport", ] [[package]] name = "mtp-type-map" -version = "0.1.0" -source = "git+https://git.methanium.net/methanium/mtp#2126a142f44634ccfdcaa297633fdb63b1d9b46d" +version = "0.2.0" +source = "git+https://git.methanium.net/methanium/mtp#04760fd88d2bc3adf548a9ec532fa228227f0a49" dependencies = [ "serde", "serde_yaml", ] +[[package]] +name = "mtp-webserver" +version = "0.2.0" +source = "git+https://git.methanium.net/methanium/mtp#04760fd88d2bc3adf548a9ec532fa228227f0a49" +dependencies = [ + "async-trait", + "bytes", + "h3", + "h3-quinn", + "h3-webtransport", + "http", + "mtp-codec", + "mtp-common", + "mtp-crypto", + "mtp-host", + "mtp-transport", + "quinn", + "rand 0.10.2", + "rustls", + "thiserror 2.0.19", + "tokio", + "tracing", +] + [[package]] name = "nom" version = "7.1.3" @@ -2424,7 +2193,7 @@ dependencies = [ "num-integer", "num-iter", "num-traits", - "rand 0.8.6", + "rand 0.8.7", "smallvec", "zeroize", ] @@ -2466,9 +2235,9 @@ dependencies = [ [[package]] name = "octets" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8311fa8ab7a57759b4ff1f851a3048d9ef0effaa0130726426b742d26d8a88e7" +checksum = "866cb5af6f3aa3c1b44c3c2d79d22165fbb1b102e1b3fb499864bfe34736ec4b" [[package]] name = "oid-registry" @@ -2483,29 +2252,28 @@ dependencies = [ name = "omega" version = "0.1.0" dependencies = [ - "actix-web", "aes-gcm", "ansi_term", "anyhow", "base64", + "bytes", "dashmap", "dotenv", "hex", "hkdf 0.12.4", + "http", "json", "mtp", - "mtp-crypto", "once_cell", - "rand 0.8.6", + "rand 0.8.7", "rand_core 0.6.4", "reqwest", "rustls", - "rustls-pemfile", "sha2 0.10.9", "sqlx", "strum", "strum_macros", - "thiserror 2.0.18", + "thiserror 2.0.19", "tokio", "uuid", "x448", @@ -2613,7 +2381,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c835479a4443ded371d6c535cbfd8d31ad92c5d23ae9770a61bc155e4992a3c1" dependencies = [ "atomic-waker", - "fastrand 2.4.1", + "fastrand 2.5.0", "futures-io", ] @@ -2644,7 +2412,7 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "451913da69c775a56034ea8d9003d27ee8948e12443eae7c038ba100a4f21cb7" dependencies = [ - "der 0.8.0", + "der 0.8.1", "spki 0.8.0", ] @@ -2703,15 +2471,21 @@ dependencies = [ [[package]] name = "polyval" -version = "0.7.1" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dfc63250416fea14f5749b90725916a6c903f599d51cb635aa7a52bfd03eede" +checksum = "f0fa31d631f2b2cb2a544d0aa321ce847a94764d701ca2becc411138b93d49cd" dependencies = [ "cpubits", "cpufeatures 0.3.0", "universal-hash 0.6.1", ] +[[package]] +name = "portable-atomic" +version = "1.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d20d5497ef88037a52ff98267d066e7f11fcc5e99bbfbd58a42336193aacec3" + [[package]] name = "potential_utf" version = "0.1.5" @@ -2744,9 +2518,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.106" +version = "1.0.107" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934" +checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9" dependencies = [ "unicode-ident", ] @@ -2759,13 +2533,14 @@ checksum = "0c1a41e437b6bbd489372cd4971de128e85c855f56c57f283d20ff016cf7c0a8" dependencies = [ "bytes", "cfg_aliases", + "futures-io", "pin-project-lite", "quinn-proto", "quinn-udp", "rustc-hash", "rustls", - "socket2 0.6.4", - "thiserror 2.0.18", + "socket2 0.6.5", + "thiserror 2.0.19", "tokio", "tracing", "web-time", @@ -2779,6 +2554,7 @@ checksum = "2f4bfc015262b9df63c8845072ce59068853ff5872180c2ce2f13038b970e560" dependencies = [ "aws-lc-rs", "bytes", + "fastbloom", "getrandom 0.4.3", "lru-slab", "rand 0.10.2", @@ -2787,8 +2563,9 @@ dependencies = [ "rustc-hash", "rustls", "rustls-pki-types", + "rustls-platform-verifier", "slab", - "thiserror 2.0.18", + "thiserror 2.0.19", "tinyvec", "tracing", "web-time", @@ -2803,16 +2580,16 @@ dependencies = [ "cfg_aliases", "libc", "once_cell", - "socket2 0.6.4", + "socket2 0.6.5", "tracing", "windows-sys 0.61.2", ] [[package]] name = "quote" -version = "1.0.46" +version = "1.0.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfbc457d0c7a0759a614551b11a6409e5951f6c7537be1f1b7682b9ae9230368" +checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001" dependencies = [ "proc-macro2", ] @@ -2831,9 +2608,9 @@ checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" [[package]] name = "rand" -version = "0.8.6" +version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ca0ecfa931c29007047d1bc58e623ab12e5590e8c7cc53200d5202b69266d8a" +checksum = "22f6172bdec972074665ed81ed53b71da00bfc44b65a753cfde883ec4c702a1a" dependencies = [ "libc", "rand_chacha", @@ -2912,7 +2689,7 @@ version = "0.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" dependencies = [ - "bitflags 2.13.0", + "bitflags 2.13.1", ] [[package]] @@ -2921,44 +2698,9 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c5102a6aaa05aa011a238e178e6bca86d2cb56fc9f586d37cb80f5bca6e07759" dependencies = [ - "bitflags 2.13.0", + "bitflags 2.13.1", ] -[[package]] -name = "regex" -version = "1.12.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1292b7759ae1cb9ec195452d1390a074f0cd8541ab7a5a8c31cd6db45d4a6ba" -dependencies = [ - "aho-corasick", - "memchr", - "regex-automata", - "regex-syntax", -] - -[[package]] -name = "regex-automata" -version = "0.4.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e1dd4122fc1595e8162618945476892eefca7b88c52820e74af6262213cae8f" -dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax", -] - -[[package]] -name = "regex-lite" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cab834c73d247e67f4fae452806d17d3c7501756d98c8808d7c9c7aa7d18f973" - -[[package]] -name = "regex-syntax" -version = "0.8.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4" - [[package]] name = "reqwest" version = "0.13.4" @@ -2969,8 +2711,8 @@ dependencies = [ "bytes", "encoding_rs", "futures-core", - "h2 0.4.15", - "http 1.4.2", + "h2", + "http", "http-body", "http-body-util", "hyper", @@ -3075,7 +2817,7 @@ version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b6fe4565b9518b83ef4f91bb47ce29620ca828bd32cb7e408f0062e9930ba190" dependencies = [ - "bitflags 2.13.0", + "bitflags 2.13.1", "errno", "libc", "linux-raw-sys 0.12.1", @@ -3084,9 +2826,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.23.41" +version = "0.23.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b92b125634d9b795e7beca796cc790df15a7fb38323bf3196fda83292d06b1f" +checksum = "3c54fcab019b409d04215d3a17cb438fd7fbf192ee61461f20f4fe18704bc138" dependencies = [ "aws-lc-rs", "log", @@ -3110,15 +2852,6 @@ dependencies = [ "security-framework", ] -[[package]] -name = "rustls-pemfile" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dce314e5fee3f39953d46bb63bb8a46d40c2f8fb7cc5a3b6cab2bde9721d6e50" -dependencies = [ - "rustls-pki-types", -] - [[package]] name = "rustls-pki-types" version = "1.15.0" @@ -3210,7 +2943,7 @@ version = "3.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b7f4bc775c73d9a02cde8bf7b2ec4c9d12743edf609006c7facc23998404cd1d" dependencies = [ - "bitflags 2.13.0", + "bitflags 2.13.1", "core-foundation 0.10.1", "core-foundation-sys", "libc", @@ -3235,9 +2968,9 @@ checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd" [[package]] name = "serde" -version = "1.0.228" +version = "1.0.229" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" +checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba" dependencies = [ "serde_core", "serde_derive", @@ -3245,22 +2978,22 @@ dependencies = [ [[package]] name = "serde_core" -version = "1.0.228" +version = "1.0.229" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" +checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.228" +version = "1.0.229" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" +checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 3.0.1", ] [[package]] @@ -3303,26 +3036,15 @@ dependencies = [ [[package]] name = "sha1" -version = "0.10.6" +version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" +checksum = "a978451301f4db1d02937a4ab3ccce137717b81826e79b7d49ffe3244a13c3b8" dependencies = [ "cfg-if", "cpufeatures 0.2.17", "digest 0.10.7", ] -[[package]] -name = "sha1" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aacc4cc499359472b4abe1bf11d0b12e688af9a805fa5e3016f9a386dc2d0214" -dependencies = [ - "cfg-if", - "cpufeatures 0.3.0", - "digest 0.11.3", -] - [[package]] name = "sha2" version = "0.10.9" @@ -3404,15 +3126,15 @@ dependencies = [ [[package]] name = "simd-adler32" -version = "0.3.9" +version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "703d5c7ef118737c72f1af64ad2f6f8c5e1921f818cdcb97b8fe6fc69bf66214" +checksum = "3a219298ac11a56ea9a6d2120044824d6f01aeb034955e7af7bc16858527deea" [[package]] name = "simd_cesu8" -version = "1.1.1" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94f90157bb87cddf702797c5dadfa0be7d266cdf49e22da2fcaa32eff75b2c33" +checksum = "11031e251abf8611c80f460e19dbdeb54a66db918e49c65a7065b46ac7aec520" dependencies = [ "rustc_version", "simdutf8", @@ -3424,6 +3146,12 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e" +[[package]] +name = "siphasher" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ee5873ec9cce0195efcb7a4e9507a04cd49aec9c83d0389df45b1ef7ba2e649" + [[package]] name = "slab" version = "0.4.12" @@ -3451,19 +3179,9 @@ dependencies = [ [[package]] name = "socket2" -version = "0.5.10" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e22376abed350d73dd1cd119b57ffccad95b4e585a7cda43e286245ce23c0678" -dependencies = [ - "libc", - "windows-sys 0.52.0", -] - -[[package]] -name = "socket2" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52d1cfed4120b4d927bf7c0f86d2087a4a7d6027c906d9f9d525a80573b9be51" +checksum = "c3d1e2c7f27f8d4cb10542a02c49005dbd6e93095799d6f3be745fae9f8fedd4" dependencies = [ "libc", "windows-sys 0.61.2", @@ -3471,9 +3189,9 @@ dependencies = [ [[package]] name = "spin" -version = "0.9.8" +version = "0.9.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" +checksum = "3763264f6b73151db08c50ff20d7d8a0b8796e021cdea7ceedad07b80155fa0e" dependencies = [ "lock_api", ] @@ -3495,7 +3213,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d9efca8738c78ee9484207732f728b1ef517bbb1833d6fc0879ca898a522f6f" dependencies = [ "base64ct", - "der 0.8.0", + "der 0.8.1", ] [[package]] @@ -3546,7 +3264,7 @@ dependencies = [ "serde_json", "sha2 0.10.9", "smallvec", - "thiserror 2.0.18", + "thiserror 2.0.19", "tracing", "url", ] @@ -3561,7 +3279,7 @@ dependencies = [ "quote", "sqlx-core", "sqlx-macros-core", - "syn", + "syn 2.0.119", ] [[package]] @@ -3585,7 +3303,7 @@ dependencies = [ "sqlx-mysql", "sqlx-postgres", "sqlx-sqlite", - "syn", + "syn 2.0.119", "url", ] @@ -3597,7 +3315,7 @@ checksum = "aa003f0038df784eb8fecbbac13affe3da23b45194bd57dba231c8f48199c526" dependencies = [ "atoi", "base64", - "bitflags 2.13.0", + "bitflags 2.13.1", "byteorder", "bytes", "crc", @@ -3618,15 +3336,15 @@ dependencies = [ "memchr", "once_cell", "percent-encoding", - "rand 0.8.6", + "rand 0.8.7", "rsa", "serde", - "sha1 0.10.6", + "sha1", "sha2 0.10.9", "smallvec", "sqlx-core", "stringprep", - "thiserror 2.0.18", + "thiserror 2.0.19", "tracing", "whoami", ] @@ -3639,7 +3357,7 @@ checksum = "db58fcd5a53cf07c184b154801ff91347e4c30d17a3562a635ff028ad5deda46" dependencies = [ "atoi", "base64", - "bitflags 2.13.0", + "bitflags 2.13.1", "byteorder", "crc", "dotenvy", @@ -3656,14 +3374,14 @@ dependencies = [ "md-5", "memchr", "once_cell", - "rand 0.8.6", + "rand 0.8.7", "serde", "serde_json", "sha2 0.10.9", "smallvec", "sqlx-core", "stringprep", - "thiserror 2.0.18", + "thiserror 2.0.19", "tracing", "whoami", ] @@ -3687,7 +3405,7 @@ dependencies = [ "serde", "serde_urlencoded", "sqlx-core", - "thiserror 2.0.18", + "thiserror 2.0.19", "tracing", "url", ] @@ -3724,7 +3442,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn", + "syn 2.0.119", ] [[package]] @@ -3735,9 +3453,20 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "syn" -version = "2.0.118" +version = "2.0.119" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b9ae57f904213ebb649ce6895b8a66c66f0203b9319718f69a5612a065b1422" +checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "3.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5edbec4ed188954a10c12c038215f8ce7606b2d5c973cd8dc43e8795065c5f2f" dependencies = [ "proc-macro2", "quote", @@ -3761,7 +3490,7 @@ checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.119", ] [[package]] @@ -3770,7 +3499,7 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a13f3d0daba03132c0aa9767f98351b3488edc2c100cda2d2ec2b04f3d8d3c8b" dependencies = [ - "bitflags 2.13.0", + "bitflags 2.13.1", "core-foundation 0.9.4", "system-configuration-sys", ] @@ -3796,11 +3525,11 @@ dependencies = [ [[package]] name = "thiserror" -version = "2.0.18" +version = "2.0.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4" +checksum = "09a43598840e33d5b0331f38c5e30d13bb11c11210a4b58f0d9b18a5a5eefcd9" dependencies = [ - "thiserror-impl 2.0.18", + "thiserror-impl 2.0.19", ] [[package]] @@ -3811,18 +3540,18 @@ checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.119", ] [[package]] name = "thiserror-impl" -version = "2.0.18" +version = "2.0.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5" +checksum = "43cbfe0cf76104d42a574802844187e84a305e531ed54455f11fbde0f10541cd" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 3.0.1", ] [[package]] @@ -3867,9 +3596,9 @@ dependencies = [ [[package]] name = "tinyvec" -version = "1.11.0" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e61e67053d25a4e82c844e8424039d9745781b3fc4f32b8d55ed50f5f667ef3" +checksum = "bb4ebadaa0af04fab11ae01eb5f9fdb5f9c5b875506e210e71c07873528baa7f" dependencies = [ "tinyvec_macros", ] @@ -3882,9 +3611,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.52.3" +version = "1.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fc7f01b389ac15039e4dc9531aa973a135d7a4135281b12d7c1bc79fd57fffe" +checksum = "d988bcd52dbe076d3d46903332f58c912b87a2c49b1428419a5845154762ffee" dependencies = [ "bytes", "libc", @@ -3892,20 +3621,20 @@ dependencies = [ "parking_lot", "pin-project-lite", "signal-hook-registry", - "socket2 0.6.4", + "socket2 0.6.5", "tokio-macros", "windows-sys 0.61.2", ] [[package]] name = "tokio-macros" -version = "2.7.0" +version = "2.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "385a6cb71ab9ab790c5fe8d67f1645e6c450a7ce006a33de03daa956cf70a496" +checksum = "6328af13490e73a9b4694030fafd93f8c8c6a9dede33e821c3fc63eddf8042ba" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.119", ] [[package]] @@ -3952,10 +3681,10 @@ version = "0.6.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4cfcf7e2740e6fc6d4d688b4ef00650406bb94adf4731e43c096c3a19fe40840" dependencies = [ - "bitflags 2.13.0", + "bitflags 2.13.1", "bytes", "futures-util", - "http 1.4.2", + "http", "http-body", "pin-project-lite", "tower", @@ -3996,7 +3725,7 @@ checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.119", ] [[package]] @@ -4047,18 +3776,6 @@ version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7df058c713841ad818f1dc5d3fd88063241cc61f49f5fbea4b951e8cf5a8d71d" -[[package]] -name = "unicode-segmentation" -version = "1.13.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6f5d3c3b1bf09027a88a6bc961fc00497d651009560b5463668dc81b0fa87a8" - -[[package]] -name = "unicode-xid" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" - [[package]] name = "universal-hash" version = "0.5.1" @@ -4117,9 +3834,9 @@ checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" [[package]] name = "uuid" -version = "1.23.4" +version = "1.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf80a72845275afea99e7f2b434723d3bc7e38470fcd1c7ed39a599c73319a53" +checksum = "bf3923a6f5c4c6382e0b653c4117f48d631ea17f38ed86e2a828e6f7412f5239" dependencies = [ "getrandom 0.4.3", "js-sys", @@ -4128,9 +3845,9 @@ dependencies = [ [[package]] name = "value-bag" -version = "1.12.0" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ba6f5989077681266825251a52748b8c1d8a4ad098cc37e440103d0ea717fc0" +checksum = "5dd4ec1eb1d240636e354a30110a1dfcb37047169a4d9bd6d9d3469df574b5c4" [[package]] name = "vcpkg" @@ -4232,7 +3949,7 @@ dependencies = [ "bumpalo", "proc-macro2", "quote", - "syn", + "syn 2.0.119", "wasm-bindgen-shared", ] @@ -4267,9 +3984,9 @@ dependencies = [ [[package]] name = "webpki-root-certs" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d46a5a140e6f7afeccd8eae97eff335163939eac8b929834875168b29b3d267" +checksum = "b96554aa2acc8ccdb7e1c9a58a7a68dd5d13bccc69cd124cb09406db612a1c9b" dependencies = [ "rustls-pki-types", ] @@ -4524,8 +4241,8 @@ dependencies = [ "rustls-native-certs", "rustls-pki-types", "sha2 0.11.0", - "socket2 0.6.4", - "thiserror 2.0.18", + "socket2 0.6.5", + "thiserror 2.0.19", "time", "tokio", "tracing", @@ -4542,7 +4259,7 @@ checksum = "d5867c629e4252f7439d82315923daaf27f4fa442410d51b78ab93ef4c432a11" dependencies = [ "httlib-huffman", "octets", - "thiserror 2.0.18", + "thiserror 2.0.19", "url", ] @@ -4584,7 +4301,7 @@ dependencies = [ "oid-registry", "ring", "rusticata-macros", - "thiserror 2.0.18", + "thiserror 2.0.19", "time", ] @@ -4617,28 +4334,28 @@ checksum = "de844c262c8848816172cef550288e7dc6c7b7814b4ee56b3e1553f275f1858e" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.119", "synstructure", ] [[package]] name = "zerocopy" -version = "0.8.53" +version = "0.8.54" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75726053136156d419e285b9b7eddaaea9e3fea6ce32eed44a89901f0bd98de1" +checksum = "b7cbbc0a705a0fd05cc3676525980d2bf5a9bc4adac6d6475209a7887cf59d19" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.8.53" +version = "0.8.54" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4714fd92cf900833d49538023a9b3915155210801d1c1169eba513b2addefd71" +checksum = "e2e817b7b52d0c7358d3246da9d69935ebb18116b2b102b4230dac079b4862f5" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.119", ] [[package]] @@ -4658,7 +4375,7 @@ checksum = "11532158c46691caf0f2593ea8358fed6bbf68a0315e80aae9bd41fbade684a1" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.119", "synstructure", ] @@ -4679,7 +4396,7 @@ checksum = "3c50655cbb0fe3fc43170059e702f1ce5e19b84cec58dc87b037a09935c2f328" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.119", ] [[package]] @@ -4712,7 +4429,7 @@ checksum = "625dc425cab0dca6dc3c3319506e6593dcb08a9f387ea3b284dbd52a92c40555" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.119", ] [[package]] @@ -4735,7 +4452,7 @@ dependencies = [ "memchr", "pbkdf2", "ppmd-rust", - "sha1 0.10.6", + "sha1", "time", "zeroize", "zopfli", @@ -4744,15 +4461,15 @@ dependencies = [ [[package]] name = "zlib-rs" -version = "0.6.5" +version = "0.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5431d5661c32445236631278f27946e444ddafe4684cac70b185272d4f9c52d5" +checksum = "b142a20ec14a91d5bc708c1dc21b080c550113d8aa77afa29635673a65dd02c5" [[package]] name = "zmij" -version = "1.0.21" +version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8848ee67ecc8aedbaf3e4122217aff892639231befc6a1b58d29fff4c2cabaa" +checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b" [[package]] name = "zopfli" diff --git a/Cargo.toml b/Cargo.toml index d3de686..e601d1a 100755 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,20 +5,21 @@ edition = "2024" [dependencies] mtp = { git = "https://git.methanium.net/methanium/mtp", features = [ - "host", "crypto", "files", + "web-server", ] } -actix-web = { version = "4.12.1", features = ["rustls-0_23"] } aes-gcm = "*" ansi_term = "0.12.1" anyhow = "1.0.101" base64 = "0.22.1" +bytes = "1" dashmap = "6.1.0" dotenv = "0.15.0" hex = "0.4.3" hkdf = "0.12.4" +http = "1" json = "0.12.4" once_cell = "1.21.3" rand = "0.8" @@ -30,7 +31,6 @@ rustls = { version = "0.23.37", default-features = false, features = [ "aws-lc-rs", "prefer-post-quantum", ] } -rustls-pemfile = "2.2.0" sha2 = "0.10.9" sqlx = { version = "0.8.6", features = ["mysql", "runtime-async-std"] } strum = "0.27.2" @@ -40,6 +40,3 @@ uuid = { version = "1.19.0", features = ["v4"] } x448 = "0.6.0" zip = "6.0.0" thiserror = "2.0.18" -mtp-crypto = { git = "https://git.methanium.net/methanium/mtp", version = "0.1.0", features = [ - "pqc", -] } diff --git a/src/main.rs b/src/main.rs index 2abf3a0..9e35297 100644 --- a/src/main.rs +++ b/src/main.rs @@ -10,8 +10,8 @@ use crate::util::file_util::get_directory; use crate::util::logger::PrintType; use crate::util::logger::startup; use dotenv::from_path; -use mtp::files::{load_keyring as load_keyring_file, save_keyring, save_public_key_bundle}; -use mtp_crypto::Keyring; +use mtp::files::{load_keyring_raw, save_keyring_raw, save_public_key_bundle}; +use mtp::crypto::Keyring; use once_cell::sync::Lazy; use rustls::crypto::aws_lc_rs::default_provider; use std::env; @@ -20,9 +20,9 @@ use std::path::Path; const KEYRING_PATH: &str = "./omega.mk"; static KEYRING: Lazy = Lazy::new(|| { - load_keyring_file(KEYRING_PATH).unwrap_or_else(|_| { + load_keyring_raw(KEYRING_PATH).unwrap_or_else(|_| { let kr = Keyring::generate(); - save_keyring(&kr, KEYRING_PATH).expect("Failed to save generated keyring"); + save_keyring_raw(&kr, KEYRING_PATH).expect("Failed to save generated keyring"); save_public_key_bundle(&kr.public_key_bundle(), KEYRING_PATH) .expect("Failed to save generated public key bundle"); eprintln!("Generated new keyring at {}", KEYRING_PATH); @@ -48,18 +48,6 @@ async fn main() { log_in!("Incoming messages"); log_out!("Outgoing messages"); - let omikron_port: u16 = env::var("OMIKRON_PORT") - .ok() - .and_then(|s| s.parse().ok()) - .unwrap_or(9187); - - let omikron_handle = tokio::spawn(async move { - match omikron_connection::start(omikron_port).await { - Err(e) => log_err!(0, PrintType::General, "{:?}", e), - _ => {} - } - }); - log!("Started"); log!(" .env"); if let Err(e) = initialize_db().await { @@ -77,13 +65,13 @@ async fn main() { log!(" Users"); } - let api_port: u16 = env::var("API_PORT") + let port: u16 = env::var("PORT") .ok() .and_then(|s| s.parse().ok()) - .unwrap_or(9188); + .unwrap_or(443); tokio::select! { - result = server::server::start(api_port) => { + result = omikron_connection::start(port) => { if let Err(e) = result { log_err!(0, PrintType::General, "Server error: {:?}", e); } @@ -92,6 +80,4 @@ async fn main() { log!("Shutting down on signal..."); } } - - omikron_handle.abort(); } diff --git a/src/server/api.rs b/src/server/api.rs index c8aeeb9..6471398 100644 --- a/src/server/api.rs +++ b/src/server/api.rs @@ -4,24 +4,31 @@ use crate::sql::sql::{get_by_user_id, get_iota_by_id, get_omikron_by_id}; use crate::sql::user_online_tracker::{get_all_connections, get_iota_primary_omikron_connection}; use crate::transport::omikron_manager::get_random_omikron; use crate::util::file_util::get_directory; -use actix_web::HttpResponse; -use actix_web::http::{StatusCode, header}; use base64::Engine as _; +use bytes::Bytes; +use http::{Method, StatusCode}; use json::JsonValue; +use mtp::webserver::{Http3Request, Http3Response, RouteParams}; -pub async fn handle(path: &str, body_string: Option) -> HttpResponse { - if path == "OPTIONS" { - return HttpResponse::Ok() - .insert_header(("Access-Control-Allow-Origin", "*")) - .insert_header(("Access-Control-Allow-Methods", "GET, POST, OPTIONS")) - .insert_header(("Access-Control-Allow-Headers", "*")) - .finish(); +pub async fn handle(request: Http3Request, response: Http3Response) -> Http3Response { + let method = request.method; + let path = request.uri.path().to_string(); + let body_string = request + .body + .map(|body| String::from_utf8_lossy(&body).to_string()); + + if method == Method::OPTIONS { + return response + .status(StatusCode::OK) + .header("access-control-allow-origin", "*") + .header("access-control-allow-methods", "GET, POST, OPTIONS") + .header("access-control-allow-headers", "*"); } - let path_parts: Vec<&str> = path.split("/").filter(|s| !s.is_empty()).collect(); + let path_parts: Vec<&str> = path.split('/').filter(|s| !s.is_empty()).collect(); - let _body: Option = if body_string.is_some() { - if let Ok(body_json) = json::parse(&body_string.unwrap()) { + let _body: Option = if let Some(ref bs) = body_string { + if let Ok(body_json) = json::parse(bs) { Some(body_json) } else { None @@ -39,20 +46,22 @@ pub async fn handle(path: &str, body_string: Option) -> HttpResponse { match std::fs::read(file_path) { Ok(file_bytes) => { - return HttpResponse::Ok() - .insert_header(("Access-Control-Allow-Origin", "*")) - .insert_header(("Content-Type", "application/zip")) - .insert_header(( - "Content-Disposition", + return response + .status(StatusCode::OK) + .header("access-control-allow-origin", "*") + .header("content-type", "application/zip") + .header( + "content-disposition", "attachment; filename=\"iota_frontend.zip\"", - )) - .body(file_bytes); + ) + .body(Bytes::from(file_bytes)); } Err(_) => { let mut res = JsonValue::new_object(); res["status"] = "error_not_found".into(); - return HttpResponse::NotFound() - .insert_header(("Access-Control-Allow-Origin", "*")) + return response + .status(StatusCode::NOT_FOUND) + .header("access-control-allow-origin", "*") .body(res.dump()); } } @@ -309,6 +318,23 @@ pub async fn handle(path: &str, body_string: Option) -> HttpResponse { } } + // ================================================== + // DIRECT - SHORT LINK RESOLUTION + // ================================================== + ["direct", short @ ..] => { + let short_str = short.join("/"); + let short = short_str.replace("/", ""); + if let Ok(long) = crate::server::short_link::get_short_link(&short).await { + return response + .status(StatusCode::TEMPORARY_REDIRECT) + .header("location", &long); + } else { + return response + .status(StatusCode::TEMPORARY_REDIRECT) + .header("location", "https://tensamin.net"); + } + } + // ================================================== // DEFAULT // ================================================== @@ -318,11 +344,19 @@ pub async fn handle(path: &str, body_string: Option) -> HttpResponse { (StatusCode::INTERNAL_SERVER_ERROR, res.dump()) } }; - let body_bytes = body_text.into_bytes(); - HttpResponse::build(status) - .insert_header((header::ACCESS_CONTROL_ALLOW_ORIGIN, "*")) - .insert_header((header::ACCESS_CONTROL_ALLOW_HEADERS, "*")) - .insert_header((header::ACCESS_CONTROL_ALLOW_METHODS, "GET, POST, OPTIONS")) - .body(body_bytes) + response + .status(status) + .header("access-control-allow-origin", "*") + .header("access-control-allow-headers", "*") + .header("access-control-allow-methods", "GET, POST, OPTIONS") + .body(body_text) +} + +pub async fn handle_pattern( + request: Http3Request, + response: Http3Response, + _params: RouteParams, +) -> Http3Response { + handle(request, response).await } diff --git a/src/server/index.rs b/src/server/index.rs index 1d302b1..b121209 100644 --- a/src/server/index.rs +++ b/src/server/index.rs @@ -1,6 +1,7 @@ -use actix_web::{HttpResponse, Responder}; +use http::StatusCode; +use mtp::webserver::Http3Response; -pub async fn index_handler() -> impl Responder { +pub fn index_handler(response: Http3Response) -> Http3Response { let documentation = r#" Omega API Server @@ -11,7 +12,8 @@ Available Routes: All other routes will return this documentation. "#; - HttpResponse::Ok() - .content_type("text/plain; charset=utf-8") + response + .status(StatusCode::OK) + .header("content-type", "text/plain; charset=utf-8") .body(documentation) } diff --git a/src/server/server.rs b/src/server/server.rs index 3c7fc05..f88e267 100644 --- a/src/server/server.rs +++ b/src/server/server.rs @@ -1,69 +1,19 @@ -use crate::{ - log, - server::{api, index::index_handler, short_link::get_short_link}, - util::file_util::load_file_buf, -}; +use crate::server::{api, index::index_handler}; +use mtp::webserver::WebServerConfig; -use actix_web::{App, HttpRequest, HttpResponse, HttpServer, Responder, http::header, web}; - -use rustls::ServerConfig; -use rustls::pki_types::{CertificateDer, PrivateKeyDer}; -use rustls_pemfile::{certs, pkcs8_private_keys}; - -pub async fn start(port: u16) -> anyhow::Result<()> { - let mut cert_reader = load_file_buf("certs", "server_cert.pem")?; - - let mut key_reader = load_file_buf("certs", "server_key.pem")?; - - let cert_chain: Vec> = - certs(&mut cert_reader).collect::>()?; - - let mut keys: Vec> = pkcs8_private_keys(&mut key_reader) - .map(|res| res.map(Into::into)) - .collect::>()?; - - let key = keys.remove(0); - - let mut config = ServerConfig::builder() - .with_no_client_auth() - .with_single_cert(cert_chain, key)?; - - config.alpn_protocols = vec![b"h2".to_vec(), b"http/1.1".to_vec()]; - - let bind_addr = std::env::var("BIND_ADDRESS").unwrap_or_else(|_| "0.0.0.0".to_string()); - let addr = format!("{}:{}", bind_addr, port); - log!(" Server on {}", addr); - - HttpServer::new(move || { - App::new() - .route("/api/{path:.*}", web::to(api_handler)) - .route("/direct/{path:.*}", web::to(direct_handler)) - .default_service(web::to(index_handler)) - }) - .bind_rustls_0_23(addr, config)? - .run() - .await?; - - Ok(()) -} -async fn direct_handler(req: HttpRequest) -> impl Responder { - let path = req.uri().path().to_string(); - let short = path.replace("/direct/", ""); - - if let Ok(long) = get_short_link(&short).await { - HttpResponse::TemporaryRedirect() - .append_header((header::LOCATION, long)) - .finish() - } else { - HttpResponse::TemporaryRedirect() - .append_header((header::LOCATION, "https://tensamin.net")) - .finish() - } -} - -async fn api_handler(req: HttpRequest, body: web::Bytes) -> HttpResponse { - let path = req.uri().path().to_string(); - let body_string = String::from_utf8_lossy(&body).to_string(); - - api::handle(&path, Some(body_string)).await +pub fn build_web_config() -> Result { + WebServerConfig::new() + .route( + "/", + |_request, response| async move { index_handler(response) }, + )? + .route("/api/download/iota_frontend", api::handle)? + .route("/api/get/omikron", api::handle)? + .route("/api/get/connections", api::handle)? + .route("/api/get/public_key", api::handle)? + .route_pattern("/api/get/omikron/{id}", api::handle_pattern)? + .route_pattern("/api/get/iota/{id}", api::handle_pattern)? + .route_pattern("/api/get/id/{username}", api::handle_pattern)? + .route_pattern("/api/get/user/{id}", api::handle_pattern)? + .route_pattern("/direct/{short}", api::handle_pattern) } diff --git a/src/sql/sql.rs b/src/sql/sql.rs index da6d1bc..91cd5ba 100644 --- a/src/sql/sql.rs +++ b/src/sql/sql.rs @@ -1,5 +1,5 @@ use crate::log; -use mtp_crypto::PublicKeyBundle; +use mtp::crypto::PublicKeyBundle; use once_cell::sync::Lazy; use sqlx::{MySql, Pool, Row, mysql::MySqlPoolOptions}; use std::sync::atomic::{AtomicU64, Ordering}; @@ -202,7 +202,7 @@ pub async fn get_by_username( let sub_level: i32 = row.get("sub_level"); let sub_end: i64 = row.get("sub_end"); let public_key = PublicKeyBundle::from_bytes(&row.get::, _>("public_key")) - .map_err(|e| sqlx::Error::Decode(Box::new(e)))?; + .map_err(|e| sqlx::Error::Decode(Box::new(e)))?; let private_key_hash: Vec = row.get("private_key_hash"); let token: Vec = row.get("token"); @@ -271,7 +271,7 @@ pub async fn get_by_user_id( let sub_level: i32 = row.get("sub_level"); let sub_end: i64 = row.get("sub_end"); let public_key = PublicKeyBundle::from_bytes(&row.get::, _>("public_key")) - .map_err(|e| sqlx::Error::Decode(Box::new(e)))?; + .map_err(|e| sqlx::Error::Decode(Box::new(e)))?; let private_key_hash: Vec = row.get("private_key_hash"); let token: Vec = row.get("token"); @@ -607,7 +607,10 @@ pub async fn create_new_iota(public_key: PublicKeyBundle) -> Result Result<(), sqlx::Error> { +pub async fn register_complete_iota( + id: i64, + public_key: PublicKeyBundle, +) -> Result<(), sqlx::Error> { let pool = { let db_lock = SQL_DB.read().await; db_lock diff --git a/src/transport/omikron_connection.rs b/src/transport/omikron_connection.rs index 2da779d..6a5517e 100644 --- a/src/transport/omikron_connection.rs +++ b/src/transport/omikron_connection.rs @@ -1,6 +1,6 @@ use crate::{ load_keyring, log, log_cv_in, log_cv_out, log_err, log_in, - server::short_link::add_short_link, + server::{self, short_link::add_short_link}, sql::{ connection_status::UserStatus, sql::{self, get_by_user_id, get_by_username, get_iota_by_id}, @@ -11,12 +11,10 @@ use crate::{ }; use base64::{Engine as _, engine::general_purpose::STANDARD}; use dashmap::DashMap; -use mtp::host::{AuthenticationPolicy, Receiver, Sender}; -use mtp::{ - codec::{CommunicationType, CommunicationValue, DataType, DataValue}, - host::{Host, HostConfig, Policy, SendMode}, -}; -use mtp_crypto::PublicKeyBundle; +use mtp::codec::{CommunicationType, CommunicationValue, DataType, DataValue}; +use mtp::host::{AuthenticationPolicy, HostConfig, Policy, SendMode}; +use mtp::webserver::{MTPWebServer, WebMtpReceiver, WebMtpSender}; +use mtp::crypto::PublicKeyBundle; use std::net::{IpAddr, Ipv4Addr}; use std::{ sync::Arc, @@ -26,17 +24,10 @@ use tokio::{ sync::{Mutex, RwLock}, time::interval, }; -// ============================================================================ -// Configuration -// ============================================================================ const CLEANUP_INTERVAL: Duration = Duration::from_secs(30); const MAX_WAITING_AGE: Duration = Duration::from_secs(60); -// ============================================================================ -// Error Types -// ============================================================================ - #[derive(Debug, thiserror::Error)] pub enum OmikronError { #[error("Not connected")] @@ -55,22 +46,14 @@ pub enum OmikronError { pub type OmikronResult = Result; -// ============================================================================ -// Waiting Task System (Preserved from original) -// ============================================================================ - pub struct WaitingTask { pub task: Box, CommunicationValue) -> bool + Send + Sync>, pub inserted_at: Instant, } -// ============================================================================ -// Omikron Connection (mtp/QUIC-based) -// ============================================================================ - pub struct OmikronConnection { id: u64, - sender: Mutex>, + sender: Mutex>, pub ping: RwLock, waiting_tasks: DashMap, cleanup_handle: std::sync::Mutex>>, @@ -85,11 +68,7 @@ impl Drop for OmikronConnection { } impl OmikronConnection { - // ------------------------------------------------------------------------- - // Construction - // ------------------------------------------------------------------------- - - pub fn new(sender: Sender, id: u64) -> Arc { + pub fn new(sender: WebMtpSender, id: u64) -> Arc { let conn = Arc::new(Self { id, sender: Mutex::new(Some(sender)), @@ -101,18 +80,13 @@ impl OmikronConnection { conn } - // ------------------------------------------------------------------------- - // Main Handler Loop - // ------------------------------------------------------------------------- - - pub async fn handle(self: Arc, receiver: &mut Receiver) { + pub async fn handle(self: Arc, receiver: &mut WebMtpReceiver) { log_in!( self.id as i64, PrintType::Omega, "Omikron connection started" ); - // Start cleanup task let cleanup_conn = self.clone(); let cleanup_handle = tokio::spawn(async move { let mut ticker = interval(CLEANUP_INTERVAL); @@ -142,10 +116,6 @@ impl OmikronConnection { ); } - // ------------------------------------------------------------------------- - // Message Processing - // ------------------------------------------------------------------------- - async fn process_message(self: Arc, cv: CommunicationValue) -> OmikronResult<()> { if !cv.is_type(CommunicationType::Pong) && !cv.is_type(CommunicationType::Ping) { log_cv_in!(PrintType::Omikron, &cv); @@ -153,18 +123,15 @@ impl OmikronConnection { let msg_id = cv.get_id(); - // Check waiting tasks first (response to previous request) if let Some((_, task)) = self.waiting_tasks.remove(&msg_id) { let _ = (task.task)(self.clone(), cv); return Ok(()); } - // Handle ping regardless of message type if cv.is_type(CommunicationType::Ping) { return self.handle_ping(cv).await; } - // Authentication is completed by the mtp host before this connection exists. let omikron_id = self.id as i64; self.clone().handle_authenticated(cv, omikron_id).await } @@ -176,10 +143,8 @@ impl OmikronConnection { ) -> OmikronResult<()> { let comm_type = cv.get_comm_type_enum(); match comm_type { - // Link shortening Some(CommunicationType::ShortenLink) => self.handle_shorten_link(cv).await, - // Online status tracking Some(CommunicationType::UserConnected) => { self.handle_user_connected(cv, omikron_id).await; Ok(()) @@ -234,10 +199,6 @@ impl OmikronConnection { } } - // ------------------------------------------------------------------------- - // Specific Handlers (ported from original WebSocket implementation) - // ------------------------------------------------------------------------- - async fn handle_shorten_link(self: Arc, cv: CommunicationValue) -> OmikronResult<()> { let link = cv .get_data(DataType::Link) @@ -348,7 +309,6 @@ impl OmikronConnection { } async fn handle_get_user_data(self: Arc, cv: CommunicationValue) -> OmikronResult<()> { - // Try by user_id first if let Some(user_id) = cv.get_data(DataType::UserId).as_number() { if let Ok(user_data) = get_by_user_id(user_id as i64).await { let response = self @@ -359,7 +319,6 @@ impl OmikronConnection { } } - // Try by username if let Some(username) = cv.get_data(DataType::Username).as_str() { if let Ok(user_data) = get_by_username(username).await { let response = self @@ -370,7 +329,6 @@ impl OmikronConnection { } } - // Not found let response = CommunicationValue::new(CommunicationType::ErrorNotFound).with_id(cv.get_id()); self.send(&response).await @@ -421,11 +379,9 @@ impl OmikronConnection { ) .add_typed_default(DataType::SubEnd, DataValue::SignedNumber(sub_end.into())); - // Display name (fallback to username) let display_name = display.filter(|d| !d.is_empty()).unwrap_or(username); response = response.add_typed_default(DataType::Display, DataValue::Str(display_name)); - // Optional fields if let Some(s) = status.filter(|s| !s.is_empty()) { response = response.add_typed_default(DataType::Status, DataValue::Str(s)); } @@ -437,7 +393,6 @@ impl OmikronConnection { response.add_typed_default(DataType::Avatar, DataValue::Str(STANDARD.encode(av))); } - // Online status let user_status = user_online_tracker::get_user_status(id); let iota_connections = user_online_tracker::get_iota_omikron_connections(iota_id).unwrap_or_default(); @@ -477,7 +432,6 @@ impl OmikronConnection { } async fn handle_get_iota_data(self: Arc, cv: CommunicationValue) -> OmikronResult<()> { - // Try by iota_id if let Some(iota_id) = cv.get_data(DataType::IotaId).as_number() { if let Ok((iota_id, public_key)) = get_iota_by_id(iota_id as i64).await { let response = self @@ -488,7 +442,6 @@ impl OmikronConnection { } } - // Try by user_id if let Some(user_id) = cv.get_data(DataType::UserId).as_number() { if let Ok((_, iota_id, _, _, _, _, _, _, _, _, _, _)) = get_by_user_id(user_id as i64).await @@ -509,7 +462,6 @@ impl OmikronConnection { } } - // Try by username if let Some(username) = cv.get_data(DataType::Username).as_str() { if let Ok((user_id, iota_id, _, _, _, _, _, _, _, _, _, _)) = get_by_username(username).await @@ -594,7 +546,6 @@ impl OmikronConnection { if let Some(public_key) = public_key { if let Some(iota_id) = iota_id_opt { - // Register existing IOTA match sql::register_complete_iota(iota_id, public_key).await { Ok(_) => { let response = CommunicationValue::new(CommunicationType::Success) @@ -609,7 +560,6 @@ impl OmikronConnection { } } } else { - // Create new IOTA match sql::create_new_iota(public_key).await { Ok(new_iota_id) => { let response = @@ -681,7 +631,6 @@ impl OmikronConnection { let mut success = true; let mut error_message = String::new(); - // Process each field if let Some(username) = cv.get_data(DataType::Username).as_str() { if let Err(e) = sql::change_username(user_id, username.to_string()).await { success = false; @@ -747,7 +696,7 @@ impl OmikronConnection { ) { match sql::get_by_user_id(user_id).await { Ok(user) => { - let current_token = user.11; // reset_token field + let current_token = user.11; if current_token == reset_token { let mut success = true; let mut error_message = String::new(); @@ -889,7 +838,6 @@ impl OmikronConnection { .with_id(cv.get_id()); let _ = self.send(&response).await; - // Sync with other Omikron clients let sync_cv = CommunicationValue::new(CommunicationType::ReadNotification) .with_receiver(receiver_id as u64) .add_typed_default( @@ -926,7 +874,6 @@ impl OmikronConnection { CommunicationValue::new(CommunicationType::PushNotification).with_id(cv.get_id()); let _ = self.send(&response).await; - // Sync with other Omikron clients let push_cv = CommunicationValue::new(CommunicationType::PushNotification) .with_receiver(receiver_id as u64) .add_typed_default( @@ -985,10 +932,6 @@ impl OmikronConnection { self.send(&response).await } - // ------------------------------------------------------------------------- - // Utilities - // ------------------------------------------------------------------------- - async fn send(self: Arc, cv: &CommunicationValue) -> OmikronResult<()> { if !cv.is_type(CommunicationType::Pong) && !cv.is_type(CommunicationType::Ping) { log_cv_out!(PrintType::Omikron, cv); @@ -1060,9 +1003,10 @@ pub async fn complete_register(_pub_key: PublicKeyBundle, _description: Option Result<(), Box> { let cert_pem = load_file_vec("certs", "transport_cert.pem").expect("Error loading Pemfile"); - let key_pem = load_file_vec("certs", "transport_key.pem").expect("Error loading Keyfile"); + let web_config = server::server::build_web_config()?; + let host_config = HostConfig::new( IpAddr::from(Ipv4Addr::new(0, 0, 0, 0)), port, @@ -1072,6 +1016,7 @@ pub async fn start(port: u16) -> Result<(), Box> { .with_policy(Policy { send_mode: SendMode::SingleStreamPerMessage, max_message_size: 1_000_000_000, + handshake_max_message_size: 1_000_000, close_frame_len: u32::MAX, application_close_code: 0, open_stream_timeout: Duration::from_millis(2_000), @@ -1081,9 +1026,11 @@ pub async fn start(port: u16) -> Result<(), Box> { keep_alive_interval: Some(Duration::from_secs(6)), max_idle_timeout: Some(Duration::from_secs(30)), force_close_delay: Duration::from_millis(300), - max_transient_recv_errors: 20, - transient_recv_backoff: Duration::from_millis(100), receiver_queue_capacity: 1000, + max_concurrent_stream_tasks: 10, + persistent_stream_max_retries: 5, + persistent_stream_retry_backoff: Duration::from_secs(5), + max_frames_per_stream: None, }) .with_authentication( load_keyring(), @@ -1092,17 +1039,14 @@ pub async fn start(port: u16) -> Result<(), Box> { ) .with_authentication_policy(AuthenticationPolicy::ForceAuthentication); - let mut host: Host = Host::new(host_config).await?; - log!("OmikronServer listening on port {}", port); + let mut server = MTPWebServer::new(host_config, web_config).await?; + log!("OmegaServer listening on port {}", port); loop { - let mut conn = match host.accept().await { + let mut conn = match server.accept().await { Ok(Some(conn)) => conn, Ok(None) => break, Err(e) => { - // A single omikron's failed/aborted handshake (bad auth, a - // probe, a mid-handshake disconnect) must not take down the - // whole listener - only that connection attempt is lost. log_err!(0, PrintType::Omega, "Rejected omikron connection: {}", e); continue; } diff --git a/type-maps.yaml b/type-maps.yaml index 3659921..ce3d5e6 100644 --- a/type-maps.yaml +++ b/type-maps.yaml @@ -170,7 +170,7 @@ type_maps: CallState: 49 ScreenShare: 50 PrivateKeyHash: 51 - Accepted: 52 + # Accepted: 52 now part of default MTP AcceptedProfiles: 53 DeniedProfiles: 54 Content: 55