commit 95c1ec2b9664dd0fd3010bf1b23d9c3b83ff3716 Author: Dreaded_X Date: Fri Apr 4 12:39:04 2025 +0200 Initial implementation diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e8a755f --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/target +key.pem diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..13bfb41 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,2248 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "addr2line" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler2" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" + +[[package]] +name = "aead" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d122413f284cf2d62fb1b7db97e02edb8cda96d769b16e443a4f6195e35662b0" +dependencies = [ + "crypto-common", + "generic-array", +] + +[[package]] +name = "aes" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + +[[package]] +name = "aes-gcm" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "831010a0f742e1209b3bcea8fab6a8e149051ba6099432c8cb2cc117dec3ead1" +dependencies = [ + "aead", + "aes", + "cipher", + "ctr", + "ghash", + "subtle", +] + +[[package]] +name = "aho-corasick" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" +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 = "argon2" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c3610892ee6e0cbce8ae2700349fcf8f98adb0dbfbee85aec3c9179d29cc072" +dependencies = [ + "base64ct", + "blake2", + "cpufeatures", + "password-hash", +] + +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + +[[package]] +name = "autocfg" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" + +[[package]] +name = "backtrace" +version = "0.3.74" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d82cb332cdfaed17ae235a638438ac4d4839913cc2af585c3c6746e8f8bee1a" +dependencies = [ + "addr2line", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", + "windows-targets", +] + +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + +[[package]] +name = "base64ct" +version = "1.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89e25b6adfb930f02d1981565a6e5d9c547ac15a96606256d3b59040e5cd4ca3" + +[[package]] +name = "bcrypt-pbkdf" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6aeac2e1fe888769f34f05ac343bbef98b14d1ffb292ab69d4608b3abc86f2a2" +dependencies = [ + "blowfish", + "pbkdf2", + "sha2", +] + +[[package]] +name = "bitflags" +version = "2.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c8214115b7bf84099f1309324e63141d4c5d7cc26862f97a0a857dbefe165bd" + +[[package]] +name = "blake2" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe" +dependencies = [ + "digest", +] + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "block-padding" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8894febbff9f758034a5b8e12d87918f56dfc64a8e1fe757d65e29041538d93" +dependencies = [ + "generic-array", +] + +[[package]] +name = "blowfish" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e412e2cd0f2b2d93e02543ceae7917b3c70331573df19ee046bcbc35e45e87d7" +dependencies = [ + "byteorder", + "cipher", +] + +[[package]] +name = "bumpalo" +version = "3.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1628fb46dfa0b37568d12e5edd512553eccf6a22a78e8bde00bb4aed84d5bdbf" + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + +[[package]] +name = "bytes" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a" + +[[package]] +name = "cbc" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26b52a9543ae338f279b96b0b9fed9c8093744685043739079ce85cd58f289a6" +dependencies = [ + "cipher", +] + +[[package]] +name = "cc" +version = "1.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fcb57c740ae1daf453ae85f16e37396f672b039e00d9d866e07ddb24e328e3a" +dependencies = [ + "shlex", +] + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "cfg_aliases" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" + +[[package]] +name = "chacha20" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3613f74bd2eac03dad61bd53dbe620703d4371614fe0bc3b9f04dd36fe4e818" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + +[[package]] +name = "chrono" +version = "0.4.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a7964611d71df112cb1730f2ee67324fcf4d0fc6606acbbe9bfe06df124637c" +dependencies = [ + "android-tzdata", + "iana-time-zone", + "js-sys", + "num-traits", + "wasm-bindgen", + "windows-link", +] + +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", +] + +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + +[[package]] +name = "cpufeatures" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" +dependencies = [ + "libc", +] + +[[package]] +name = "crc32fast" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "crypto-bigint" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" +dependencies = [ + "generic-array", + "rand_core", + "subtle", + "zeroize", +] + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "rand_core", + "typenum", +] + +[[package]] +name = "ctr" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0369ee1ad671834580515889b80f2ea915f23b8be8d0daa4bbaf2ac5c7590835" +dependencies = [ + "cipher", +] + +[[package]] +name = "curve25519-dalek" +version = "4.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be" +dependencies = [ + "cfg-if", + "cpufeatures", + "curve25519-dalek-derive", + "digest", + "fiat-crypto", + "rustc_version", + "subtle", + "zeroize", +] + +[[package]] +name = "curve25519-dalek-derive" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "data-encoding" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "575f75dfd25738df5b91b8e43e14d44bda14637a58fae779fd2b064f8bf3e010" + +[[package]] +name = "delegate" +version = "0.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9b6483c2bbed26f97861cf57651d4f2b731964a28cd2257f934a4b452480d21" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "der" +version = "0.7.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" +dependencies = [ + "const-oid", + "pem-rfc7468", + "zeroize", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "const-oid", + "crypto-common", + "subtle", +] + +[[package]] +name = "ecdsa" +version = "0.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" +dependencies = [ + "der", + "digest", + "elliptic-curve", + "rfc6979", + "signature", + "spki", +] + +[[package]] +name = "ed25519" +version = "2.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53" +dependencies = [ + "pkcs8", + "signature", +] + +[[package]] +name = "ed25519-dalek" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a3daa8e81a3963a60642bcc1f90a670680bd4a77535faa384e9d1c79d620871" +dependencies = [ + "curve25519-dalek", + "ed25519", + "rand_core", + "serde", + "sha2", + "subtle", + "zeroize", +] + +[[package]] +name = "elliptic-curve" +version = "0.13.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" +dependencies = [ + "base16ct", + "crypto-bigint", + "digest", + "ff", + "generic-array", + "group", + "hkdf", + "pem-rfc7468", + "pkcs8", + "rand_core", + "sec1", + "subtle", + "zeroize", +] + +[[package]] +name = "enum_dispatch" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa18ce2bc66555b3218614519ac839ddb759a7d6720732f979ef8d13be147ecd" +dependencies = [ + "once_cell", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "equivalent" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" + +[[package]] +name = "ff" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0b50bfb653653f9ca9095b427bed08ab8d75a137839d9ad64eb11810d5b6393" +dependencies = [ + "rand_core", + "subtle", +] + +[[package]] +name = "fiat-crypto" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" + +[[package]] +name = "flate2" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11faaf5a5236997af9848be0bef4db95824b1d534ebc64d0f0c6cf3e67bd38dc" +dependencies = [ + "crc32fast", + "miniz_oxide", +] + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "futures" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" + +[[package]] +name = "futures-executor" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-io" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" + +[[package]] +name = "futures-macro" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "futures-sink" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" + +[[package]] +name = "futures-task" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" + +[[package]] +name = "futures-util" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "pin-utils", + "slab", +] + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", + "zeroize", +] + +[[package]] +name = "getrandom" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "wasi", + "wasm-bindgen", +] + +[[package]] +name = "ghash" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0d8a4362ccb29cb0b265253fb0a2728f592895ee6854fd9bc13f2ffda266ff1" +dependencies = [ + "opaque-debug", + "polyval", +] + +[[package]] +name = "gimli" +version = "0.31.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" + +[[package]] +name = "group" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" +dependencies = [ + "ff", + "rand_core", + "subtle", +] + +[[package]] +name = "h2" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5017294ff4bb30944501348f6f8e42e6ad28f42c8bbef7a74029aff064a4e3c2" +dependencies = [ + "atomic-waker", + "bytes", + "fnv", + "futures-core", + "futures-sink", + "http", + "indexmap", + "slab", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "hashbrown" +version = "0.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "hex-literal" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" + +[[package]] +name = "hkdf" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" +dependencies = [ + "hmac", +] + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", +] + +[[package]] +name = "home" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589533453244b0995c858700322199b2becb13b627df2851f64a2775d024abcf" +dependencies = [ + "windows-sys 0.59.0", +] + +[[package]] +name = "http" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4a85d31aea989eead29a3aaf9e1115a180df8282431156e533de47660892565" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "http-body" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" +dependencies = [ + "bytes", + "http", +] + +[[package]] +name = "http-body-util" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b021d93e26becf5dc7e1b75b1bed1fd93124b374ceb73f43d4d4eafec896a64a" +dependencies = [ + "bytes", + "futures-core", + "http", + "http-body", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "httparse" +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 = "hyper" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc2b571658e38e0c01b1fdca3bbbe93c00d3d71693ff2770043f8c29bc7d6f80" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "h2", + "http", + "http-body", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "smallvec", + "tokio", + "want", +] + +[[package]] +name = "hyper-util" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "497bbc33a26fdd4af9ed9c70d63f61cf56a938375fbb32df34db9b1cd6d643f2" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "http", + "http-body", + "hyper", + "libc", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", +] + +[[package]] +name = "iana-time-zone" +version = "0.1.62" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2fd658b06e56721792c5df4475705b6cda790e9298d19d2f8af083457bcd127" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "log", + "wasm-bindgen", + "windows-core 0.52.0", +] + +[[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 = "indexmap" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3954d50fe15b02142bf25d3b8bdadb634ec3948f103d04ffe3031bc8fe9d7058" +dependencies = [ + "equivalent", + "hashbrown", +] + +[[package]] +name = "inout" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" +dependencies = [ + "block-padding", + "generic-array", +] + +[[package]] +name = "internal-russh-forked-ssh-key" +version = "0.6.10+upstream-0.6.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33555bd765ace379fe85d97bb6d48b5783054f6048a7d5ec24cd9155e490e266" +dependencies = [ + "argon2", + "bcrypt-pbkdf", + "ecdsa", + "ed25519-dalek", + "hex", + "hmac", + "num-bigint-dig", + "p256", + "p384", + "p521", + "rand_core", + "rsa", + "sec1", + "sha1", + "sha2", + "signature", + "ssh-cipher", + "ssh-encoding", + "subtle", + "zeroize", +] + +[[package]] +name = "itoa" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" + +[[package]] +name = "js-sys" +version = "0.3.77" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1cfaf33c695fc6e08064efbc1f72ec937429614f25eef83af942d0e227c3a28f" +dependencies = [ + "once_cell", + "wasm-bindgen", +] + +[[package]] +name = "lazy_static" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" +dependencies = [ + "spin", +] + +[[package]] +name = "libc" +version = "0.2.171" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c19937216e9d3aa9956d9bb8dfc0b0c8beb6058fc4f7a4dc4d850edf86a237d6" + +[[package]] +name = "libm" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8355be11b20d696c8f18f6cc018c4e372165b1fa8126cef092399c9951984ffa" + +[[package]] +name = "lock_api" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" +dependencies = [ + "autocfg", + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" + +[[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 = "md5" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "490cc448043f947bae3cbee9c203358d62dbee0db12107a74be5c30ccfd09771" + +[[package]] +name = "memchr" +version = "2.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" + +[[package]] +name = "miniz_oxide" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e3e04debbb59698c15bacbb6d93584a8c0ca9cc3213cb423d31f760d8843ce5" +dependencies = [ + "adler2", +] + +[[package]] +name = "mio" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2886843bf800fba2e3377cff24abf6379b4c4d5c6681eaf9ea5b0d15090450bd" +dependencies = [ + "libc", + "wasi", + "windows-sys 0.52.0", +] + +[[package]] +name = "nix" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46" +dependencies = [ + "bitflags", + "cfg-if", + "cfg_aliases", + "libc", +] + +[[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-bigint" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" +dependencies = [ + "num-integer", + "num-traits", + "rand", +] + +[[package]] +name = "num-bigint-dig" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc84195820f291c7697304f3cbdadd1cb7199c0efc917ff5eafd71225c136151" +dependencies = [ + "byteorder", + "lazy_static", + "libm", + "num-integer", + "num-iter", + "num-traits", + "rand", + "smallvec", + "zeroize", +] + +[[package]] +name = "num-integer" +version = "0.1.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-iter" +version = "0.1.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", + "libm", +] + +[[package]] +name = "object" +version = "0.36.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62948e14d923ea95ea2c7c86c71013138b66525b86bdc08d2dcc262bdb497b87" +dependencies = [ + "memchr", +] + +[[package]] +name = "once_cell" +version = "1.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" + +[[package]] +name = "opaque-debug" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" + +[[package]] +name = "overload" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" + +[[package]] +name = "p256" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9863ad85fa8f4460f9c48cb909d38a0d689dba1f6f6988a5e3e0d31071bcd4b" +dependencies = [ + "ecdsa", + "elliptic-curve", + "primeorder", + "sha2", +] + +[[package]] +name = "p384" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe42f1670a52a47d448f14b6a5c61dd78fce51856e68edaa38f7ae3a46b8d6b6" +dependencies = [ + "ecdsa", + "elliptic-curve", + "primeorder", + "sha2", +] + +[[package]] +name = "p521" +version = "0.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fc9e2161f1f215afdfce23677034ae137bbd45016a880c2eb3ba8eb95f085b2" +dependencies = [ + "base16ct", + "ecdsa", + "elliptic-curve", + "primeorder", + "rand_core", + "sha2", +] + +[[package]] +name = "pageant" +version = "0.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bdd27df01428302f915ea74737fe88170dd1bab4cbd00ff9548ca85618fcd4e4" +dependencies = [ + "bytes", + "delegate", + "futures", + "log", + "rand", + "thiserror", + "tokio", + "windows", +] + +[[package]] +name = "parking_lot" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-targets", +] + +[[package]] +name = "password-hash" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "346f04948ba92c43e8469c1ee6736c7563d71012b17d40745260fe106aac2166" +dependencies = [ + "base64ct", + "rand_core", + "subtle", +] + +[[package]] +name = "pbkdf2" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2" +dependencies = [ + "digest", + "hmac", +] + +[[package]] +name = "pem-rfc7468" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88b39c9bfcfc231068454382784bb460aae594343fb030d46e9f50a645418412" +dependencies = [ + "base64ct", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "pkcs1" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8ffb9f10fa047879315e6625af03c164b16962a5368d724ed16323b68ace47f" +dependencies = [ + "der", + "pkcs8", + "spki", +] + +[[package]] +name = "pkcs5" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e847e2c91a18bfa887dd028ec33f2fe6f25db77db3619024764914affe8b69a6" +dependencies = [ + "aes", + "cbc", + "der", + "pbkdf2", + "scrypt", + "sha2", + "spki", +] + +[[package]] +name = "pkcs8" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" +dependencies = [ + "der", + "pkcs5", + "rand_core", + "spki", +] + +[[package]] +name = "poly1305" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8159bd90725d2df49889a078b54f4f79e87f1f8a8444194cdca81d38f5393abf" +dependencies = [ + "cpufeatures", + "opaque-debug", + "universal-hash", +] + +[[package]] +name = "polyval" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d1fe60d06143b2430aa532c94cfe9e29783047f06c0d7fd359a9a51b729fa25" +dependencies = [ + "cfg-if", + "cpufeatures", + "opaque-debug", + "universal-hash", +] + +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] + +[[package]] +name = "primeorder" +version = "0.13.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "353e1ca18966c16d9deb1c69278edbc5f194139612772bd9537af60ac231e1e6" +dependencies = [ + "elliptic-curve", +] + +[[package]] +name = "proc-macro2" +version = "1.0.94" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a31971752e70b8b2686d7e46ec17fb38dad4051d94024c88df49b667caea9c84" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha", + "rand_core", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom", +] + +[[package]] +name = "redox_syscall" +version = "0.5.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b8c0c260b63a8219631167be35e6a988e9554dbd323f8bd08439c8ed1302bd1" +dependencies = [ + "bitflags", +] + +[[package]] +name = "regex" +version = "1.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" +dependencies = [ + "aho-corasick", + "memchr", + "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]] +name = "regex-automata" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" +dependencies = [ + "aho-corasick", + "memchr", + "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 = "rfc6979" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" +dependencies = [ + "hmac", + "subtle", +] + +[[package]] +name = "rsa" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78928ac1ed176a5ca1d17e578a1825f3d81ca54cf41053a592584b020cfd691b" +dependencies = [ + "const-oid", + "digest", + "num-bigint-dig", + "num-integer", + "num-traits", + "pkcs1", + "pkcs8", + "rand_core", + "sha2", + "signature", + "spki", + "subtle", + "zeroize", +] + +[[package]] +name = "russh" +version = "0.51.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4816b748109d26daa30e72d231a3a6e42f9e2fffe6c08cbfed63113db0ce884" +dependencies = [ + "aes", + "aes-gcm", + "bitflags", + "block-padding", + "byteorder", + "bytes", + "cbc", + "chacha20", + "ctr", + "curve25519-dalek", + "data-encoding", + "delegate", + "der", + "digest", + "ecdsa", + "ed25519-dalek", + "elliptic-curve", + "enum_dispatch", + "flate2", + "futures", + "generic-array", + "getrandom", + "hex-literal", + "hmac", + "home", + "inout", + "internal-russh-forked-ssh-key", + "log", + "md5", + "num-bigint", + "once_cell", + "p256", + "p384", + "p521", + "pageant", + "pbkdf2", + "pkcs1", + "pkcs5", + "pkcs8", + "poly1305", + "rand", + "rand_core", + "rsa", + "russh-cryptovec", + "russh-util", + "sec1", + "sha1", + "sha2", + "signature", + "spki", + "ssh-encoding", + "subtle", + "thiserror", + "tokio", + "typenum", + "zeroize", +] + +[[package]] +name = "russh-cryptovec" +version = "0.51.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b722480e7117893a8a14ba22298dca3387b24fa1c40eb06f3105b82875c7497" +dependencies = [ + "libc", + "log", + "nix", + "ssh-encoding", + "winapi", +] + +[[package]] +name = "russh-util" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0c3f1ba8f8ccbe1af83c1a5dc325ecb0b6e176d1444c241c1d684ab216d1b24" +dependencies = [ + "chrono", + "tokio", + "wasm-bindgen", + "wasm-bindgen-futures", +] + +[[package]] +name = "rustc-demangle" +version = "0.1.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" + +[[package]] +name = "rustc_version" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" +dependencies = [ + "semver", +] + +[[package]] +name = "rustversion" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eded382c5f5f786b989652c49544c4877d9f015cc22e145a5ea8ea66c2921cd2" + +[[package]] +name = "ryu" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" + +[[package]] +name = "salsa20" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97a22f5af31f73a954c10289c93e8a50cc23d971e80ee446f1f6f7137a088213" +dependencies = [ + "cipher", +] + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "scrypt" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0516a385866c09368f0b5bcd1caff3366aace790fcd46e2bb032697bb172fd1f" +dependencies = [ + "pbkdf2", + "salsa20", + "sha2", +] + +[[package]] +name = "sec1" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +dependencies = [ + "base16ct", + "der", + "generic-array", + "pkcs8", + "subtle", + "zeroize", +] + +[[package]] +name = "semver" +version = "1.0.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56e6fa9c48d24d85fb3de5ad847117517440f6beceb7798af16b4a87d616b8d0" + +[[package]] +name = "serde" +version = "1.0.219" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.219" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.140" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20068b6e96dc6c9bd23e01df8827e6c7e1f2fddd43c21810382803c136b99373" +dependencies = [ + "itoa", + "memchr", + "ryu", + "serde", +] + +[[package]] +name = "sha1" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "sha2" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "sharded-slab" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" +dependencies = [ + "lazy_static", +] + +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[package]] +name = "signal-hook-registry" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9e9e0b4211b72e7b8b6e85c807d36c212bdb33ea8587f7569562a84df5465b1" +dependencies = [ + "libc", +] + +[[package]] +name = "signature" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" +dependencies = [ + "digest", + "rand_core", +] + +[[package]] +name = "slab" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" +dependencies = [ + "autocfg", +] + +[[package]] +name = "smallvec" +version = "1.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fcf8323ef1faaee30a44a340193b1ac6814fd9b7b4e88e9d4519a3e4abe1cfd" + +[[package]] +name = "socket2" +version = "0.5.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f5fd57c80058a56cf5c777ab8a126398ece8e442983605d280a44ce79d0edef" +dependencies = [ + "libc", + "windows-sys 0.52.0", +] + +[[package]] +name = "spin" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" + +[[package]] +name = "spki" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" +dependencies = [ + "base64ct", + "der", +] + +[[package]] +name = "ssh-cipher" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "caac132742f0d33c3af65bfcde7f6aa8f62f0e991d80db99149eb9d44708784f" +dependencies = [ + "aes", + "aes-gcm", + "cbc", + "chacha20", + "cipher", + "ctr", + "poly1305", + "ssh-encoding", + "subtle", +] + +[[package]] +name = "ssh-encoding" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb9242b9ef4108a78e8cd1a2c98e193ef372437f8c22be363075233321dd4a15" +dependencies = [ + "base64ct", + "bytes", + "pem-rfc7468", + "sha2", +] + +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + +[[package]] +name = "syn" +version = "2.0.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b09a44accad81e1ba1cd74a32461ba89dee89095ba17b32f5d03683b1b1fc2a0" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "thiserror" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "thread_local" +version = "1.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b9ef9bad013ada3808854ceac7b46812a6465ba368859a37e2100283d2d719c" +dependencies = [ + "cfg-if", + "once_cell", +] + +[[package]] +name = "tokio" +version = "1.44.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f382da615b842244d4b8738c82ed1275e6c5dd90c459a30941cd07080b06c91a" +dependencies = [ + "backtrace", + "bytes", + "libc", + "mio", + "parking_lot", + "pin-project-lite", + "signal-hook-registry", + "socket2", + "tokio-macros", + "windows-sys 0.52.0", +] + +[[package]] +name = "tokio-macros" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e06d43f1345a3bcd39f6a56dbb7dcab2ba47e68e8ac134855e7e2bdbaf8cab8" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tokio-util" +version = "0.7.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b9590b93e6fcc1739458317cccd391ad3955e2bde8913edf6f95f9e65a8f034" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "tower-service" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" + +[[package]] +name = "tracing" +version = "0.1.41" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" +dependencies = [ + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "395ae124c09f9e6918a2310af6038fba074bcf474ac352496d5910dd59a2226d" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tracing-core" +version = "0.1.33" +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 = [ + "matchers", + "nu-ansi-term", + "once_cell", + "regex", + "serde", + "serde_json", + "sharded-slab", + "smallvec", + "thread_local", + "tracing", + "tracing-core", + "tracing-log", + "tracing-serde", +] + +[[package]] +name = "try-lock" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" + +[[package]] +name = "tunnel_rs" +version = "0.1.0" +dependencies = [ + "bytes", + "http-body-util", + "hyper", + "hyper-util", + "rand", + "russh", + "tokio", + "tracing", + "tracing-subscriber", +] + +[[package]] +name = "typenum" +version = "1.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1dccffe3ce07af9386bfd29e80c0ab1a8205a2fc34e4bcd40364df902cfa8f3f" + +[[package]] +name = "unicode-ident" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" + +[[package]] +name = "universal-hash" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc1de2c688dc15305988b563c3854064043356019f97a4b46276fe734c4f07ea" +dependencies = [ + "crypto-common", + "subtle", +] + +[[package]] +name = "valuable" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65" + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "want" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" +dependencies = [ + "try-lock", +] + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "wasm-bindgen" +version = "0.2.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5" +dependencies = [ + "cfg-if", + "once_cell", + "rustversion", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f0a0651a5c2bc21487bde11ee802ccaf4c51935d0d3d42a6101f98161700bc6" +dependencies = [ + "bumpalo", + "log", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.50" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "555d470ec0bc3bb57890405e5d4322cc9ea83cebb085523ced7be4144dac1e61" +dependencies = [ + "cfg-if", + "js-sys", + "once_cell", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fe63fc6d09ed3792bd0897b314f53de8e16568c2b3f7982f468c0bf9bd0b407" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a05d73b933a847d6cccdda8f838a22ff101ad9bf93e33684f39c1f5f0eece3d" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "web-sys" +version = "0.3.77" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33b6dd2ef9186f1f2072e409e99cd22a975331a6b3591b12c764e0e55c60d5d2" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[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-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows" +version = "0.58.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd04d41d93c4992d421894c18c8b43496aa748dd4c081bac0dc93eb0489272b6" +dependencies = [ + "windows-core 0.58.0", + "windows-targets", +] + +[[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-core" +version = "0.58.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ba6d44ec8c2591c134257ce647b7ea6b20335bf6379a27dac5f1641fcf59f99" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-result", + "windows-strings", + "windows-targets", +] + +[[package]] +name = "windows-implement" +version = "0.58.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bbd5b46c938e506ecbce286b6628a02171d56153ba733b6c741fc627ec9579b" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "windows-interface" +version = "0.58.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "053c4c462dc91d3b1504c6fe5a726dd15e216ba718e84a0e46a88fbe5ded3515" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "windows-link" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76840935b766e1b0a05c0066835fb9ec80071d4c09a16f6bd5f7e655e3c14c38" + +[[package]] +name = "windows-result" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d1043d8214f791817bab27572aaa8af63732e11bf84aa21a45a78d6c317ae0e" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-strings" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cd9b125c486025df0eabcb585e62173c6c9eddcec5d117d3b6e8c30e2ee4d10" +dependencies = [ + "windows-result", + "windows-targets", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "zerocopy" +version = "0.8.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2586fea28e186957ef732a5f8b3be2da217d65c5969d4b1e17f973ebbe876879" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a996a8f63c5c4448cd959ac1bab0aaa3306ccfd060472f85943ee0750f0169be" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "zeroize" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..8201d0d --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,16 @@ +[package] +name = "tunnel_rs" +version = "0.1.0" +edition = "2024" +default-run = "tunnel_rs" + +[dependencies] +bytes = "1.10.1" +http-body-util = { version = "0.1.3", features = ["full"] } +hyper = { version = "1.6.0", features = ["full"] } +hyper-util = { version = "0.1.11", features = ["full"] } +rand = "0.8.5" +russh = "0.51.1" +tokio = { version = "1.44.1", features = ["full"] } +tracing = "0.1.41" +tracing-subscriber = { version = "0.3.19", features = ["json", "env-filter"] } diff --git a/src/animals.rs b/src/animals.rs new file mode 100644 index 0000000..6e5f2f8 --- /dev/null +++ b/src/animals.rs @@ -0,0 +1,14 @@ +use std::sync::LazyLock; + +use rand::{rngs::OsRng, seq::SliceRandom}; + +pub fn get_animal_name() -> &'static str { + static ANIMALS: LazyLock> = LazyLock::new(|| { + let animals = include_str!("./animals.txt"); + animals.lines().collect() + }); + + ANIMALS + .choose(&mut OsRng) + .expect("List should not be empty") +} diff --git a/src/animals.txt b/src/animals.txt new file mode 100644 index 0000000..d90bc70 --- /dev/null +++ b/src/animals.txt @@ -0,0 +1,1750 @@ +aardvark +aardwolf +abalone +abyssiniancat +abyssiniangroundhornbill +acaciarat +achillestang +acornbarnacle +acornweevil +acornwoodpecker +acouchi +adamsstaghornedbeetle +addax +adder +adeliepenguin +admiralbutterfly +adouri +aegeancat +affenpinscher +afghanhound +africanaugurbuzzard +africanbushviper +africancivet +africanclawedfrog +africanelephant +africanfisheagle +africangoldencat +africangroundhornbill +africanharrierhawk +africanhornbill +africanjacana +africanmolesnake +africanparadiseflycatcher +africanpiedkingfisher +africanporcupine +africanrockpython +africanwildcat +africanwilddog +agama +agouti +aidi +airedale +airedaleterrier +akitainu +alabamamapturtle +alaskajingle +alaskanhusky +alaskankleekai +alaskanmalamute +albacoretuna +albatross +albertosaurus +albino +aldabratortoise +allensbigearedbat +alleycat +alligator +alligatorgar +alligatorsnappingturtle +allosaurus +alpaca +alpinegoat +alpineroadguidetigerbeetle +altiplanochinchillamouse +amazondolphin +amazonparrot +amazontreeboa +amberpenshell +ambushbug +americanalligator +americanavocet +americanbadger +americanbittern +americanblackvulture +americanbobtail +americanbulldog +americancicada +americancrayfish +americancreamdraft +americancrocodile +americancrow +americancurl +americangoldfinch +americanindianhorse +americankestrel +americanlobster +americanmarten +americanpainthorse +americanquarterhorse +americanratsnake +americanredsquirrel +americanriverotter +americanrobin +americansaddlebred +americanshorthair +americantoad +americanwarmblood +americanwigeon +americanwirehair +amethystgemclam +amethystinepython +amethystsunbird +ammonite +amoeba +amphibian +amphiuma +amurminnow +amurratsnake +amurstarfish +anaconda +anchovy +andalusianhorse +andeancat +andeancockoftherock +andeancondor +anemone +anemonecrab +anemoneshrimp +angelfish +angelwingmussel +anglerfish +angora +angwantibo +anhinga +ankole +ankolewatusi +annashummingbird +annelid +annelida +anole +anophelesmosquito +ant +antarcticfurseal +antarcticgiantpetrel +antbear +anteater +antelope +antelopegroundsquirrel +antipodesgreenparakeet +antlion +anura +aoudad +apatosaur +ape +aphid +apisdorsatalaboriosa +aplomadofalcon +appaloosa +aquaticleech +arabianhorse +arabianoryx +arabianwildcat +aracari +arachnid +arawana +archaeocete +archaeopteryx +archerfish +arcticduck +arcticfox +arctichare +arcticseal +arcticwolf +argali +argentinehornedfrog +argentineruddyduck +argusfish +arieltoucan +arizonaalligatorlizard +arkshell +armadillo +armedcrab +armednylonshrimp +armyant +armyworm +arrowana +arrowcrab +arrowworm +arthropods +aruanas +asianconstablebutterfly +asiandamselfly +asianelephant +asianlion +asianpiedstarling +asianporcupine +asiansmallclawedotter +asiantrumpetfish +asianwaterbuffalo +asiaticgreaterfreshwaterclam +asiaticlesserfreshwaterclam +asiaticmouflon +asiaticwildass +asp +ass +assassinbug +astarte +astrangiacoral +atlanticblackgoby +atlanticbluetang +atlanticridleyturtle +atlanticsharpnosepuffer +atlanticspadefish +atlasmoth +attwatersprairiechicken +auk +auklet +aurochs +australiancattledog +australiancurlew +australianfreshwatercrocodile +australianfurseal +australiankelpie +australiankestrel +australianshelduck +australiansilkyterrier +austrianpinscher +avians +avocet +axisdeer +axolotl +ayeaye +aztecant +azurevase +azurevasesponge +azurewingedmagpie +babirusa +baboon +backswimmer +bactrian +badger +bagworm +baiji +baldeagle +baleenwhale +balloonfish +ballpython +bandicoot +bangeltiger +bantamrooster +banteng +barasinga +barasingha +barb +barbet +barebirdbat +barnacle +barnowl +barnswallow +barracuda +basenji +basil +basilisk +bass +bassethound +bat +bats +beagle +bear +beardedcollie +beardeddragon +beauceron +beaver +bedbug +bedlingtonterrier +bee +beetle +bellfrog +bellsnake +belugawhale +bengaltiger +bergerpicard +bernesemountaindog +betafish +bettong +bichonfrise +bighorn +bighornedsheep +bighornsheep +bigmouthbass +bilby +billygoat +binturong +bird +birdofparadise +bison +bittern +blackandtancoonhound +blackbear +blackbird +blackbuck +blackcrappie +blackfish +blackfly +blackfootedferret +blacklab +blacklemur +blackmamba +blacknorwegianelkhound +blackpanther +blackrhino +blackrussianterrier +blackwidowspider +blesbok +blobfish +blowfish +blueandgoldmackaw +bluebird +bluebottle +bluebottlejellyfish +bluebreastedkookaburra +bluefintuna +bluefish +bluegill +bluejay +bluemorphobutterfly +blueshark +bluet +bluetickcoonhound +bluetonguelizard +bluewhale +boa +boaconstrictor +boar +bobcat +bobolink +bobwhite +boilweevil +bongo +bonobo +booby +bordercollie +borderterrier +borer +borzoi +boto +boubou +boutu +bovine +brahmanbull +brahmancow +brant +bream +brocketdeer +bronco +brontosaurus +brownbear +brownbutterfly +bubblefish +buck +buckeyebutterfly +budgie +bufeo +buffalo +bufflehead +bug +bull +bullfrog +bullmastiff +bumblebee +bunny +bunting +burro +bushbaby +bushsqueaker +bustard +butterfly +buzzard +caecilian +caiman +caimanlizard +calf +camel +canadagoose +canary +canine +canvasback +capeghostfrog +capybara +caracal +cardinal +caribou +carp +carpenterant +cassowary +cat +catbird +caterpillar +catfish +cats +cattle +caudata +cavy +centipede +cero +chafer +chameleon +chamois +chanticleer +cheetah +chevrotain +chick +chickadee +chicken +chihuahua +chimneyswift +chimpanzee +chinchilla +chinesecrocodilelizard +chipmunk +chital +chrysalis +chrysomelid +chuckwalla +chupacabra +cicada +cirriped +civet +clam +cleanerwrasse +clingfish +clownanemonefish +clumber +coati +cob +cobra +cock +cockatiel +cockatoo +cockerspaniel +cockroach +cod +coelacanth +collardlizard +collie +colt +comet +commabutterfly +commongonolek +conch +condor +coney +conure +cony +coot +cooter +copepod +copperbutterfly +copperhead +coqui +coral +cormorant +cornsnake +corydorascatfish +cottonmouth +cottontail +cougar +cow +cowbird +cowrie +coyote +coypu +crab +crane +cranefly +crayfish +creature +cricket +crocodile +crocodileskink +crossbill +crow +crownofthornsstarfish +crustacean +cub +cuckoo +cur +curassow +curlew +cuscus +cusimanse +cuttlefish +cutworm +cygnet +dachshund +daddylonglegs +dairycow +dalmatian +damselfly +danishswedishfarmdog +darklingbeetle +dartfrog +darwinsfox +dassie +dassierat +davidstiger +deer +deermouse +degu +degus +deinonychus +desertpupfish +devilfish +deviltasmanian +diamondbackrattlesnake +dikdik +dikkops +dingo +dinosaur +diplodocus +dipper +discus +dobermanpinscher +doctorfish +dodo +dodobird +doe +dog +dogfish +dogwoodclubgall +dogwoodtwigborer +dolphin +donkey +dorado +dore +dorking +dormouse +dotterel +douglasfirbarkbeetle +dove +dowitcher +drafthorse +dragon +dragonfly +drake +drever +dromaeosaur +dromedary +drongo +duck +duckbillcat +duckbillplatypus +duckling +dugong +duiker +dungbeetle +dungenesscrab +dunlin +dunnart +dutchshepherddog +dutchsmoushond +dwarfmongoose +dwarfrabbit +eagle +earthworm +earwig +easternglasslizard +easternnewt +easteuropeanshepherd +eastrussiancoursinghounds +eastsiberianlaika +echidna +eel +eelelephant +eeve +eft +egg +egret +eider +eidolonhelvum +ekaltadeta +eland +electriceel +elephant +elephantbeetle +elephantseal +elk +elkhound +elver +emeraldtreeskink +emperorpenguin +emperorshrimp +emu +englishpointer +englishsetter +equestrian +equine +erin +ermine +erne +eskimodog +esok +estuarinecrocodile +ethiopianwolf +europeanfiresalamander +europeanpolecat +ewe +eyas +eyelashpitviper +eyra +fairybluebird +fairyfly +falcon +fallowdeer +fantail +fanworms +fattaileddunnart +fawn +feline +fennecfox +ferret +fiddlercrab +fieldmouse +fieldspaniel +finch +finnishspitz +finwhale +fireant +firebelliedtoad +firecrest +firefly +fish +fishingcat +flamingo +flatcoatretriever +flatfish +flea +flee +flicker +flickertailsquirrel +flies +flounder +fluke +fly +flycatcher +flyingfish +flyingfox +flyinglemur +flyingsquirrel +foal +fossa +fowl +fox +foxhound +foxterrier +frenchbulldog +freshwatereel +frigatebird +frilledlizard +frillneckedlizard +fritillarybutterfly +frog +frogmouth +fruitbat +fruitfly +fugu +fulmar +funnelweaverspider +furseal +gadwall +galago +galah +galapagosalbatross +galapagosdove +galapagoshawk +galapagosmockingbird +galapagospenguin +galapagossealion +galapagostortoise +gallinule +gallowaycow +gander +gangesdolphin +gannet +gar +gardensnake +garpike +gartersnake +gaur +gavial +gazelle +gecko +geese +gelada +gelding +gemsbok +gemsbuck +genet +gentoopenguin +gerbil +gerenuk +germanpinscher +germanshepherd +germanshorthairedpointer +germanspaniel +germanspitz +germanwirehairedpointer +gharial +ghostshrimp +giantschnauzer +gibbon +gilamonster +giraffe +glassfrog +globefish +glowworm +gnat +gnatcatcher +gnu +goa +goat +godwit +goitered +goldeneye +goldenmantledgroundsquirrel +goldenretriever +goldfinch +goldfish +gonolek +goose +goosefish +gopher +goral +gordonsetter +gorilla +goshawk +gosling +gossamerwingedbutterfly +gourami +grackle +grasshopper +grassspider +grayfox +grayling +grayreefshark +graysquirrel +graywolf +greatargus +greatdane +greathornedowl +greatwhiteshark +grebe +greendarnerdragonfly +greyhounddog +grison +grizzlybear +grosbeak +groundbeetle +groundhog +grouper +grouse +grub +grunion +guanaco +guernseycow +guillemot +guineafowl +guineapig +gull +guppy +gypsymoth +gyrfalcon +hackee +haddock +hadrosaurus +hagfish +hairstreak +hairstreakbutterfly +hake +halcyon +halibut +halicore +hamadryad +hamadryas +hammerheadbird +hammerheadshark +hammerkop +hamster +hanumanmonkey +hapuka +hapuku +harborporpoise +harborseal +hare +harlequinbug +harpseal +harpyeagle +harrier +harrierhawk +hart +hartebeest +harvestmen +harvestmouse +hatchetfish +hawaiianmonkseal +hawk +hectorsdolphin +hedgehog +heifer +hellbender +hen +herald +herculesbeetle +hermitcrab +heron +herring +heterodontosaurus +hind +hippopotamus +hoatzin +hochstettersfrog +hog +hogget +hoiho +hoki +homalocephale +honeybadger +honeybee +honeycreeper +honeyeater +hookersealion +hoopoe +hornbill +hornedtoad +hornedviper +hornet +hornshark +horse +horsechestnutleafminer +horsefly +horsemouse +horseshoebat +horseshoecrab +hound +housefly +hoverfly +howlermonkey +huemul +huia +human +hummingbird +humpbackwhale +husky +hydatidtapeworm +hydra +hyena +hylaeosaurus +hypacrosaurus +hypsilophodon +hyracotherium +hyrax +iaerismetalmark +ibadanmalimbe +iberianbarbel +iberianchiffchaff +iberianemeraldlizard +iberianlynx +iberianmidwifetoad +iberianmole +iberiannase +ibex +ibis +ibisbill +ibizanhound +iceblueredtopzebra +icefish +icelandgull +icelandichorse +icelandicsheepdog +ichidna +ichneumonfly +ichthyosaurs +ichthyostega +icterinewarbler +iggypops +iguana +iguanodon +illadopsis +ilsamochadegu +imago +impala +imperatorangel +imperialeagle +incatern +inchworm +indianabat +indiancow +indianelephant +indianglassfish +indianhare +indianjackal +indianpalmsquirrel +indianpangolin +indianrhinoceros +indianringneckparakeet +indianrockpython +indianskimmer +indianspinyloach +indigobunting +indigowingedparrot +indochinahogdeer +indochinesetiger +indri +indusriverdolphin +inexpectatumpleco +inganue +insect +intermediateegret +invisiblerail +iraniangroundjay +iridescentshark +iriomotecat +irishdraughthorse +irishredandwhitesetter +irishsetter +irishterrier +irishwaterspaniel +irishwolfhound +irrawaddydolphin +irukandjijellyfish +isabellineshrike +isabellinewheatear +islandcanary +islandwhistler +isopod +italianbrownbear +italiangreyhound +ivorybackedwoodswallow +ivorybilledwoodpecker +ivorygull +izuthrush +jabiru +jackal +jackrabbit +jaeger +jaguar +jaguarundi +janenschia +japanesebeetle +javalina +jay +jellyfish +jenny +jerboa +joey +johndory +juliabutterfly +jumpingbean +junco +junebug +kagu +kakapo +kakarikis +kangaroo +karakul +katydid +kawala +kentrosaurus +kestrel +kid +killdeer +killerwhale +killifish +kingbird +kingfisher +kinglet +kingsnake +kinkajou +kiskadee +kissingbug +kite +kitfox +kitten +kittiwake +kitty +kiwi +koala +koalabear +kob +kodiakbear +koi +komododragon +koodoo +kookaburra +kouprey +krill +kronosaurus +kudu +kusimanse +labradorretriever +lacewing +ladybird +ladybug +lamb +lamprey +langur +lark +larva +laughingthrush +lcont +leafbird +leafcutterant +leafhopper +leafwing +leech +lemming +lemur +leonberger +leopard +leopardseal +leveret +lhasaapso +lice +liger +lightningbug +limpet +limpkin +ling +lion +lionfish +littlenightmonkeys +lizard +llama +lobo +lobster +locust +loggerheadturtle +longhorn +longhornbeetle +longspur +loon +lorikeet +loris +louse +lovebird +lowchen +lunamoth +lungfish +lynx +lynx  +macaque +macaw +macropod +madagascarhissingroach +maggot +magpie +maiasaura +majungatholus +malamute +mallard +maltesedog +mamba +mamenchisaurus +mammal +mammoth +manatee +mandrill +mangabey +manta +mantaray +mantid +mantis +mantisray +manxcat +mara +marabou +marbledmurrelet +mare +marlin +marmoset +marmot +marten +martin +massasauga +massospondylus +mastiff +mastodon +mayfly +meadowhawk +meadowlark +mealworm +meerkat +megalosaurus +megalotomusquinquespinosus +megaraptor +merganser +merlin +metalmarkbutterfly +metamorphosis +mice +microvenator +midge +milksnake +milkweedbug +millipede +minibeast +mink +minnow +mite +moa +mockingbird +mole +mollies +mollusk +molly +monarch +mongoose +mongrel +monkey +monkfish  +monoclonius +montanoceratops +moorhen +moose +moray +morayeel +morpho +mosasaur +mosquito +moth +motmot +mouflon +mountaincat +mountainlion +mouse +mouse/mice +mousebird +mudpuppy +mule +mullet +muntjac +murrelet +muskox +muskrat +mussaurus +mussel +mustang +mutt +myna +mynah +myotis  +nabarlek +nag +naga +nagapies +nakedmolerat +nandine +nandoo +nandu +narwhal +narwhale +natterjacktoad +nauplius +nautilus +needlefish +needletail +nematode +nene +neonblueguppy +neonbluehermitcrab +neondwarfgourami +neonrainbowfish +neonredguppy +neontetra +nerka +nettlefish +newfoundlanddog +newt +newtnutria +nightcrawler +nighthawk +nightheron +nightingale +nightjar +nijssenissdwarfchihlid +nilgai +ninebandedarmadillo +noctilio +noctule +noddy +noolbenger +northerncardinals +northernelephantseal +northernflyingsquirrel +northernfurseal +northernhairynosedwombat +northernpike +northernseahorse +northernspottedowl +norwaylobster +norwayrat +nubiangoat +nudibranch +numbat +nurseshark +nutcracker +nuthatch +nutria +nyala +nymph +ocelot +octopus +okapi +olingo +olm +opossum +orangutan +orca +oregonsilverspotbutterfly +oriole +oropendola +oropendula +oryx +osprey +ostracod +ostrich +otter +ovenbird +owl +owlbutterfly +ox +oxen +oxpecker +oyster +ozarkbigearedbat +paca  +pachyderm +pacificparrotlet +paddlefish +paintedladybutterfly +panda +pangolin +panther +paperwasp +papillon +parakeet +parrot +partridge +peacock +peafowl +peccary +pekingese +pelican +pelicinuspetrel +penguin +perch +peregrinefalcon +pewee +phalarope +pharaohhound +pheasant +phoebe +phoenix +pig +pigeon +piglet +pika +pike +pikeperch  +pilchard +pinemarten +pinkriverdolphin +pinniped +pintail +pipistrelle +pipit +piranha +pitbull +pittabird +plainsqueaker +plankton +planthopper +platypus +plover +polarbear +polecat +polliwog +polyp +polyturator +pomeranian +pondskater +pony +pooch +poodle +porcupine +porpoise +portuguesemanofwar +possum +prairiedog +prawn +prayingmantid +prayingmantis +primate +pronghorn +pseudodynerusquadrisectus +ptarmigan +pterodactyls +pterosaurs +puffer +pufferfish +puffin +pug +pullet +puma +pupa +pupfish +puppy +purplemarten +pussycat +pygmy +python +quadrisectus +quagga +quahog +quail +queenalexandrasbirdwing +queenalexandrasbirdwingbutterfly +queenant +queenbee +queenconch +queenslandgrouper +queenslandheeler +queensnake +quelea +quetzal +quetzalcoatlus +quillback +quinquespinosus +quokka +quoll +rabbit +rabidsquirrel +raccoon +racer +racerunner +ragfish +rail +rainbowfish +rainbowlorikeet +rainbowtrout +ram +raptors +rasbora +rat +ratfish +rattail +rattlesnake +raven +ray +redhead +redheadedwoodpecker +redpoll +redstart +redtailedhawk +reindeer +reptile +reynard +rhea +rhesusmonkey +rhino +rhinoceros +rhinocerosbeetle +rhodesianridgeback +ringtailedlemur +ringworm +riograndeescuerzo +roach +roadrunner +roan +robberfly +robin +rockrat +rodent +roebuck +roller +rook +rooster +rottweiler +sable +sableantelope +sablefish  +saiga +sakimonkey +salamander +salmon +saltwatercrocodile +sambar +samoyeddog +sandbarshark +sanddollar +sanderling +sandpiper +sapsucker +sardine +sawfish +scallop +scarab +scarletibis +scaup +schapendoes +schipperke +schnauzer +scorpion +scoter +screamer +seabird +seagull +seahog +seahorse +seal +sealion +seamonkey +seaslug +seaurchin +senegalpython +seriema +serpent +serval +shark +shearwater +sheep +sheldrake +shelduck +shibainu +shihtzu +shorebird +shoveler +shrew +shrike +shrimp +siamang +siamesecat +siberiantiger +sidewinder +sifaka +silkworm +silverfish +silverfox +silversidefish +siskin +skimmer +skink +skipper +skua +skunk +skylark +sloth +slothbear +slug +smelts +smew +snail +snake +snipe +snoutbutterfly +snowdog +snowgeese +snowleopard +snowmonkey +snowyowl +sockeyesalmon +solenodon +solitaire +songbird +sora +southernhairnosedwombat +sow +spadefoot +sparrow +sphinx +spider +spidermonkey +spiketail +spittlebug +sponge +spoonbill +spotteddolphin +spreadwing +springbok +springpeeper +springtail +squab +squamata +squeaker +squid +squirrel +stag +stagbeetle +stallion +starfish +starling +steed +steer +stegosaurus +stickinsect +stickleback +stilt +stingray +stinkbug +stinkpot +stoat +stonefly +stork +stud +sturgeon +sugarglider +sulphurbutterfly +sunbear +sunbittern +sunfish +swallow +swallowtail +swallowtailbutterfly +swan +swellfish +swift +swordfish +tadpole +tahr +takin +tamarin +tanager +tapaculo +tapeworm +tapir +tarantula +tarpan +tarsier +taruca +tasmaniandevil +tasmaniantiger +tattler +tayra +teal +tegus +teledu +tench +tenrec +termite +tern +terrapin +terrier +thoroughbred +thrasher +thrip +thrush +thunderbird +thylacine +tick +tiger +tigerbeetle +tigermoth +tigershark +tilefish +tinamou +titi +titmouse +toad +toadfish +tomtit  +topi +tortoise +toucan +towhee +tragopan +treecreeper +trex +triceratops +trogon +trout +trumpeterbird +trumpeterswan +tsetsefly +tuatara +tuna +turaco +turkey +turnstone +turtle +turtledove +uakari +ugandakob +uintagroundsquirrel +ulyssesbutterfly +umbrellabird +umbrette +unau +ungulate +unicorn +upupa +urchin +urial +uromastyxmaliensis +uromastyxspinipes +urson +urubu +urus +urutu +urva +utahprairiedog +vampirebat +vaquita +veery +velociraptor +velvetcrab +velvetworm +venomoussnake +verdin +vervet +viceroybutterfly +vicuna +viper +viperfish +vipersquid +vireo +virginiaopossum +vixen +vole +volvox +vulpesvelox +vulpesvulpes +vulture +walkingstick +wallaby +wallaroo +walleye +walrus +warbler +warthog +wasp +waterboatman +waterbuck +waterbuffalo +waterbug +waterdogs +waterdragons +watermoccasin +waterstrider +waterthrush +wattlebird +watussi +waxwing +weasel +weaverbird +weevil +westafricanantelope +whale +whapuku +whelp +whimbrel +whippet +whippoorwill +whitebeakeddolphin +whiteeye +whitepelican +whiterhino +whitetaileddeer +whitetippedreefshark +whooper +whoopingcrane +widgeon +widowspider +wildcat +wildebeast +wildebeest +willet +wireworm +wisent +wobbegongshark +wolf +wolfspider +wolverine +wombat +woodborer +woodchuck +woodcock +woodnymphbutterfly +woodpecker +woodstorks +woollybearcaterpillar +worm +wrasse +wreckfish +wren +wrenchbird +wryneck +wuerhosaurus +wyvern +xanclomys +xanthareel +xantus +xantusmurrelet +xeme +xenarthra +xenoposeidon +xenops +xenopterygii +xenopus +xenotarsosaurus +xenurine +xenurusunicinctus +xerus +xiaosaurus +xinjiangovenator +xiphias +xiphiasgladius +xiphosuran +xoloitzcuintli +xoni +xrayfish +xraytetra +xuanhanosaurus +xuanhuaceratops +xuanhuasaurus +yaffle +yak +yapok +yardant +yearling +yellowbelliedmarmot +yellowbellylizard +yellowhammer +yellowjacket +yellowlegs +yellowthroat +yellowwhitebutterfly +yeti +ynambu +yorkshireterrier +yosemitetoad +yucker +zander +zanzibardaygecko +zebra +zebradove +zebrafinch +zebrafish +zebralongwingbutterfly +zebraswallowtailbutterfly +zebratailedlizard +zebu +zenaida +zeren +zethusspinipes +zethuswasp +zigzagsalamander +zonetailedpigeon +zooplankton +zopilote +zorilla diff --git a/src/bin/generate_key.rs b/src/bin/generate_key.rs new file mode 100644 index 0000000..98105d3 --- /dev/null +++ b/src/bin/generate_key.rs @@ -0,0 +1,9 @@ +use std::path::Path; + +use rand::rngs::OsRng; + +fn main() { + let key = russh::keys::PrivateKey::random(&mut OsRng, russh::keys::Algorithm::Ed25519).unwrap(); + key.write_openssh_file(Path::new("./key.pem"), russh::keys::ssh_key::LineEnding::LF) + .unwrap(); +} diff --git a/src/lib.rs b/src/lib.rs new file mode 100644 index 0000000..c2bb831 --- /dev/null +++ b/src/lib.rs @@ -0,0 +1 @@ +pub mod animals; diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..4722fbb --- /dev/null +++ b/src/main.rs @@ -0,0 +1,356 @@ +use std::{ + collections::{HashMap, HashSet}, + net::SocketAddr, + path::Path, + sync::Arc, + time::Duration, +}; + +use bytes::Bytes; +use http_body_util::{BodyExt, Full, combinators::BoxBody}; +use hyper::{ + Method, Request, Response, StatusCode, + client::conn::http1::Builder, + header::HOST, + server::conn::http1::{self}, + service::service_fn, +}; +use hyper_util::rt::TokioIo; +use rand::rngs::OsRng; +use russh::{ + ChannelId, + server::{self, Handle, Server as _}, +}; +use tokio::{ + net::TcpListener, + sync::{ + RwLock, + mpsc::{self, UnboundedReceiver, UnboundedSender}, + }, +}; +use tracing::{debug, error, trace, warn}; +use tracing_subscriber::{EnvFilter, Registry, layer::SubscriberExt, util::SubscriberInitExt}; +use tunnel_rs::animals::get_animal_name; + +fn full>(chunk: T) -> BoxBody { + Full::new(chunk.into()) + .map_err(|never| match never {}) + .boxed() +} + +#[tokio::main] +async fn main() { + let env_filter = EnvFilter::try_from_default_env() + .or_else(|_| EnvFilter::try_new("info")) + .expect("Fallback should be valid"); + + let logger = tracing_subscriber::fmt::layer().compact(); + Registry::default().with(logger).with(env_filter).init(); + + let key = if let Ok(path) = std::env::var("PRIVATE_KEY_FILE") { + russh::keys::PrivateKey::read_openssh_file(Path::new(&path)).unwrap() + } else { + russh::keys::PrivateKey::random(&mut OsRng, russh::keys::Algorithm::Ed25519).unwrap() + }; + + let config = russh::server::Config { + inactivity_timeout: Some(Duration::from_secs(3600)), + auth_rejection_time: Duration::from_secs(3), + auth_rejection_time_initial: Some(Duration::from_secs(0)), + keys: vec![key], + preferred: russh::Preferred { + ..Default::default() + }, + ..Default::default() + }; + + let config = Arc::new(config); + + let mut sh = Server::new(); + + let tunnels = sh.tunnels.clone(); + tokio::spawn(async move { sh.run_on_address(config, ("0.0.0.0", 2222)).await }); + + let service = service_fn(move |req: Request<_>| { + let tunnels = tunnels.clone(); + async move { + if req.method() == Method::CONNECT { + let mut resp = Response::new(full("CONNECT not supported")); + *resp.status_mut() = StatusCode::BAD_REQUEST; + + Ok::<_, hyper::Error>(resp) + } else { + trace!(?req); + let Some(authority) = req + .uri() + .authority() + .as_ref() + .map(|a| a.to_string()) + .or_else(|| { + req.headers() + .get(HOST) + .map(|h| h.to_str().unwrap().to_owned()) + }) + else { + let mut resp = Response::new(full("Missing authority or host header")); + *resp.status_mut() = StatusCode::BAD_REQUEST; + + return Ok::<_, hyper::Error>(resp); + }; + + debug!("Request for {authority:?}"); + + let Some(tunnel) = tunnels.read().await.get(&authority).cloned() else { + let mut resp = Response::new(full(format!("Unknown tunnel: {authority}"))); + *resp.status_mut() = StatusCode::NOT_FOUND; + + return Ok::<_, hyper::Error>(resp); + }; + + debug!("Opening channel"); + let channel = match tunnel + .handle + .channel_open_forwarded_tcpip( + &tunnel.address, + tunnel.port, + &tunnel.address, + tunnel.port, + ) + .await + { + Ok(channel) => channel, + Err(err) => { + warn!("Failed to tunnel: {err}"); + let mut resp = Response::new(full("Failed to open tunnel")); + *resp.status_mut() = StatusCode::INTERNAL_SERVER_ERROR; + + return Ok::<_, hyper::Error>(resp); + } + }; + let io = TokioIo::new(channel.into_stream()); + + let (mut sender, conn) = Builder::new() + .preserve_header_case(true) + .title_case_headers(true) + .handshake(io) + .await?; + + tokio::spawn(async move { + if let Err(err) = conn.await { + warn!("Connection failed: {err}"); + } + }); + + let resp = sender.send_request(req).await.unwrap(); + Ok(resp.map(|b| b.boxed())) + } + } + }); + + let addr = SocketAddr::from(([0, 0, 0, 0], 3000)); + let listener = TcpListener::bind(addr).await.unwrap(); + loop { + let (stream, _) = listener.accept().await.unwrap(); + let io = TokioIo::new(stream); + + let service = service.clone(); + tokio::spawn(async move { + if let Err(err) = http1::Builder::new() + .preserve_header_case(true) + .title_case_headers(true) + .serve_connection(io, service) + .with_upgrades() + .await + { + warn!("Failed to serve connection: {err:?}"); + } + }); + } +} + +#[derive(Debug, Clone)] +struct Tunnel { + handle: Handle, + address: String, + port: u32, +} + +type Tunnels = Arc>>; + +struct Server { + tunnels: Tunnels, +} + +impl Server { + fn new() -> Self { + Server { + tunnels: Arc::new(RwLock::new(HashMap::new())), + } + } +} + +impl server::Server for Server { + type Handler = Handler; + + fn new_client(&mut self, _peer_addr: Option) -> Self::Handler { + let (tx, rx) = mpsc::unbounded_channel::>(); + + Handler { + tx, + rx: Some(rx), + all_tunnels: self.tunnels.clone(), + tunnels: HashSet::new(), + } + } + + fn handle_session_error(&mut self, error: ::Error) { + error!("Session error: {error:#?}"); + } +} + +struct Handler { + tx: UnboundedSender>, + rx: Option>>, + + all_tunnels: Tunnels, + tunnels: HashSet, +} + +impl Handler { + fn send(&self, data: &str) { + let _ = self.tx.send(data.as_bytes().to_vec()); + } + + async fn full_address(&self, address: &str) -> Option { + let all_tunnels = self.all_tunnels.read().await; + + let address = if address == "localhost" { + loop { + let address = get_animal_name(); + if !all_tunnels.contains_key(address) { + break address; + } + } + } else { + if all_tunnels.contains_key(address) { + return None; + } + address + }; + + Some(format!("{address}.tunnel.huizinga.dev")) + } +} + +impl server::Handler for Handler { + type Error = russh::Error; + + async fn channel_open_session( + &mut self, + channel: russh::Channel, + _session: &mut server::Session, + ) -> Result { + debug!("channel_open_session"); + + let Some(mut rx) = self.rx.take() else { + return Err(russh::Error::Inconsistent); + }; + + tokio::spawn(async move { + debug!("Waiting for message to send to client..."); + loop { + let message = rx.recv().await; + debug!("Message!"); + + let Some(message) = message else { break }; + + if channel.data(message.as_ref()).await.is_err() { + break; + } + } + + debug!("Ending receive task"); + }); + + Ok(true) + } + + async fn auth_publickey( + &mut self, + user: &str, + _public_key: &russh::keys::ssh_key::PublicKey, + ) -> Result { + debug!("Login from {user}"); + + // TODO: Get ssh keys associated with user from ldap + Ok(server::Auth::Accept) + } + + async fn data( + &mut self, + _channel: ChannelId, + data: &[u8], + _session: &mut server::Session, + ) -> Result<(), Self::Error> { + if data == [3] { + return Err(russh::Error::Disconnect); + } + + Ok(()) + } + + async fn exec_request( + &mut self, + _channel: ChannelId, + data: &[u8], + _session: &mut server::Session, + ) -> Result<(), Self::Error> { + debug!("exec_request data {data:?}"); + + Ok(()) + } + + async fn tcpip_forward( + &mut self, + address: &str, + port: &mut u32, + session: &mut server::Session, + ) -> Result { + debug!("{address}:{port}"); + + let Some(full_address) = self.full_address(address).await else { + self.send(&format!("{port} => FAILED ({address} already in use)\r\n")); + return Ok(false); + }; + + self.tunnels.insert(full_address.clone()); + self.all_tunnels.write().await.insert( + full_address.clone(), + Tunnel { + handle: session.handle(), + address: address.into(), + port: *port, + }, + ); + + self.send(&format!("{port} => https://{full_address}\r\n")); + + Ok(true) + } +} + +impl Drop for Handler { + fn drop(&mut self) { + let tunnels = self.tunnels.clone(); + let all_tunnels = self.all_tunnels.clone(); + + tokio::spawn(async move { + let mut all_tunnels = all_tunnels.write().await; + for tunnel in tunnels { + all_tunnels.remove(&tunnel); + } + + debug!("{all_tunnels:?}"); + }); + } +}