From 9420c04c5a8a88c1f6a523d5649aec09425b8d05 Mon Sep 17 00:00:00 2001 From: Josiah Bull Date: Sat, 2 Oct 2021 11:50:20 +1300 Subject: [PATCH] feat (auth): Properly implemented auth layer for server-agent. - Will requests a 32-bit random number - Stores and produces this number upon request - Stores public_id properly and uses it to reconnect. --- Cargo.lock | 1011 +++++++------------------------------------------ Cargo.toml | 15 +- config/db.sql | 2 +- src/db.rs | 7 +- src/error.rs | 2 +- src/main.rs | 143 ++++--- 6 files changed, 210 insertions(+), 970 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 815005b..4bea405 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,15 +2,6 @@ # It is not intended for manual editing. version = 3 -[[package]] -name = "aho-corasick" -version = "0.7.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f" -dependencies = [ - "memchr", -] - [[package]] name = "async-trait" version = "0.1.51" @@ -22,48 +13,12 @@ dependencies = [ "syn", ] -[[package]] -name = "atty" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" -dependencies = [ - "hermit-abi", - "libc", - "winapi 0.3.9", -] - -[[package]] -name = "autocfg" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d49d90015b3c36167a20fe2810c5cd875ad504b39cff3d4eae7977e6b7c1cb2" - [[package]] name = "autocfg" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" -[[package]] -name = "base64" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "489d6c0ed21b11d038c31b6ceccca973e65d73ba3bd8ecb9a2babf5546164643" -dependencies = [ - "byteorder", - "safemem", -] - -[[package]] -name = "base64" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b25d992356d2eb0ed82172f5248873db5560c4721f564b13cb5193bda5e668e" -dependencies = [ - "byteorder", -] - [[package]] name = "base64" version = "0.13.0" @@ -85,34 +40,13 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "block-buffer" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" -dependencies = [ - "block-padding", - "byte-tools", - "byteorder", - "generic-array 0.12.4", -] - [[package]] name = "block-buffer" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" dependencies = [ - "generic-array 0.14.4", -] - -[[package]] -name = "block-padding" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa79dedbb091f449f1f39e53edf88d5dbe95f895dae6135a8d7b881fb5af73f5" -dependencies = [ - "byte-tools", + "generic-array", ] [[package]] @@ -131,28 +65,12 @@ version = "3.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9df67f7bf9ef8498769f994239c45613ef0c5899415fb58e9add412d2c1a538" -[[package]] -name = "byte-tools" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" - [[package]] name = "byteorder" version = "1.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" -[[package]] -name = "bytes" -version = "0.4.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "206fdffcfa2df7cbe15601ef46c813fce0965eb3286db6b56c583b814b51c81c" -dependencies = [ - "byteorder", - "iovec", -] - [[package]] name = "bytes" version = "1.1.0" @@ -165,12 +83,6 @@ version = "1.0.70" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d26a6ce4b6a484fa3edb70f7efa6fc430fd2b87285fe8b84304fd0936faa0dc0" -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -188,16 +100,7 @@ dependencies = [ "num-traits", "serde", "time", - "winapi 0.3.9", -] - -[[package]] -name = "cloudabi" -version = "0.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" -dependencies = [ - "bitflags", + "winapi", ] [[package]] @@ -235,43 +138,23 @@ dependencies = [ "libc", ] -[[package]] -name = "crossbeam-utils" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8" -dependencies = [ - "autocfg 1.0.1", - "cfg-if 0.1.10", - "lazy_static", -] - [[package]] name = "crypto-mac" version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bff07008ec701e8028e2ceb8f83f0e4274ee62bd2dbdc4fefff2e9a91824081a" dependencies = [ - "generic-array 0.14.4", + "generic-array", "subtle", ] -[[package]] -name = "digest" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" -dependencies = [ - "generic-array 0.12.4", -] - [[package]] name = "digest" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" dependencies = [ - "generic-array 0.14.4", + "generic-array", ] [[package]] @@ -280,7 +163,7 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "339ee130d97a610ea5a5872d2bbb130fdf68884ff09d3028b81bec8a1ac23bbc" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "dirs-sys-next", ] @@ -301,7 +184,7 @@ checksum = "03d86534ed367a67548dc68113a0f5db55432fdfbb6e6f9d77704397d95d5780" dependencies = [ "libc", "redox_users", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -312,7 +195,7 @@ checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" dependencies = [ "libc", "redox_users", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -321,28 +204,9 @@ version = "0.8.28" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "80df024fbc5ac80f87dfef0d9f5209a252f2a497f7f42944cff24d8253cac065" dependencies = [ - "cfg-if 1.0.0", -] - -[[package]] -name = "env_logger" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36" -dependencies = [ - "atty", - "humantime", - "log 0.4.14", - "regex", - "termcolor", + "cfg-if", ] -[[package]] -name = "fake-simd" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" - [[package]] name = "fallible-iterator" version = "0.2.0" @@ -377,37 +241,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5fc25a87fa4fd2094bffb06925852034d90a17f0d1e05197d4956d3555752191" dependencies = [ "matches", - "percent-encoding 2.1.0", + "percent-encoding", ] -[[package]] -name = "fuchsia-cprng" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" - -[[package]] -name = "fuchsia-zircon" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" -dependencies = [ - "bitflags", - "fuchsia-zircon-sys", -] - -[[package]] -name = "fuchsia-zircon-sys" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" - -[[package]] -name = "futures" -version = "0.1.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a471a38ef8ed83cd6e40aa59c1ffe17db6855c18e3604d9c4ed8c08ebc28678" - [[package]] name = "futures" version = "0.3.17" @@ -462,7 +298,7 @@ version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "18e4a4b95cea4b4ccbcf1c5675ca7c4ee4e9e75eb79944d07defde18068f79bb" dependencies = [ - "autocfg 1.0.1", + "autocfg", "proc-macro-hack", "proc-macro2", "quote", @@ -493,7 +329,7 @@ version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "36568465210a3a6ee45e1f165136d68671471a501e632e9a98d96872222b5481" dependencies = [ - "autocfg 1.0.1", + "autocfg", "futures-channel", "futures-core", "futures-io", @@ -508,15 +344,6 @@ dependencies = [ "slab", ] -[[package]] -name = "generic-array" -version = "0.12.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffdf9f34f1447443d37393cc6c2b8313aebddcd96906caf34e54c68d8e57d7bd" -dependencies = [ - "typenum", -] - [[package]] name = "generic-array" version = "0.14.4" @@ -524,7 +351,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "501466ecc8a30d1d3b7fc9229b122b2ce8ed6e9d9223f1138d4babb253e51817" dependencies = [ "typenum", - "version_check 0.9.3", + "version_check", ] [[package]] @@ -533,7 +360,7 @@ version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "libc", "wasi 0.9.0+wasi-snapshot-preview1", ] @@ -544,7 +371,7 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7fcd999463524c52659517fe2cea98493cfe485d10565e7b0fb07dbba7ad2753" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "libc", "wasi 0.10.2+wasi-snapshot-preview1", ] @@ -555,7 +382,7 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d7f3675cfef6a30c8031cf9e6493ebdc3bb3272a3fea3923c4210d1830e6a472" dependencies = [ - "bytes 1.1.0", + "bytes", "fnv", "futures-core", "futures-sink", @@ -580,13 +407,13 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f0b7591fb62902706ae8e7aaff416b1b0fa2c0fd0878b46dc13baa3712d8a855" dependencies = [ - "base64 0.13.0", + "base64", "bitflags", - "bytes 1.1.0", + "bytes", "headers-core", "http", - "mime 0.3.16", - "sha-1 0.9.8", + "mime", + "sha-1", "time", ] @@ -615,7 +442,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c1441c6b1e930e2817404b5046f1f989899143a12bf92de603b69f4e0aee1e15" dependencies = [ "crypto-mac", - "digest 0.9.0", + "digest", ] [[package]] @@ -624,7 +451,7 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "527e8c9ac747e28542699a951517aa9a6945af506cd1f2e1b53a576c17b6cc11" dependencies = [ - "bytes 1.1.0", + "bytes", "fnv", "itoa", ] @@ -635,7 +462,7 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "399c583b2979440c60be0821a6199eca73bc3c8dcd9d070d75ac726e2c6186e5" dependencies = [ - "bytes 1.1.0", + "bytes", "http", "pin-project-lite", ] @@ -652,41 +479,13 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6456b8a6c8f33fee7d958fcd1b60d55b11940a79e63ae87013e6d22e26034440" -[[package]] -name = "humantime" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df004cfca50ef23c36850aaaa59ad52cc70d0e90243c3c7737a4dd32dc7a3c4f" -dependencies = [ - "quick-error", -] - -[[package]] -name = "hyper" -version = "0.10.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a0652d9a2609a968c14be1a9ea00bf4b1d64e2e1f53a1b51b6fff3a6e829273" -dependencies = [ - "base64 0.9.3", - "httparse", - "language-tags", - "log 0.3.9", - "mime 0.2.6", - "num_cpus", - "time", - "traitobject", - "typeable", - "unicase 1.4.2", - "url 1.7.2", -] - [[package]] name = "hyper" version = "0.14.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13f67199e765030fa08fe0bd581af683f0d5bc04ea09c2b1102012c5fb90e7fd" dependencies = [ - "bytes 1.1.0", + "bytes", "futures-channel", "futures-core", "futures-util", @@ -710,24 +509,13 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" dependencies = [ - "bytes 1.1.0", - "hyper 0.14.12", + "bytes", + "hyper", "native-tls", "tokio", "tokio-native-tls", ] -[[package]] -name = "idna" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38f09e0f0b1fb55fdee1f17470ad800da77af5186a1a76c026b679358b7e844e" -dependencies = [ - "matches", - "unicode-bidi", - "unicode-normalization", -] - [[package]] name = "idna" version = "0.2.3" @@ -745,7 +533,7 @@ version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bc633605454125dec4b66843673f01c7df2b89479b32e0ed634e43a91cff62a5" dependencies = [ - "autocfg 1.0.1", + "autocfg", "hashbrown", ] @@ -755,7 +543,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f97967975f448f1a7ddb12b0bc41069d09ed6a1c161a92687e057325db35d413" dependencies = [ - "bytes 1.1.0", + "bytes", ] [[package]] @@ -764,16 +552,7 @@ version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bee0328b1209d157ef001c94dd85b4f8f64139adb0eac2659f4b08382b2f474d" dependencies = [ - "cfg-if 1.0.0", -] - -[[package]] -name = "iovec" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e" -dependencies = [ - "libc", + "cfg-if", ] [[package]] @@ -797,22 +576,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "kernel32-sys" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" -dependencies = [ - "winapi 0.2.8", - "winapi-build", -] - -[[package]] -name = "language-tags" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a91d884b6667cd606bb5a69aa0c99ba811a115fc68915e7056ec08a46e93199a" - [[package]] name = "lazy_static" version = "1.4.0" @@ -825,15 +588,6 @@ version = "0.2.102" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2a5ac8f984bfcf3a823267e5fde638acc3325f6496633a5da6bb6eb2171e103" -[[package]] -name = "lock_api" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4da24a77a3d8a6d4862d95f72e6fdb9c09a643ecdb402d754004a557f2bec75" -dependencies = [ - "scopeguard", -] - [[package]] name = "lock_api" version = "0.4.5" @@ -843,28 +597,19 @@ dependencies = [ "scopeguard", ] -[[package]] -name = "log" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b" -dependencies = [ - "log 0.4.14", -] - [[package]] name = "log" version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", ] [[package]] name = "macros" version = "0.1.0" -source = "git+https://github.com/file-share-platform/ws-com-framework?rev=028ddf5#028ddf5d3c8e436716fe51a1b1b3007f7e9b8eb8" +source = "git+https://github.com/file-share-platform/ws-com-framework?rev=3a9c2fa#3a9c2fafaf936de9db2c4d464795655ca20f2699" dependencies = [ "syn", ] @@ -875,21 +620,15 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f" -[[package]] -name = "maybe-uninit" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" - [[package]] name = "md-5" version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7b5a279bb9607f9f53c22d496eade00d138d1bdcccd07d74650387cf94942a15" dependencies = [ - "block-buffer 0.9.0", - "digest 0.9.0", - "opaque-debug 0.3.0", + "block-buffer", + "digest", + "opaque-debug", ] [[package]] @@ -898,15 +637,6 @@ version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a" -[[package]] -name = "mime" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba626b8a6de5da682e1caa06bdb42a335aee5a84db8e5046a3e8ab17ba0a3ae0" -dependencies = [ - "log 0.3.9", -] - [[package]] name = "mime" version = "0.3.16" @@ -919,27 +649,8 @@ version = "2.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2684d4c2e97d99848d30b324b00c8fcc7e5c897b7cbb5819b09e7c90e8baf212" dependencies = [ - "mime 0.3.16", - "unicase 2.6.0", -] - -[[package]] -name = "mio" -version = "0.6.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4afd66f5b91bf2a3bc13fad0e21caedac168ca4c707504e75585648ae80e4cc4" -dependencies = [ - "cfg-if 0.1.10", - "fuchsia-zircon", - "fuchsia-zircon-sys", - "iovec", - "kernel32-sys", - "libc", - "log 0.4.14", - "miow 0.2.2", - "net2", - "slab", - "winapi 0.2.8", + "mime", + "unicase", ] [[package]] @@ -949,22 +660,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8c2bdb6314ec10835cd3293dd268473a835c02b7b352e788be788b3c6ca6bb16" dependencies = [ "libc", - "log 0.4.14", - "miow 0.3.7", + "log", + "miow", "ntapi", - "winapi 0.3.9", -] - -[[package]] -name = "miow" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebd808424166322d4a38da87083bfddd3ac4c131334ed55856112eb06d46944d" -dependencies = [ - "kernel32-sys", - "net2", - "winapi 0.2.8", - "ws2_32-sys", + "winapi", ] [[package]] @@ -973,7 +672,7 @@ version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9f1c5b025cda876f66ef43a113f91ebc9f4ccef34843000e0adf6ebbab84e21" dependencies = [ - "winapi 0.3.9", + "winapi", ] [[package]] @@ -987,7 +686,7 @@ dependencies = [ "futures-core", "futures-timer", "futures-util", - "log 0.4.14", + "log", "tokio", ] @@ -997,7 +696,7 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac9231ff47df0b551aae34921256002d4cb218b7c5c11cb4a4f1c24deb6283fb" dependencies = [ - "futures 0.3.17", + "futures", "mobc", "tokio-postgres", ] @@ -1010,8 +709,8 @@ checksum = "d050aeedc89243f5347c3e237e3e13dc76fbe4ae3742a57b94dc14f69acf76d4" dependencies = [ "buf_redux", "httparse", - "log 0.4.14", - "mime 0.3.16", + "log", + "mime", "mime_guess", "quick-error", "rand 0.7.3", @@ -1028,7 +727,7 @@ checksum = "48ba9f7719b5a0f42f338907614285fb5fd70e53858141f69898a1fb7203b24d" dependencies = [ "lazy_static", "libc", - "log 0.4.14", + "log", "openssl", "openssl-probe", "openssl-sys", @@ -1038,24 +737,13 @@ dependencies = [ "tempfile", ] -[[package]] -name = "net2" -version = "0.2.37" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "391630d12b68002ae1e25e8f974306474966550ad82dac6886fb8910c19568ae" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "winapi 0.3.9", -] - [[package]] name = "ntapi" version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f6bb902e437b6d86e03cce10a7e2af662292c5dfef23b65899ea3ac9354ad44" dependencies = [ - "winapi 0.3.9", + "winapi", ] [[package]] @@ -1064,7 +752,7 @@ version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db" dependencies = [ - "autocfg 1.0.1", + "autocfg", "num-traits", ] @@ -1074,7 +762,7 @@ version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" dependencies = [ - "autocfg 1.0.1", + "autocfg", ] [[package]] @@ -1093,12 +781,6 @@ version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "692fcb63b64b1758029e0a96ee63e049ce8c5948587f2f7208df04625e5f6b56" -[[package]] -name = "opaque-debug" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" - [[package]] name = "opaque-debug" version = "0.3.0" @@ -1112,7 +794,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8d9facdb76fec0b73c406f125d44d86fdad818d66fef0531eec9233ca425ff4a" dependencies = [ "bitflags", - "cfg-if 1.0.0", + "cfg-if", "foreign-types", "libc", "once_cell", @@ -1131,24 +813,13 @@ version = "0.9.66" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1996d2d305e561b70d1ee0c53f1542833f4e1ac6ce9a6708b6ff2738ca67dc82" dependencies = [ - "autocfg 1.0.1", + "autocfg", "cc", "libc", "pkg-config", "vcpkg", ] -[[package]] -name = "parking_lot" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f842b1982eb6c2fe34036a4fbfb06dd185a3f5c8edfaacdf7d1ea10b07de6252" -dependencies = [ - "lock_api 0.3.4", - "parking_lot_core 0.6.2", - "rustc_version", -] - [[package]] name = "parking_lot" version = "0.11.2" @@ -1156,23 +827,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" dependencies = [ "instant", - "lock_api 0.4.5", - "parking_lot_core 0.8.5", -] - -[[package]] -name = "parking_lot_core" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b876b1b9e7ac6e1a74a6da34d25c42e17e8862aa409cbbbdcfc8d86c6f3bc62b" -dependencies = [ - "cfg-if 0.1.10", - "cloudabi", - "libc", - "redox_syscall 0.1.57", - "rustc_version", - "smallvec 0.6.14", - "winapi 0.3.9", + "lock_api", + "parking_lot_core", ] [[package]] @@ -1181,20 +837,14 @@ version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "instant", "libc", - "redox_syscall 0.2.10", - "smallvec 1.6.1", - "winapi 0.3.9", + "redox_syscall", + "smallvec", + "winapi", ] -[[package]] -name = "percent-encoding" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831" - [[package]] name = "percent-encoding" version = "2.1.0" @@ -1263,9 +913,9 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff3e0f70d32e20923cabf2df02913be7c1842d4c772db8065c00fcfdd1d1bff3" dependencies = [ - "base64 0.13.0", + "base64", "byteorder", - "bytes 1.1.0", + "bytes", "fallible-iterator", "hmac", "md-5", @@ -1281,7 +931,7 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "430f4131e1b7657b0cd9a2b0c3408d77c9a43a042d300b8c77f981dffcc43a2f" dependencies = [ - "bytes 1.1.0", + "bytes", "chrono", "fallible-iterator", "postgres-protocol", @@ -1294,16 +944,6 @@ version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857" -[[package]] -name = "pretty_env_logger" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "926d36b9553851b8b0005f1275891b392ee4d2d833852c417ed025477350fb9d" -dependencies = [ - "env_logger", - "log 0.4.14", -] - [[package]] name = "proc-macro-hack" version = "0.5.19" @@ -1340,25 +980,6 @@ dependencies = [ "proc-macro2", ] -[[package]] -name = "rand" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca" -dependencies = [ - "autocfg 0.1.7", - "libc", - "rand_chacha 0.1.1", - "rand_core 0.4.2", - "rand_hc 0.1.0", - "rand_isaac", - "rand_jitter", - "rand_os", - "rand_pcg", - "rand_xorshift", - "winapi 0.3.9", -] - [[package]] name = "rand" version = "0.7.3" @@ -1384,16 +1005,6 @@ dependencies = [ "rand_hc 0.3.1", ] -[[package]] -name = "rand_chacha" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "556d3a1ca6600bfcbab7c7c91ccb085ac7fbbcd70e008a98742e7847f4f7bcef" -dependencies = [ - "autocfg 0.1.7", - "rand_core 0.3.1", -] - [[package]] name = "rand_chacha" version = "0.2.2" @@ -1414,21 +1025,6 @@ dependencies = [ "rand_core 0.6.3", ] -[[package]] -name = "rand_core" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" -dependencies = [ - "rand_core 0.4.2", -] - -[[package]] -name = "rand_core" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" - [[package]] name = "rand_core" version = "0.5.1" @@ -1447,15 +1043,6 @@ dependencies = [ "getrandom 0.2.3", ] -[[package]] -name = "rand_hc" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b40677c7be09ae76218dc623efbf7b18e34bced3f38883af07bb75630a21bc4" -dependencies = [ - "rand_core 0.3.1", -] - [[package]] name = "rand_hc" version = "0.2.0" @@ -1474,74 +1061,6 @@ dependencies = [ "rand_core 0.6.3", ] -[[package]] -name = "rand_isaac" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ded997c9d5f13925be2a6fd7e66bf1872597f759fd9dd93513dd7e92e5a5ee08" -dependencies = [ - "rand_core 0.3.1", -] - -[[package]] -name = "rand_jitter" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1166d5c91dc97b88d1decc3285bb0a99ed84b05cfd0bc2341bdf2d43fc41e39b" -dependencies = [ - "libc", - "rand_core 0.4.2", - "winapi 0.3.9", -] - -[[package]] -name = "rand_os" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b75f676a1e053fc562eafbb47838d67c84801e38fc1ba459e8f180deabd5071" -dependencies = [ - "cloudabi", - "fuchsia-cprng", - "libc", - "rand_core 0.4.2", - "rdrand", - "winapi 0.3.9", -] - -[[package]] -name = "rand_pcg" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abf9b09b01790cfe0364f52bf32995ea3c39f4d2dd011eac241d2914146d0b44" -dependencies = [ - "autocfg 0.1.7", - "rand_core 0.4.2", -] - -[[package]] -name = "rand_xorshift" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cbf7e9e623549b0e21f6e97cf8ecf247c1a8fd2e8a992ae265314300b2455d5c" -dependencies = [ - "rand_core 0.3.1", -] - -[[package]] -name = "rdrand" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" -dependencies = [ - "rand_core 0.3.1", -] - -[[package]] -name = "redox_syscall" -version = "0.1.57" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" - [[package]] name = "redox_syscall" version = "0.2.10" @@ -1558,33 +1077,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "528532f3d801c87aec9def2add9ca802fe569e44a544afe633765267840abe64" dependencies = [ "getrandom 0.2.3", - "redox_syscall 0.2.10", -] - -[[package]] -name = "regex" -version = "1.5.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461" -dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax", + "redox_syscall", ] -[[package]] -name = "regex-syntax" -version = "0.6.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b" - [[package]] name = "remove_dir_all" version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" dependencies = [ - "winapi 0.3.9", + "winapi", ] [[package]] @@ -1593,29 +1095,29 @@ version = "0.11.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "246e9f61b9bb77df069a947682be06e31ac43ea37862e244a69f177694ea6d22" dependencies = [ - "base64 0.13.0", - "bytes 1.1.0", + "base64", + "bytes", "encoding_rs", "futures-core", "futures-util", "http", "http-body", - "hyper 0.14.12", + "hyper", "hyper-tls", "ipnet", "js-sys", "lazy_static", - "log 0.4.14", - "mime 0.3.16", + "log", + "mime", "native-tls", - "percent-encoding 2.1.0", + "percent-encoding", "pin-project-lite", "serde", "serde_json", "serde_urlencoded", "tokio", "tokio-native-tls", - "url 2.2.2", + "url", "wasm-bindgen", "wasm-bindgen-futures", "web-sys", @@ -1634,16 +1136,7 @@ dependencies = [ "spin", "untrusted", "web-sys", - "winapi 0.3.9", -] - -[[package]] -name = "rustc_version" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" -dependencies = [ - "semver", + "winapi", ] [[package]] @@ -1652,8 +1145,8 @@ version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "35edb675feee39aec9c99fa5ff985081995a06d594114ae14cbe797ad7b7a6d7" dependencies = [ - "base64 0.13.0", - "log 0.4.14", + "base64", + "log", "ring", "sct", "webpki", @@ -1690,7 +1183,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f05ba609c234e60bee0d547fe94a4c7e9da733d1c962cf6e59efa4cd9c8bc75" dependencies = [ "lazy_static", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -1738,21 +1231,6 @@ dependencies = [ "libc", ] -[[package]] -name = "semver" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" -dependencies = [ - "semver-parser", -] - -[[package]] -name = "semver-parser" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" - [[package]] name = "serde" version = "1.0.130" @@ -1796,29 +1274,17 @@ dependencies = [ "serde", ] -[[package]] -name = "sha-1" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7d94d0bede923b3cea61f3f1ff57ff8cdfd77b400fb8f9998949e0cf04163df" -dependencies = [ - "block-buffer 0.7.3", - "digest 0.8.1", - "fake-simd", - "opaque-debug 0.2.3", -] - [[package]] name = "sha-1" version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "99cd6713db3cf16b6c84e06321e049a9b9f699826e16096d23bbcc44d15d51a6" dependencies = [ - "block-buffer 0.9.0", - "cfg-if 1.0.0", + "block-buffer", + "cfg-if", "cpufeatures", - "digest 0.9.0", - "opaque-debug 0.3.0", + "digest", + "opaque-debug", ] [[package]] @@ -1827,11 +1293,11 @@ version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b69f9a4c9740d74c5baa3fd2e547f9525fa8088a8a958e0ca2409a514e33f5fa" dependencies = [ - "block-buffer 0.9.0", - "cfg-if 1.0.0", + "block-buffer", + "cfg-if", "cpufeatures", - "digest 0.9.0", - "opaque-debug 0.3.0", + "digest", + "opaque-debug", ] [[package]] @@ -1841,11 +1307,10 @@ dependencies = [ "chrono", "confy", "dirs", - "futures 0.3.17", + "futures", "futures-util", "mobc", "mobc-postgres", - "pretty_env_logger", "reqwest", "serde", "serde_derive", @@ -1853,7 +1318,6 @@ dependencies = [ "tokio-stream", "tokio-tungstenite 0.15.0", "tokio-util", - "uuid", "warp", "ws-com-framework", ] @@ -1879,15 +1343,6 @@ version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c307a32c1c5c437f38c7fd45d753050587732ba8628319fbdf12a7e289ccc590" -[[package]] -name = "smallvec" -version = "0.6.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b97fcaeba89edba30f044a10c6a3cc39df9c3f17d7cd829dd1446cab35f890e0" -dependencies = [ - "maybe-uninit", -] - [[package]] name = "smallvec" version = "1.6.1" @@ -1901,7 +1356,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5dc90fe6c7be1a323296982db1836d1ea9e47b6839496dde9a541bc496df3516" dependencies = [ "libc", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -1943,21 +1398,12 @@ version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dac1c663cfc93810f88aed9b8941d48cabf856a1b111c29a40439018d870eb22" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "libc", "rand 0.8.4", - "redox_syscall 0.2.10", + "redox_syscall", "remove_dir_all", - "winapi 0.3.9", -] - -[[package]] -name = "termcolor" -version = "1.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dfed899f0eb03f32ee8c6a0aabdb8a7949659e3466561fc0adf54e26d88c5f4" -dependencies = [ - "winapi-util", + "winapi", ] [[package]] @@ -1987,7 +1433,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ca8a50ef2360fbd1eeb0ecd46795a87a19024eb4b53c5dc916ca1fd95fe62438" dependencies = [ "libc", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -2011,50 +1457,18 @@ version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4efe6fc2395938c8155973d7be49fe8d03a843726e285e100a8a383cc0154ce" dependencies = [ - "autocfg 1.0.1", - "bytes 1.1.0", + "autocfg", + "bytes", "libc", "memchr", - "mio 0.7.13", + "mio", "num_cpus", "once_cell", - "parking_lot 0.11.2", + "parking_lot", "pin-project-lite", "signal-hook-registry", "tokio-macros", - "winapi 0.3.9", -] - -[[package]] -name = "tokio-codec" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25b2998660ba0e70d18684de5d06b70b70a3a747469af9dea7618cc59e75976b" -dependencies = [ - "bytes 0.4.12", - "futures 0.1.31", - "tokio-io", -] - -[[package]] -name = "tokio-executor" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb2d1b8f4548dbf5e1f7818512e9c406860678f29c300cdf0ebac72d1a3a1671" -dependencies = [ - "crossbeam-utils", - "futures 0.1.31", -] - -[[package]] -name = "tokio-io" -version = "0.1.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57fc868aae093479e3131e3d165c93b1c7474109d13c90ec0dda2a1bbfff0674" -dependencies = [ - "bytes 0.4.12", - "futures 0.1.31", - "log 0.4.14", + "winapi", ] [[package]] @@ -2086,12 +1500,12 @@ checksum = "2d2b1383c7e4fb9a09e292c7c6afb7da54418d53b045f1c1fac7a911411a2b8b" dependencies = [ "async-trait", "byteorder", - "bytes 1.1.0", + "bytes", "fallible-iterator", - "futures 0.3.17", - "log 0.4.14", - "parking_lot 0.11.2", - "percent-encoding 2.1.0", + "futures", + "log", + "parking_lot", + "percent-encoding", "phf", "pin-project-lite", "postgres-protocol", @@ -2101,25 +1515,6 @@ dependencies = [ "tokio-util", ] -[[package]] -name = "tokio-reactor" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09bc590ec4ba8ba87652da2068d150dcada2cfa2e07faae270a5e0409aa51351" -dependencies = [ - "crossbeam-utils", - "futures 0.1.31", - "lazy_static", - "log 0.4.14", - "mio 0.6.23", - "num_cpus", - "parking_lot 0.9.0", - "slab", - "tokio-executor", - "tokio-io", - "tokio-sync", -] - [[package]] name = "tokio-rustls" version = "0.22.0" @@ -2142,41 +1537,6 @@ dependencies = [ "tokio", ] -[[package]] -name = "tokio-sync" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edfe50152bc8164fcc456dab7891fa9bf8beaf01c5ee7e1dd43a397c3cf87dee" -dependencies = [ - "fnv", - "futures 0.1.31", -] - -[[package]] -name = "tokio-tcp" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98df18ed66e3b72e742f185882a9e201892407957e45fbff8da17ae7a7c51f72" -dependencies = [ - "bytes 0.4.12", - "futures 0.1.31", - "iovec", - "mio 0.6.23", - "tokio-io", - "tokio-reactor", -] - -[[package]] -name = "tokio-tls" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "354b8cd83825b3c20217a9dc174d6a0c67441a2fae5c41bcb1ea6679f6ae0f7c" -dependencies = [ - "futures 0.1.31", - "native-tls", - "tokio-io", -] - [[package]] name = "tokio-tungstenite" version = "0.13.0" @@ -2184,7 +1544,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e1a5f475f1b9d077ea1017ecbc60890fda8e54942d680ca0b1d2b47cfa2d861b" dependencies = [ "futures-util", - "log 0.4.14", + "log", "pin-project", "tokio", "tungstenite 0.12.0", @@ -2197,7 +1557,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "511de3f85caf1c98983545490c3d09685fa8eb634e57eec22bb4db271f46cbd8" dependencies = [ "futures-util", - "log 0.4.14", + "log", "pin-project", "rustls", "tokio", @@ -2213,10 +1573,10 @@ version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08d3725d3efa29485e87311c5b699de63cde14b00ed4d256b8318aa30ca452cd" dependencies = [ - "bytes 1.1.0", + "bytes", "futures-core", "futures-sink", - "log 0.4.14", + "log", "pin-project-lite", "tokio", ] @@ -2242,8 +1602,8 @@ version = "0.1.27" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2ba9ab62b7d6497a8638dfda5e5c4fb3b2d5a7fca4118f2b96151c8ef1a437e" dependencies = [ - "cfg-if 1.0.0", - "log 0.4.14", + "cfg-if", + "log", "pin-project-lite", "tracing-core", ] @@ -2257,12 +1617,6 @@ dependencies = [ "lazy_static", ] -[[package]] -name = "traitobject" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efd1f82c56340fdf16f2a953d7bda4f8fdffba13d93b00844c25572110b26079" - [[package]] name = "try-lock" version = "0.2.3" @@ -2275,16 +1629,16 @@ version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ada8297e8d70872fa9a551d93250a9f407beb9f37ef86494eb20012a2ff7c24" dependencies = [ - "base64 0.13.0", + "base64", "byteorder", - "bytes 1.1.0", + "bytes", "http", "httparse", "input_buffer", - "log 0.4.14", + "log", "rand 0.8.4", - "sha-1 0.9.8", - "url 2.2.2", + "sha-1", + "url", "utf-8", ] @@ -2294,18 +1648,18 @@ version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a0b2d8558abd2e276b0a8df5c05a2ec762609344191e5fd23e292c910e9165b5" dependencies = [ - "base64 0.13.0", + "base64", "byteorder", - "bytes 1.1.0", + "bytes", "http", "httparse", - "log 0.4.14", + "log", "rand 0.8.4", "rustls", "rustls-native-certs", - "sha-1 0.9.8", + "sha-1", "thiserror", - "url 2.2.2", + "url", "utf-8", "webpki", ] @@ -2319,34 +1673,19 @@ dependencies = [ "memchr", ] -[[package]] -name = "typeable" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1410f6f91f21d1612654e7cc69193b0334f909dcf2c790c4826254fbb86f8887" - [[package]] name = "typenum" version = "1.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b63708a265f51345575b27fe43f9500ad611579e764c79edbc2037b1121959ec" -[[package]] -name = "unicase" -version = "1.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f4765f83163b74f957c797ad9253caf97f103fb064d3999aea9568d09fc8a33" -dependencies = [ - "version_check 0.1.5", -] - [[package]] name = "unicase" version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6" dependencies = [ - "version_check 0.9.3", + "version_check", ] [[package]] @@ -2376,17 +1715,6 @@ version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" -[[package]] -name = "url" -version = "1.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd4e7c0d531266369519a4aa4f399d748bd37043b00bde1e4ff1f60a120b355a" -dependencies = [ - "idna 0.1.5", - "matches", - "percent-encoding 1.0.1", -] - [[package]] name = "url" version = "2.2.2" @@ -2394,9 +1722,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a507c383b2d33b5fc35d1861e77e6b383d158b2da5e14fe51b83dfedf6fd578c" dependencies = [ "form_urlencoded", - "idna 0.2.3", + "idna", "matches", - "percent-encoding 2.1.0", + "percent-encoding", ] [[package]] @@ -2410,10 +1738,6 @@ name = "uuid" version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7" -dependencies = [ - "getrandom 0.2.3", - "serde", -] [[package]] name = "vcpkg" @@ -2421,12 +1745,6 @@ version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" -[[package]] -name = "version_check" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd" - [[package]] name = "version_check" version = "0.9.3" @@ -2439,7 +1757,7 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" dependencies = [ - "log 0.4.14", + "log", "try-lock", ] @@ -2449,16 +1767,16 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "332d47745e9a0c38636dbd454729b147d16bd1ed08ae67b3ab281c4506771054" dependencies = [ - "bytes 1.1.0", - "futures 0.3.17", + "bytes", + "futures", "headers", "http", - "hyper 0.14.12", - "log 0.4.14", - "mime 0.3.16", + "hyper", + "log", + "mime", "mime_guess", "multipart", - "percent-encoding 2.1.0", + "percent-encoding", "pin-project", "scoped-tls", "serde", @@ -2490,7 +1808,7 @@ version = "0.2.78" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "632f73e236b219150ea279196e54e610f5dbafa5d61786303d4da54f84e47fce" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "serde", "serde_json", "wasm-bindgen-macro", @@ -2504,7 +1822,7 @@ checksum = "a317bf8f9fba2476b4b2c85ef4c4af8ff39c3c7f0cdfeed4f82c34a880aa837b" dependencies = [ "bumpalo", "lazy_static", - "log 0.4.14", + "log", "proc-macro2", "quote", "syn", @@ -2517,7 +1835,7 @@ version = "0.4.28" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e8d7523cb1f2a4c96c1317ca690031b714a51cc14e05f712446691f413f5d39" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "js-sys", "wasm-bindgen", "web-sys", @@ -2581,53 +1899,6 @@ dependencies = [ "webpki", ] -[[package]] -name = "websocket" -version = "0.26.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "723abe6b75286edc51d8ecabb38a2353f62a9e9b0588998b59111474f1dcd637" -dependencies = [ - "bytes 0.4.12", - "futures 0.1.31", - "hyper 0.10.16", - "native-tls", - "rand 0.6.5", - "tokio-codec", - "tokio-io", - "tokio-reactor", - "tokio-tcp", - "tokio-tls", - "unicase 1.4.2", - "url 1.7.2", - "websocket-base", -] - -[[package]] -name = "websocket-base" -version = "0.26.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "403f3fd505ff930da84156389639932955fb09705b3dccd1a3d60c8e7ff62776" -dependencies = [ - "base64 0.10.1", - "bitflags", - "byteorder", - "bytes 0.4.12", - "futures 0.1.31", - "native-tls", - "rand 0.6.5", - "sha-1 0.8.2", - "tokio-codec", - "tokio-io", - "tokio-tcp", - "tokio-tls", -] - -[[package]] -name = "winapi" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" - [[package]] name = "winapi" version = "0.3.9" @@ -2638,27 +1909,12 @@ dependencies = [ "winapi-x86_64-pc-windows-gnu", ] -[[package]] -name = "winapi-build" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" - [[package]] name = "winapi-i686-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" -[[package]] -name = "winapi-util" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" -dependencies = [ - "winapi 0.3.9", -] - [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" @@ -2671,35 +1927,22 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0120db82e8a1e0b9fb3345a539c478767c0048d842860994d96113d5b667bd69" dependencies = [ - "winapi 0.3.9", + "winapi", ] [[package]] name = "ws-com-framework" version = "0.1.0" -source = "git+https://github.com/file-share-platform/ws-com-framework?rev=028ddf5#028ddf5d3c8e436716fe51a1b1b3007f7e9b8eb8" +source = "git+https://github.com/file-share-platform/ws-com-framework?rev=3a9c2fa#3a9c2fafaf936de9db2c4d464795655ca20f2699" dependencies = [ "async-trait", "bincode", "chrono", - "futures 0.3.17", + "futures", "futures-util", "macros", "serde", "serde_derive", "tokio", "tokio-tungstenite 0.15.0", - "uuid", - "warp", - "websocket", -] - -[[package]] -name = "ws2_32-sys" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" -dependencies = [ - "winapi 0.2.8", - "winapi-build", ] diff --git a/Cargo.toml b/Cargo.toml index 1fd3dbc..82441d5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,23 +6,22 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -ws-com-framework= { git="https://github.com/file-share-platform/ws-com-framework", features = ["client"], rev="028ddf5" } -uuid = { version = "0.8", features = ["serde", "v4"] } +ws-com-framework= { git="https://github.com/file-share-platform/ws-com-framework", default-features = false, features = ["client", "wrapper-tungstenite"], rev="3a9c2fa" } tokio = { version = "1", features = ["full"] } tokio-util = { version = "0.6.8", features = ["codec"] } confy = { git = "https://github.com/JosiahBull/confy", features = ["toml_conf"] } mobc = "0.7.3" mobc-postgres = { version = "*", features = ["with-chrono-0_4", "with-uuid-0_8"] } -pretty_env_logger="*" reqwest = { version = "0.11.4", features = ["stream", "json"] } serde = {version = "1.0", features = ["derive"] } serde_derive = "1.0" dirs = "4.0.0" chrono = "0.4.19" -tokio-stream="0.1.7" -tokio-tungstenite = {version="0.15.0", features=["rustls-tls"]} -futures-util="0.3.17" -futures="0.3.17" +tokio-stream = "0.1.7" +tokio-tungstenite = { version = "0.15.0", features = ["rustls-tls"] } +futures-util = "0.3.17" +futures = "0.3.17" [dev-dependencies] -warp="0.3.1" \ No newline at end of file +warp="0.3.1" +ws-com-framework= { git="https://github.com/file-share-platform/ws-com-framework", default-features = false, features = ["client", "wrapper-tokio"], rev="3a9c2fa" } \ No newline at end of file diff --git a/config/db.sql b/config/db.sql index 678f3d2..cdac745 100644 --- a/config/db.sql +++ b/config/db.sql @@ -1,7 +1,7 @@ CREATE TABLE IF NOT EXISTS shares ( id BIGSERIAL PRIMARY KEY NOT NULL, - uuid UUID NOT NULL, + public_id text NOT NULL, created_at timestamp with time zone DEFAULT (now() at time zone 'utc'), expires timestamp with time zone DEFAULT (now() at time zone 'utc'), usr text NOT NULL, diff --git a/src/db.rs b/src/db.rs index 926c5b2..9e63afa 100644 --- a/src/db.rs +++ b/src/db.rs @@ -34,7 +34,7 @@ pub trait FromDataBase: Sized { impl FromDataBase for File { type Error = Error; fn from_database(data: &Row) -> Result { - let id: uuid::Uuid = data.try_get::(1).unwrap(); + let id: String = data.try_get::(1).unwrap(); let created_at: DateTime = data.try_get::>(2).unwrap(); //Test timestamp let expires: DateTime = data.try_get::>(3).unwrap(); //Test timestamp let usr: String = data.try_get::(4).unwrap(); @@ -86,14 +86,14 @@ pub async fn init_db(pool: &DBPool) -> Result<(), Error> { pub enum Search { #[allow(dead_code)] Id(usize), - Uuid(uuid::Uuid), + PublicId(String), } impl Search { fn get_search_term(self) -> String { match self { Search::Id(i) => format!("{} = {}", "id", i), - Search::Uuid(s) => format!("{} = '{}'", "uuid", s), + Search::PublicId(s) => format!("{} = '{}'", "public_id", s), } } @@ -108,7 +108,6 @@ impl Search { async fn search_database<'a>(db_pool: &DBPool, search: Search) -> Result, Error> { let conn = get_db_con(db_pool).await?; - let rows = conn .query( format!( diff --git a/src/error.rs b/src/error.rs index 2163d6f..33c3e80 100644 --- a/src/error.rs +++ b/src/error.rs @@ -30,4 +30,4 @@ impl std::convert::From for Error { } } -//TODO implement to_string \ No newline at end of file +//TODO implement to_string diff --git a/src/main.rs b/src/main.rs index 105b6c4..758f11c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -22,10 +22,10 @@ mod uploader; use db::DBPool; use error::Error; +use futures::StreamExt; use serde::{Deserialize, Serialize}; use tokio::fs; -use ws_com_framework::{File, Message, Receiver, Sender, message::Upload}; -use futures::StreamExt; +use ws_com_framework::{message::Upload, File, Message, Receiver, Sender}; const CONFIG_PATH: &str = "/opt/file-share/file-share.toml"; const MIN_RECONNECT_DELAY: usize = 2000; @@ -92,15 +92,12 @@ impl Config { impl Default for Config { fn default() -> Self { Config { - server_ip: "josiahbull.com".to_owned(), - prefix: "https".to_owned(), + server_ip: "localhost:3030".to_owned(), + prefix: "http".to_owned(), max_upload_attempts: 3, home_dir_location: "/opt/file-share".to_owned(), reconnect_delay: 60000, - id: Some(Id { - id: 1, - unique_id: uuid::Uuid::parse_str("ed9879fa-b565-47d0-8fcd-f18bb07c740b").unwrap() - }), + id: None, } } } @@ -108,14 +105,13 @@ impl Default for Config { /// Information required to connect to central api #[derive(Serialize, Deserialize, Clone)] struct Id { - id: i64, - unique_id: uuid::Uuid, + public_id: String, + private_key: String, } fn file_to_body(f: tokio::fs::File) -> reqwest::Body { let stream = tokio_util::codec::FramedRead::new(f, tokio_util::codec::BytesCodec::new()); - let body = reqwest::Body::wrap_stream(stream); - body + reqwest::Body::wrap_stream(stream) } /// Self contained function to upload files to the server @@ -148,15 +144,15 @@ async fn upload_file(metadata: File, cfg: Config, url: &str) { async fn handle_message(m: Message, db: DBPool, cfg: Config) -> Result, Error> { match m { Message::UploadRequest(u) => { - if let Some(f) = db::Search::Uuid(u.id()).find(&db).await? { + if let Some(f) = db::Search::PublicId(u.id().to_string()).find(&db).await? { upload_file(f, cfg, u.url()).await; - return Ok(None); + Ok(None) } else { okie!(Message::Error(ws_com_framework::Error::FileDoesntExist)) - }; + } } Message::MetadataRequest(r) => { - if let Some(f) = db::Search::Uuid(r.id()).find(&db).await? { + if let Some(f) = db::Search::PublicId(r.id().to_string()).find(&db).await? { okie!(Message::MetadataResponse(Upload::new( r.url().to_string(), f, @@ -164,10 +160,15 @@ async fn handle_message(m: Message, db: DBPool, cfg: Config) -> Result return Err(Error::Closed(c)), + Message::Close(c) => Err(Error::Closed(c)), + Message::AuthReq => { + okie!(Message::AuthResponse(ws_com_framework::AuthKey { + key: cfg.id.unwrap().private_key.as_bytes().try_into().unwrap() + })) + } e => { debug_panic!("Unsupported message, recieved! {:?}", e); - return Ok(None); + Ok(None) } } } @@ -189,7 +190,7 @@ where while let Some(m) = rx_internal.recv().await { if let Err(e) = tx_ws.send(m).await { debug_panic!("Error occured! {:?}", e); - return + return; }; } }); @@ -218,14 +219,17 @@ where let m = handle(m, db_o, cfg_o).await; if let Err(e) = m { debug_panic!("Error occured! {:?}", e); - return + return; } - + debug!("Sending response to Central-API: {:?}", m); if let Some(r) = m.unwrap() { if let Err(e) = tx_o.send(r) { - debug_panic!("Tried to send response through internal websocket, but failed \n{}", e); + debug_panic!( + "Tried to send response through internal websocket, but failed \n{}", + e + ); }; }; }); @@ -238,14 +242,29 @@ async fn connect_sever( ip: &str, ) -> Result< ( - Receiver>>>, - Sender>, tokio_tungstenite::tungstenite::Message>>, + Receiver< + futures_util::stream::SplitStream< + tokio_tungstenite::WebSocketStream< + tokio_tungstenite::MaybeTlsStream, + >, + >, + >, + Sender< + futures_util::stream::SplitSink< + tokio_tungstenite::WebSocketStream< + tokio_tungstenite::MaybeTlsStream, + >, + tokio_tungstenite::tungstenite::Message, + >, + >, ), Error, > { debug!("Attempting to connect to {}", ip); - let (client, _) = tokio_tungstenite::connect_async(ip).await.expect("Failed to connect"); //TODO error handling + let (client, _) = tokio_tungstenite::connect_async(ip) + .await + .expect("Failed to connect"); //TODO error handling debug!("Client succesfully connected to Central-Api at {}", ip); @@ -257,51 +276,25 @@ async fn connect_sever( /// We call to this in the event that we are not registered yet. async fn register_server(ip: String) -> Result { - let unique_id = generate_unique_id(); - let b = format!( - "{{ - \"unique_id\": \"{}\" - }}", - unique_id - ); - - debug!( - "Attempting to register websocket with: \n{}\nAt IP {}", - b, ip - ); - - #[derive(Deserialize)] - struct IdRes { - message: String, - } + debug!("Attempting to register websocket with At IP {}", ip); + let id = reqwest::Client::new() - .post(ip) - .body(b) + .post(&ip) .send() .await? - .json::() + .json::() .await?; - Ok(Id { - unique_id, - id: id.message.parse()?, - }) -} - -/// Generate a unique id to represent this PC -fn generate_unique_id() -> uuid::Uuid { - uuid::Uuid::new_v4() + Ok(id) } #[tokio::main] async fn main() { debug!("Starting..."); - pretty_env_logger::init(); let mut cfg: Config = confy::load_path(CONFIG_PATH).expect("Failed to load config!"); - // let mut cfg: Config = Config::default(); - let mut db_pool = db::create_pool().expect("failed to create db pool"); + let db_pool = db::create_pool().expect("failed to create db pool"); db::init_db(&db_pool).await.expect("failed to initalize db"); loop { @@ -321,7 +314,7 @@ async fn main() { cfg.set_id(id); debug!( "Registered websocket with id {}", - cfg.clone().id.unwrap().id + cfg.clone().id.unwrap().public_id ); if let Err(e) = confy::store_path(CONFIG_PATH, cfg.clone()) { debug_panic!( @@ -338,9 +331,9 @@ async fn main() { } let ip = format!( - "wss://{}/api/v1/client/ws/{}", + "ws://{}/api/v1/client/ws/{}", &cfg.server_ip, - cfg.clone().id.unwrap().id + cfg.clone().id.unwrap().public_id ); let (rx, tx) = match connect_sever(&ip).await { @@ -353,7 +346,7 @@ async fn main() { //TODO validation here - handle_ws(handle_message, (tx, rx), &mut db_pool, cfg.clone()) + handle_ws(handle_message, (tx, rx), &db_pool, cfg.clone()) .await .expect("Not Implemented"); //TODO @@ -375,7 +368,7 @@ mod websocket_tests { use crate::db; use crate::db::DBPool; use crate::{connect_sever, handle_ws, register_server, Config}; - use futures::{FutureExt, StreamExt, SinkExt}; + use futures::{FutureExt, SinkExt, StreamExt}; use std::time::Duration; use tokio::sync::oneshot; use tokio::time::timeout; @@ -419,9 +412,11 @@ mod websocket_tests { .and(warp::path::end()) .map(|| { format!( - "{{ - \"message\": \"10568\" - }}" + " + {{ + \"public_id\": \"7N58aK\", + \"private_key\": \"oVZBbqJm5vXCmfTP8wQA0n13FeKd5Ego\" + }}" ) }); @@ -442,9 +437,9 @@ mod websocket_tests { #[tokio::test(flavor = "multi_thread")] async fn websocket_connect() { timeout(Duration::from_millis(10_000), async { - let close_server_tx = create_websocket_server(([127, 0, 0, 1], 3033)).unwrap(); + let close_server_tx = create_websocket_server(([127, 0, 0, 1], 2033)).unwrap(); - let (mut rx, mut tx) = connect_sever("ws://127.0.0.1:3033/echo").await.unwrap(); + let (mut rx, mut tx) = connect_sever("ws://127.0.0.1:2033/echo").await.unwrap(); let msg = Message::Message("Hello, World!".into()); @@ -473,9 +468,9 @@ mod websocket_tests { let db_pool = db::create_pool().expect("failed to create db pool"); db::init_db(&db_pool).await.expect("failed to initalize db"); - let close_server_tx = create_websocket_server(([127, 0, 0, 1], 3031)).unwrap(); + let close_server_tx = create_websocket_server(([127, 0, 0, 1], 2031)).unwrap(); - let (rx, mut tx) = connect_sever("ws://127.0.0.1:3031/echo").await.unwrap(); + let (rx, mut tx) = connect_sever("ws://127.0.0.1:2031/echo").await.unwrap(); let msg = Message::Message("Hello, World!".into()); let e_msg = Message::Message("Hello, World!".into()); @@ -514,13 +509,17 @@ mod websocket_tests { #[tokio::test(flavor = "multi_thread")] async fn test_register() { - let close_server_tx = create_http_server(([127, 0, 0, 1], 3034)).unwrap(); + let close_server_tx = create_http_server(([127, 0, 0, 1], 2034)).unwrap(); - let res = register_server("http://127.0.0.1:3034/test-register".into()) + let res = register_server("http://127.0.0.1:2034/test-register".into()) .await .unwrap(); - assert_eq!(res.id, 10568); + assert_eq!(res.public_id, "7N58aK".to_owned()); + assert_eq!( + res.private_key, + "oVZBbqJm5vXCmfTP8wQA0n13FeKd5Ego".to_owned() + ); let _ = close_server_tx.send(()); }