diff --git a/Cargo.lock b/Cargo.lock index 843d4ff..d7fea29 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "addr2line" -version = "0.20.0" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4fa78e18c64fce05e902adecd7a5eed15a5e0a3439f7b0e169f0252214865e3" +checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" dependencies = [ "gimli", ] @@ -40,9 +40,9 @@ dependencies = [ [[package]] name = "aes-gcm" -version = "0.10.2" +version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "209b47e8954a928e1d72e86eca7000ebb6655fe1436d33eefc2201cad027e237" +checksum = "831010a0f742e1209b3bcea8fab6a8e149051ba6099432c8cb2cc117dec3ead1" dependencies = [ "aead", "aes", @@ -83,26 +83,26 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.1" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a30da5c5f2d5e72842e00bcb57657162cdabef0931f40e2deb9b4140440cecd" +checksum = "8901269c6307e8d93993578286ac0edf7f195079ffff5ebdeea6a59ffb7e36bc" [[package]] name = "anstyle-parse" -version = "0.2.1" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "938874ff5980b03a87c5524b3ae5b59cf99b1d6bc836848df7bc5ada9643c333" +checksum = "c75ac65da39e5fe5ab759307499ddad880d724eed2f6ce5b5e8a26f4f387928c" dependencies = [ "utf8parse", ] [[package]] name = "anstyle-query" -version = "1.0.0" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b" +checksum = "e28923312444cdd728e4738b3f9c9cac739500909bb3d3c94b43551b16517648" dependencies = [ - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -115,6 +115,21 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "approx" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cab112f0a86d568ea0e627cc1d6be74a1e9cd55214684db5561995f6dad897c6" +dependencies = [ + "num-traits", +] + +[[package]] +name = "array-bytes" +version = "6.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f840fb7195bcfc5e17ea40c26e5ce6d5b9ce5d584466e17703209657e459ae0" + [[package]] name = "autocfg" version = "0.1.8" @@ -132,9 +147,9 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "backtrace" -version = "0.3.68" +version = "0.3.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4319208da049c43661739c5fade2ba182f09d1dc2299b32298d3a31692b17e12" +checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" dependencies = [ "addr2line", "cc", @@ -151,6 +166,12 @@ version = "0.21.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" +[[package]] +name = "base64" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9475866fec1451be56a3c2400fd081ff546538961565ccb5b7142cbd22bc7a51" + [[package]] name = "base64ct" version = "1.6.0" @@ -174,9 +195,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.3.3" +version = "2.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "630be753d4e58660abd17930c71b647fe46c27ea6b63cc59e1e3851406972e42" +checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" [[package]] name = "block-buffer" @@ -189,27 +210,33 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.13.0" +version = "3.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1" +checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" + +[[package]] +name = "bytemuck" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d6d68c57235a3a081186990eca2867354726650f42f7516ca50c28d6281fd15" [[package]] name = "byteorder" -version = "1.4.3" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" +checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" [[package]] name = "cc" -version = "1.0.79" +version = "1.0.85" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" +checksum = "9b918671670962b48bc23753aef0c51d072dca6f52f01f800854ada6ddb7f7d3" [[package]] name = "cfg-if" @@ -219,9 +246,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.34" +version = "0.4.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bc015644b92d5890fab7489e49d21f879d5c990186827d42ec511919404f38b" +checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401" dependencies = [ "android-tzdata", "iana-time-zone", @@ -244,9 +271,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.2" +version = "4.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b230ab84b0ffdf890d5a10abdbc8b83ae1c4918275daea1ab8801f71536b2651" +checksum = "90bc066a67923782aa8515dbaea16946c5bcc5addbd668bb80af688e53e548a0" dependencies = [ "clap_builder", "clap_derive", @@ -266,14 +293,14 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.5.0" +version = "4.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "307bc0538d5f0f83b8248db3087aa92fe504e4691294d0c96c0eabc33f47ba47" +checksum = "528131438037fd55894f62d6e9f068b8f45ac57ffa77517819645d10aed04f64" dependencies = [ "heck", "proc-macro2", "quote", - "syn", + "syn 2.0.48", ] [[package]] @@ -309,15 +336,15 @@ dependencies = [ [[package]] name = "const-oid" -version = "0.9.5" +version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28c122c3980598d243d63d9a704629a2d748d101f278052ff068be5a4423ab6f" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" [[package]] name = "core-foundation" -version = "0.9.3" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" dependencies = [ "core-foundation-sys", "libc", @@ -325,24 +352,24 @@ dependencies = [ [[package]] name = "core-foundation-sys" -version = "0.8.4" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" +checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" [[package]] name = "cpufeatures" -version = "0.2.9" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a17b76ff3a4162b0b27f354a0c87015ddad39d35f9c0c36607a3bdd175dde1f1" +checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" dependencies = [ "libc", ] [[package]] name = "crc32fast" -version = "1.3.2" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" +checksum = "b3855a8a784b474f333699ef2bbca9db2c4a1f6d9088a90a2d25b1eb53111eaa" dependencies = [ "cfg-if", ] @@ -354,26 +381,30 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2707e3afba5e19b75d582d88bc79237418f2a2a2d673d01cf9b03633b46e98f3" [[package]] -name = "crossbeam-epoch" -version = "0.9.15" +name = "cron" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae211234986c545741a7dc064309f67ee1e5ad243d0e48335adc0484d960bcc7" +checksum = "6f8c3e73077b4b4a6ab1ea5047c37c57aee77657bc8ecd6f29b0af082d0b0c07" +dependencies = [ + "chrono", + "nom", + "once_cell", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" dependencies = [ - "autocfg 1.1.0", - "cfg-if", "crossbeam-utils", - "memoffset", - "scopeguard", ] [[package]] name = "crossbeam-utils" -version = "0.8.16" +version = "0.8.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294" -dependencies = [ - "cfg-if", -] +checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345" [[package]] name = "crypto-common" @@ -397,9 +428,9 @@ dependencies = [ [[package]] name = "curve25519-dalek" -version = "4.1.0" +version = "4.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "622178105f911d937a42cdb140730ba4a3ed2becd8ae6ce39c7d28b5d75d4588" +checksum = "0a677b8922c94e01bdbb12126b0bc852f00447528dee1782229af9c720c3f348" dependencies = [ "cfg-if", "cpufeatures", @@ -416,20 +447,20 @@ dependencies = [ [[package]] name = "curve25519-dalek-derive" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83fdaf97f4804dcebfa5862639bc9ce4121e82140bec2a987ac5140294865b5b" +checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.48", ] [[package]] name = "darling" -version = "0.20.3" +version = "0.20.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0209d94da627ab5605dcccf08bb18afa5009cfbef48d8a8b7d7bdbc79be25c5e" +checksum = "fc5d6b04b3fd0ba9926f945895de7d806260a2d7431ba82e7edaecb043c4c6b8" dependencies = [ "darling_core", "darling_macro", @@ -437,27 +468,27 @@ dependencies = [ [[package]] name = "darling_core" -version = "0.20.3" +version = "0.20.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "177e3443818124b357d8e76f53be906d60937f0d3a90773a664fa63fa253e621" +checksum = "04e48a959bcd5c761246f5d090ebc2fbf7b9cd527a492b07a67510c108f1e7e3" dependencies = [ "fnv", "ident_case", "proc-macro2", "quote", "strsim 0.10.0", - "syn", + "syn 2.0.48", ] [[package]] name = "darling_macro" -version = "0.20.3" +version = "0.20.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "836a9bbc7ad63342d6d6e7b815ccab164bc77a2d95d84bc3117a8c0d5c98e2d5" +checksum = "1d1545d67a2149e1d93b7e5c7752dce5a7426eb5d1357ddcfd89336b94444f77" dependencies = [ "darling_core", "quote", - "syn", + "syn 2.0.48", ] [[package]] @@ -472,9 +503,9 @@ dependencies = [ [[package]] name = "deranged" -version = "0.3.9" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f32d04922c60427da6f9fef14d042d9edddef64cb9d4ce0d64d0685fbeb1fd3" +checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" dependencies = [ "powerfmt", "serde", @@ -488,6 +519,7 @@ checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer", "crypto-common", + "subtle", ] [[package]] @@ -498,9 +530,9 @@ checksum = "dcbb2bf8e87535c23f7a8a321e364ce21462d0ff10cb6407820e8e96dfff6653" [[package]] name = "ed25519" -version = "2.2.2" +version = "2.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60f6d271ca33075c88028be6f04d502853d63a5ece419d269c15315d4fc1cf1d" +checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53" dependencies = [ "pkcs8", "serde", @@ -509,23 +541,24 @@ dependencies = [ [[package]] name = "ed25519-dalek" -version = "2.0.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7277392b266383ef8396db7fdeb1e77b6c52fed775f5df15bb24f35b72156980" +checksum = "4a3daa8e81a3963a60642bcc1f90a670680bd4a77535faa384e9d1c79d620871" dependencies = [ "curve25519-dalek", "ed25519", "rand_core 0.6.4", "serde", "sha2", + "subtle", "zeroize", ] [[package]] name = "encoding_rs" -version = "0.8.32" +version = "0.8.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "071a31f4ee85403370b58aca746f01041ede6f0da2730960ad001edc2b71b394" +checksum = "7268b386296a025e474d5140678f75d6de9493ae55a5d709eeb9dd08149945e1" dependencies = [ "cfg-if", ] @@ -538,36 +571,25 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "errno" -version = "0.3.1" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a" +checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" dependencies = [ - "errno-dragonfly", - "libc", - "windows-sys 0.48.0", -] - -[[package]] -name = "errno-dragonfly" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" -dependencies = [ - "cc", "libc", + "windows-sys 0.52.0", ] [[package]] name = "fastrand" -version = "2.0.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6999dc1837253364c2ebb0704ba97994bd874e8f195d665c50b7548f6ea92764" +checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" [[package]] name = "fiat-crypto" -version = "0.2.1" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0870c84016d4b481be5c9f323c24f65e31e901ae618f0e80f4308fb00de1d2d" +checksum = "1676f435fc1dadde4d03e43f5d62b259e1ce5f40bd4ffb21db2b42ebe59c1382" [[package]] name = "fnv" @@ -592,9 +614,9 @@ checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" [[package]] name = "form_urlencoded" -version = "1.2.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652" +checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" dependencies = [ "percent-encoding", ] @@ -671,7 +693,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.48", ] [[package]] @@ -738,9 +760,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.10" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" +checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" dependencies = [ "cfg-if", "js-sys", @@ -761,23 +783,42 @@ dependencies = [ [[package]] name = "gimli" -version = "0.27.3" +version = "0.28.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6c80984affa11d98d1b88b66ac8853f143217b399d3c74116778ff8fdb4ed2e" +checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" [[package]] name = "h2" -version = "0.3.20" +version = "0.3.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97ec8491ebaf99c8eaa73058b045fe58073cd6be7f596ac993ced0b0a0c01049" +checksum = "bb2c4422095b67ee78da96fbb51a4cc413b3b25883c7717ff7ca1ab31022c9c9" dependencies = [ "bytes", "fnv", "futures-core", "futures-sink", "futures-util", - "http", - "indexmap 1.9.3", + "http 0.2.11", + "indexmap 2.2.3", + "slab", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "h2" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "816ec7294445779408f36fe57bc5b7fc1cf59664059096c65f905c1c61f58069" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http 1.1.0", + "indexmap 2.2.3", "slab", "tokio", "tokio-util", @@ -792,21 +833,21 @@ checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" [[package]] name = "hashbrown" -version = "0.14.0" +version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a" +checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" [[package]] name = "heck" -version = "0.4.1" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" [[package]] name = "hermit-abi" -version = "0.3.2" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b" +checksum = "d0c62115964e08cb8039170eb33c1d0e2388a256930279edca206fff675f82c3" [[package]] name = "hex" @@ -821,10 +862,39 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b07f60793ff0a4d9cef0f18e63b5357e06209987153a64648c972c1e5aff336f" [[package]] -name = "http" -version = "0.2.9" +name = "hkdf" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482" +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 = "http" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8947b1a6fad4393052c7ba1f4cd97bed3e953a95c79c92ad9b051a04611d9fbb" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "http" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" dependencies = [ "bytes", "fnv", @@ -833,12 +903,35 @@ dependencies = [ [[package]] name = "http-body" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" +checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" dependencies = [ "bytes", - "http", + "http 0.2.11", + "pin-project-lite", +] + +[[package]] +name = "http-body" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1cac85db508abc24a2e48553ba12a996e87244a0395ce011e62b37158745d643" +dependencies = [ + "bytes", + "http 1.1.0", +] + +[[package]] +name = "http-body-util" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0475f8b2ac86659c21b64320d5d653f9efe42acd2a4e560073ec61a155a34f1d" +dependencies = [ + "bytes", + "futures-core", + "http 1.1.0", + "http-body 1.0.0", "pin-project-lite", ] @@ -850,9 +943,9 @@ checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" [[package]] name = "httpdate" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" [[package]] name = "hyper" @@ -864,9 +957,9 @@ dependencies = [ "futures-channel", "futures-core", "futures-util", - "h2", - "http", - "http-body", + "h2 0.3.24", + "http 0.2.11", + "http-body 0.4.6", "httparse", "httpdate", "itoa", @@ -878,6 +971,46 @@ dependencies = [ "want", ] +[[package]] +name = "hyper" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe575dd17d0862a9a33781c8c4696a55c320909004a67a00fb286ba8b1bc496d" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "h2 0.4.4", + "http 1.1.0", + "http-body 1.0.0", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "smallvec", + "tokio", + "want", +] + +[[package]] +name = "hyper-rustls" +version = "0.26.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0bea761b46ae2b24eb4aef630d8d1c398157b6fc29e6350ecf090a0b70c952c" +dependencies = [ + "futures-util", + "http 1.1.0", + "hyper 1.3.1", + "hyper-util", + "log", + "rustls", + "rustls-native-certs", + "rustls-pki-types", + "tokio", + "tokio-rustls", + "tower-service", +] + [[package]] name = "hyper-tls" version = "0.5.0" @@ -885,24 +1018,44 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" dependencies = [ "bytes", - "hyper", + "hyper 0.14.28", "native-tls", "tokio", "tokio-native-tls", ] [[package]] -name = "iana-time-zone" -version = "0.1.57" +name = "hyper-util" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fad5b825842d2b38bd206f3e81d6957625fd7f0a361e345c30e01a0ae2dd613" +checksum = "ca38ef113da30126bbff9cd1705f9273e15d45498615d138b0c20279ac7a76aa" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "http 1.1.0", + "http-body 1.0.0", + "hyper 1.3.1", + "pin-project-lite", + "socket2", + "tokio", + "tower", + "tower-service", + "tracing", +] + +[[package]] +name = "iana-time-zone" +version = "0.1.60" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7ffbb5a1b541ea2561f8c41c087286cc091e21e556a4f09a8f6cbf17b69b141" dependencies = [ "android_system_properties", "core-foundation-sys", "iana-time-zone-haiku", "js-sys", "wasm-bindgen", - "windows", + "windows-core", ] [[package]] @@ -922,9 +1075,9 @@ checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" [[package]] name = "idna" -version = "0.4.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" +checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" dependencies = [ "unicode-bidi", "unicode-normalization", @@ -943,12 +1096,12 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.0.0" +version = "2.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5477fe2230a79769d8dc68e0eabf5437907c0457a5614a9e8dddb67f65eb65d" +checksum = "233cf39063f058ea2caae4091bf4a3ef70a653afbc026f5c4a4135d114e3c177" dependencies = [ "equivalent", - "hashbrown 0.14.0", + "hashbrown 0.14.3", "serde", ] @@ -972,15 +1125,15 @@ dependencies = [ [[package]] name = "ipnet" -version = "2.8.0" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28b29a3cd74f0f4598934efe3aeba42bae0eb4680554128851ebbecb02af14e6" +checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" [[package]] name = "itoa" -version = "1.0.9" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" +checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" [[package]] name = "js-sys" @@ -1002,9 +1155,9 @@ dependencies = [ [[package]] name = "keccak" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f6d5ed8676d904364de097082f4e7d240b571b67989ced0240f08b7f966f940" +checksum = "ecc2af9a1119c51f12a14607e783cb977bde58bc069ff0c3da1095e635d70654" dependencies = [ "cpufeatures", ] @@ -1017,21 +1170,27 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.149" +version = "0.2.153" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b" +checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" + +[[package]] +name = "libm" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" [[package]] name = "linux-raw-sys" -version = "0.4.3" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09fc20d2ca12cb9f044c93e3bd6d32d523e6e2ec3db4f7b2939cd99026ecd3f0" +checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" [[package]] name = "lock_api" -version = "0.4.10" +version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16" +checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" dependencies = [ "autocfg 1.1.0", "scopeguard", @@ -1039,22 +1198,25 @@ dependencies = [ [[package]] name = "log" -version = "0.4.19" +version = "0.4.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4" +checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" [[package]] name = "lox-distributor" version = "0.1.0" dependencies = [ - "base64", + "array-bytes", + "base64 0.22.0", "chrono", "clap", + "curve25519-dalek", "futures", + "hex", "hex_fmt", - "hyper", + "hyper 0.14.28", "julianday", - "lox-library", + "lox-library 0.1.0", "lox-zkp", "lox_utils", "prometheus", @@ -1065,10 +1227,12 @@ dependencies = [ "serde", "serde_json", "serde_with", + "sha1", "sled", "thiserror", "time", "tokio", + "troll-patrol", ] [[package]] @@ -1076,7 +1240,32 @@ name = "lox-library" version = "0.1.0" dependencies = [ "aes-gcm", - "base64", + "base64 0.22.0", + "bincode", + "chrono", + "curve25519-dalek", + "ed25519-dalek", + "hex_fmt", + "lazy_static", + "lox-zkp", + "prometheus", + "rand 0.8.5", + "serde", + "serde_with", + "sha2", + "statistical", + "subtle", + "thiserror", + "time", +] + +[[package]] +name = "lox-library" +version = "0.1.0" +source = "git+https://gitlab.torproject.org/vecna/lox.git#ec5217222e4af3ff8f02ff08b04396fc98235edc" +dependencies = [ + "aes-gcm", + "base64 0.21.7", "bincode", "chrono", "curve25519-dalek", @@ -1101,11 +1290,11 @@ version = "0.1.0" dependencies = [ "chrono", "console_error_panic_hook", - "getrandom 0.2.10", + "getrandom 0.2.12", "js-sys", "julianday", "lazy_static", - "lox-library", + "lox-library 0.1.0", "lox-zkp", "lox_utils", "rand 0.7.3", @@ -1117,7 +1306,7 @@ dependencies = [ [[package]] name = "lox-zkp" version = "0.8.0" -source = "git+https://gitlab.torproject.org/onyinyang/lox-zkp#10a8379081f079fc09669640f29c255897b3b454" +source = "git+https://gitlab.torproject.org/onyinyang/lox-zkp#4ca074986c8e6ded461c2b127bef8f40ee2b7665" dependencies = [ "curve25519-dalek", "merlin", @@ -1131,28 +1320,31 @@ dependencies = [ name = "lox_utils" version = "0.1.0" dependencies = [ + "base64 0.22.0", "chrono", - "lox-library", + "lox-library 0.1.0", + "rand 0.8.5", "serde", "serde_json", "serde_with", ] [[package]] -name = "memchr" -version = "2.5.0" +name = "matrixmultiply" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" - -[[package]] -name = "memoffset" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c" +checksum = "7574c1cf36da4798ab73da5b215bbf444f50718207754cb522201d78d1cd0ff2" dependencies = [ "autocfg 1.1.0", + "rawpointer", ] +[[package]] +name = "memchr" +version = "2.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" + [[package]] name = "merlin" version = "3.0.0" @@ -1172,25 +1364,60 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" [[package]] -name = "miniz_oxide" -version = "0.7.1" +name = "minimal-lexical" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + +[[package]] +name = "miniz_oxide" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d811f3e15f28568be3407c8e7fdb6514c1cda3cb30683f15b6a1a1dc4ea14a7" dependencies = [ "adler", ] [[package]] name = "mio" -version = "0.8.8" +version = "0.8.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2" +checksum = "8f3d0b296e374a4e6f3c7b0a1f5a51d748a0d34c85e7dc48fc3fa9a87657fe09" dependencies = [ "libc", "wasi 0.11.0+wasi-snapshot-preview1", "windows-sys 0.48.0", ] +[[package]] +name = "nalgebra" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d506eb7e08d6329505faa8a3a00a5dcc6de9f76e0c77e4b75763ae3c770831ff" +dependencies = [ + "approx", + "matrixmultiply", + "nalgebra-macros", + "num-complex 0.4.5", + "num-rational 0.4.1", + "num-traits", + "rand 0.8.5", + "rand_distr", + "simba", + "typenum", +] + +[[package]] +name = "nalgebra-macros" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01fcc0b8149b4632adc89ac3b7b31a12fb6099a0317a4eb2ebff574ef7de7218" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "native-tls" version = "0.2.11" @@ -1209,6 +1436,16 @@ dependencies = [ "tempfile", ] +[[package]] +name = "nom" +version = "7.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +dependencies = [ + "memchr", + "minimal-lexical", +] + [[package]] name = "num" version = "0.2.1" @@ -1216,10 +1453,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b8536030f9fea7127f841b45bb6243b27255787fb4eb83958aa1ef9d2fdc0c36" dependencies = [ "num-bigint", - "num-complex", + "num-complex 0.2.4", "num-integer", "num-iter", - "num-rational", + "num-rational 0.2.4", "num-traits", ] @@ -1244,6 +1481,15 @@ dependencies = [ "num-traits", ] +[[package]] +name = "num-complex" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23c6602fda94a57c990fe0df199a035d83576b496aa29f4e634a8ac6004e68a6" +dependencies = [ + "num-traits", +] + [[package]] name = "num-conv" version = "0.1.0" @@ -1252,19 +1498,18 @@ checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" [[package]] name = "num-integer" -version = "0.1.45" +version = "0.1.46" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" dependencies = [ - "autocfg 1.1.0", "num-traits", ] [[package]] name = "num-iter" -version = "0.1.43" +version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d03e6c028c5dc5cac6e2dec0efda81fc887605bb3d884578bb6d6bf7514e252" +checksum = "d869c01cc0c455284163fd0092f1f93835385ccab5a98a0dcc497b2f8bf055a9" dependencies = [ "autocfg 1.1.0", "num-integer", @@ -1284,12 +1529,24 @@ dependencies = [ ] [[package]] -name = "num-traits" -version = "0.2.16" +name = "num-rational" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f30b0abd723be7e2ffca1272140fac1a2f084c77ec3e123c192b66af1ee9e6c2" +checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" dependencies = [ "autocfg 1.1.0", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a" +dependencies = [ + "autocfg 1.1.0", + "libm", ] [[package]] @@ -1304,18 +1561,18 @@ dependencies = [ [[package]] name = "object" -version = "0.31.1" +version = "0.32.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bda667d9f2b5051b8833f59f3bf748b28ef54f850f4fcb389a252aa383866d1" +checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" dependencies = [ "memchr", ] [[package]] name = "once_cell" -version = "1.18.0" +version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "opaque-debug" @@ -1325,11 +1582,11 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[package]] name = "openssl" -version = "0.10.55" +version = "0.10.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "345df152bc43501c5eb9e4654ff05f794effb78d4efe3d53abc158baddc0703d" +checksum = "15c9d69dd87a29568d4d017cfe8ec518706046a05184e5aea92d0af890b803c8" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.4.2", "cfg-if", "foreign-types", "libc", @@ -1346,7 +1603,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.48", ] [[package]] @@ -1357,9 +1614,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-sys" -version = "0.9.90" +version = "0.9.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "374533b0e45f3a7ced10fcaeccca020e66656bc03dac384f852e4e5a7a8104a6" +checksum = "22e1bf214306098e4832460f797824c05d25aacdf896f64a985fb0fd992454ae" dependencies = [ "cc", "libc", @@ -1385,7 +1642,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" dependencies = [ "lock_api", - "parking_lot_core 0.9.8", + "parking_lot_core 0.9.9", ] [[package]] @@ -1404,22 +1661,48 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.8" +version = "0.9.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447" +checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" dependencies = [ "cfg-if", "libc", - "redox_syscall 0.3.5", + "redox_syscall 0.4.1", "smallvec", - "windows-targets 0.48.1", + "windows-targets 0.48.5", ] [[package]] -name = "percent-encoding" -version = "2.3.0" +name = "paste" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" +checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" + +[[package]] +name = "percent-encoding" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" + +[[package]] +name = "pin-project" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.48", +] [[package]] name = "pin-project-lite" @@ -1445,15 +1728,15 @@ dependencies = [ [[package]] name = "pkg-config" -version = "0.3.27" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" +checksum = "2900ede94e305130c13ddd391e0ab7cbaeb783945ae07a279c268cb05109c6cb" [[package]] name = "platforms" -version = "3.1.2" +version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4503fa043bf02cee09a9582e9554b4c6403b2ef55e4612e96561d294419429f8" +checksum = "626dec3cac7cc0e1577a2ec3fc496277ec2baa084bebad95bb6fdbfae235f84c" [[package]] name = "polyval" @@ -1481,9 +1764,9 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "proc-macro2" -version = "1.0.74" +version = "1.0.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2de98502f212cfcea8d0bb305bd0f49d7ebdd75b64ba0a68f937d888f4e0d6db" +checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" dependencies = [ "unicode-ident", ] @@ -1523,7 +1806,7 @@ checksum = "440f724eba9f6996b75d63681b0a92b06947f1457076d503a4d2e2c8f56442b8" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.48", ] [[package]] @@ -1644,7 +1927,17 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ - "getrandom 0.2.10", + "getrandom 0.2.12", +] + +[[package]] +name = "rand_distr" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32cb0b9bc82b0a0876c2dd994a7e7a2683d3e7390ca40e6886785ef0c7e3ee31" +dependencies = [ + "num-traits", + "rand 0.8.5", ] [[package]] @@ -1718,6 +2011,12 @@ dependencies = [ "rand_core 0.3.1", ] +[[package]] +name = "rawpointer" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3" + [[package]] name = "rdrand" version = "0.4.0" @@ -1757,28 +2056,28 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.3.5" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" +checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" dependencies = [ "bitflags 1.3.2", ] [[package]] name = "reqwest" -version = "0.11.18" +version = "0.11.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cde824a14b7c14f85caff81225f411faacc04a2013f41670f41443742b1c1c55" +checksum = "c6920094eb85afde5e4a138be3f2de8bbdf28000f0029e72c45025a56b042251" dependencies = [ - "base64", + "base64 0.21.7", "bytes", "encoding_rs", "futures-core", "futures-util", - "h2", - "http", - "http-body", - "hyper", + "h2 0.3.24", + "http 0.2.11", + "http-body 0.4.6", + "hyper 0.14.28", "hyper-tls", "ipnet", "js-sys", @@ -1788,9 +2087,12 @@ dependencies = [ "once_cell", "percent-encoding", "pin-project-lite", + "rustls-pemfile 1.0.4", "serde", "serde_json", "serde_urlencoded", + "sync_wrapper", + "system-configuration", "tokio", "tokio-native-tls", "tokio-util", @@ -1803,6 +2105,21 @@ dependencies = [ "winreg", ] +[[package]] +name = "ring" +version = "0.17.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d" +dependencies = [ + "cc", + "cfg-if", + "getrandom 0.2.12", + "libc", + "spin", + "untrusted", + "windows-sys 0.52.0", +] + [[package]] name = "rustc-demangle" version = "0.1.23" @@ -1820,30 +2137,102 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.4" +version = "0.38.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a962918ea88d644592894bc6dc55acc6c0956488adcebbfb6e273506b7fd6e5" +checksum = "6ea3e1a662af26cd7a3ba09c0297a31af215563ecf42817c98df621387f4e949" dependencies = [ - "bitflags 2.3.3", + "bitflags 2.4.2", "errno", "libc", "linux-raw-sys", - "windows-sys 0.48.0", + "windows-sys 0.52.0", +] + +[[package]] +name = "rustls" +version = "0.22.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf4ef73721ac7bcd79b2b315da7779d8fc09718c6b3d2d1b2d94850eb8c18432" +dependencies = [ + "log", + "ring", + "rustls-pki-types", + "rustls-webpki", + "subtle", + "zeroize", +] + +[[package]] +name = "rustls-native-certs" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f1fb85efa936c42c6d5fc28d2629bb51e4b2f4b8a5211e297d599cc5a093792" +dependencies = [ + "openssl-probe", + "rustls-pemfile 2.1.2", + "rustls-pki-types", + "schannel", + "security-framework", +] + +[[package]] +name = "rustls-pemfile" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c" +dependencies = [ + "base64 0.21.7", +] + +[[package]] +name = "rustls-pemfile" +version = "2.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29993a25686778eb88d4189742cd713c9bce943bc54251a33509dc63cbacf73d" +dependencies = [ + "base64 0.22.0", + "rustls-pki-types", +] + +[[package]] +name = "rustls-pki-types" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "beb461507cee2c2ff151784c52762cf4d9ff6a61f3e80968600ed24fa837fa54" + +[[package]] +name = "rustls-webpki" +version = "0.102.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3bce581c0dd41bce533ce695a1437fa16a7ab5ac3ccfa99fe1a620a7885eabf" +dependencies = [ + "ring", + "rustls-pki-types", + "untrusted", ] [[package]] name = "ryu" -version = "1.0.15" +version = "1.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" +checksum = "f98d2aa92eebf49b69786be48e4477826b256916e84a57ff2a4f21923b48eb4c" + +[[package]] +name = "safe_arch" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f398075ce1e6a179b46f51bd88d0598b92b00d3551f1a2d4ac49e771b56ac354" +dependencies = [ + "bytemuck", +] [[package]] name = "schannel" -version = "0.1.22" +version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c3733bf4cf7ea0880754e19cb5a462007c4a8c1914bff372ccc95b464f1df88" +checksum = "fbc91545643bcf3a0bbb6569265615222618bdf33ce4ffbbd13c4bbd4c093534" dependencies = [ - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -1877,9 +2266,9 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.18" +version = "1.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0293b4b29daaf487284529cc2f5675b8e57c61f70167ba415a463651fd6a918" +checksum = "b97ed7a9823b74f99c7742f5336af7be5ecd3eeafcb1507d1fa93347b1d589b0" [[package]] name = "serde" @@ -1898,7 +2287,7 @@ checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.48", ] [[package]] @@ -1930,11 +2319,11 @@ version = "3.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ee80b0e361bbf88fd2f6e242ccd19cfda072cb0faa6ae694ecee08199938569a" dependencies = [ - "base64", + "base64 0.21.7", "chrono", "hex", "indexmap 1.9.3", - "indexmap 2.0.0", + "indexmap 2.2.3", "serde", "serde_derive", "serde_json", @@ -1951,7 +2340,7 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn", + "syn 2.0.48", ] [[package]] @@ -1967,15 +2356,25 @@ dependencies = [ [[package]] name = "sha2" -version = "0.10.7" +version = "0.10.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "479fb9d862239e610720565ca91403019f2f00410f1864c5aa7479b950a76ed8" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" dependencies = [ "cfg-if", "cpufeatures", "digest", ] +[[package]] +name = "sha3" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" +dependencies = [ + "digest", + "keccak", +] + [[package]] name = "signal-hook-registry" version = "1.4.1" @@ -1987,15 +2386,31 @@ dependencies = [ [[package]] name = "signature" -version = "2.1.0" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e1788eed21689f9cf370582dfc467ef36ed9c707f073528ddafa8d83e3b8500" +checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" +dependencies = [ + "rand_core 0.6.4", +] + +[[package]] +name = "simba" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0b7840f121a46d63066ee7a99fc81dcabbc6105e437cae43528cea199b5a05f" +dependencies = [ + "approx", + "num-complex 0.4.5", + "num-traits", + "paste", + "wide", +] [[package]] name = "slab" -version = "0.4.8" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6528351c9bc8ab22353f9d776db39a20288e8d6c37ef8cfe3317cf875eecfc2d" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" dependencies = [ "autocfg 1.1.0", ] @@ -2018,25 +2433,31 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.11.0" +version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9" +checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" [[package]] name = "socket2" -version = "0.4.9" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662" +checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9" dependencies = [ "libc", - "winapi", + "windows-sys 0.48.0", ] [[package]] -name = "spki" -version = "0.7.2" +name = "spin" +version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d1e996ef02c474957d681f1b05213dfb0abab947b446a62d37770b23500184a" +checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" + +[[package]] +name = "spki" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" dependencies = [ "base64ct", "der", @@ -2052,6 +2473,19 @@ dependencies = [ "rand 0.6.5", ] +[[package]] +name = "statrs" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d08e5e1748192713cc281da8b16924fb46be7b0c2431854eadc785823e5696e" +dependencies = [ + "approx", + "lazy_static", + "nalgebra", + "num-traits", + "rand 0.8.5", +] + [[package]] name = "strsim" version = "0.10.0" @@ -2072,9 +2506,9 @@ checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" [[package]] name = "syn" -version = "2.0.46" +version = "1.0.109" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89456b690ff72fddcecf231caedbe615c59480c93358a93dfae7fc29e3ebbf0e" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" dependencies = [ "proc-macro2", "quote", @@ -2082,43 +2516,80 @@ dependencies = [ ] [[package]] -name = "tempfile" -version = "3.7.0" +name = "syn" +version = "2.0.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5486094ee78b2e5038a6382ed7645bc084dc2ec433426ca4c3cb61e2007b8998" +checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "sync_wrapper" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" + +[[package]] +name = "system-configuration" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" +dependencies = [ + "bitflags 1.3.2", + "core-foundation", + "system-configuration-sys", +] + +[[package]] +name = "system-configuration-sys" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "tempfile" +version = "3.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a365e8cd18e44762ef95d87f284f4b5cd04107fec2ff3052bd6a3e6069669e67" dependencies = [ "cfg-if", "fastrand", - "redox_syscall 0.3.5", "rustix", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] name = "thiserror" -version = "1.0.58" +version = "1.0.59" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03468839009160513471e86a034bb2c5c0e4baae3b43f79ffc55c4a5427b3297" +checksum = "f0126ad08bff79f29fc3ae6a55cc72352056dfff61e3ff8bb7129476d44b23aa" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.58" +version = "1.0.59" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c61f3ba182994efc43764a46c018c347bc492c79f024e705f46567b418f6d4f7" +checksum = "d1cd413b5d558b4c5bf3680e324a6fa5014e7b7c067a51e69dbdf47eb7148b66" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.48", ] [[package]] name = "time" -version = "0.3.34" +version = "0.3.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8248b6521bb14bc45b4067159b9b6ad792e2d6d754d6c41fb50e29fefe38749" +checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" dependencies = [ "deranged", "itoa", @@ -2137,9 +2608,9 @@ checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.17" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ba3a3ef41e6672a2f0f001392bb5dcd3ff0a9992d618ca761a11c3121547774" +checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf" dependencies = [ "num-conv", "time-core", @@ -2162,11 +2633,10 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.29.1" +version = "1.36.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "532826ff75199d5833b9d2c5fe410f29235e25704ee5f0ef599fb51c21f4a4da" +checksum = "61285f6515fa018fb2d1e46eb21223fff441ee8db5d0f1435e8ab4f5cdb80931" dependencies = [ - "autocfg 1.1.0", "backtrace", "bytes", "libc", @@ -2181,14 +2651,27 @@ dependencies = [ ] [[package]] -name = "tokio-macros" -version = "2.1.0" +name = "tokio-cron" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" +checksum = "b944e8ff32e1e16d12b8bf42a60051ddea80e3c70f776012bd63c761288769fe" +dependencies = [ + "chrono", + "cron", + "futures", + "tokio", + "tracing", +] + +[[package]] +name = "tokio-macros" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.48", ] [[package]] @@ -2201,6 +2684,17 @@ dependencies = [ "tokio", ] +[[package]] +name = "tokio-rustls" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "775e0c0f0adb3a2f22a00c4745d728b479985fc15ee7ca6a2608388c5569860f" +dependencies = [ + "rustls", + "rustls-pki-types", + "tokio", +] + [[package]] name = "tokio-stream" version = "0.1.15" @@ -2226,6 +2720,28 @@ dependencies = [ "tracing", ] +[[package]] +name = "tower" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" +dependencies = [ + "futures-core", + "futures-util", + "pin-project", + "pin-project-lite", + "tokio", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "tower-layer" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0" + [[package]] name = "tower-service" version = "0.3.2" @@ -2234,47 +2750,96 @@ checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" [[package]] name = "tracing" -version = "0.1.37" +version = "0.1.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" +checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" dependencies = [ - "cfg-if", + "log", "pin-project-lite", + "tracing-attributes", "tracing-core", ] [[package]] -name = "tracing-core" -version = "0.1.31" +name = "tracing-attributes" +version = "0.1.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0955b8137a1df6f1a2e9a37d8a6656291ff0297c1a97c24e0d8425fe2312f79a" +checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.48", +] + +[[package]] +name = "tracing-core" +version = "0.1.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" dependencies = [ "once_cell", ] +[[package]] +name = "troll-patrol" +version = "0.1.0" +source = "git+https://git-crysp.uwaterloo.ca/vvecna/troll-patrol#a504e8aef283d4852f6cbcfa415f93a21b32a04b" +dependencies = [ + "aes-gcm", + "array-bytes", + "bincode", + "chrono", + "clap", + "curve25519-dalek", + "ed25519-dalek", + "futures", + "hkdf", + "http 1.1.0", + "http-body-util", + "hyper 0.14.28", + "hyper-rustls", + "hyper-util", + "julianday", + "lazy_static", + "lox-library 0.1.0 (git+https://gitlab.torproject.org/vecna/lox.git)", + "nalgebra", + "rand 0.8.5", + "serde", + "serde_json", + "serde_with", + "sha1", + "sha3", + "sled", + "statrs", + "time", + "tokio", + "tokio-cron", + "x25519-dalek", +] + [[package]] name = "try-lock" -version = "0.2.4" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" [[package]] name = "typenum" -version = "1.16.0" +version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" [[package]] name = "unicode-bidi" -version = "0.3.13" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" +checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" [[package]] name = "unicode-ident" -version = "1.0.11" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "unicode-normalization" @@ -2296,10 +2861,16 @@ dependencies = [ ] [[package]] -name = "url" -version = "2.4.0" +name = "untrusted" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50bff7831e19200a85b17131d085c25d7811bc4e186efdaf54bbd132994a88cb" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + +[[package]] +name = "url" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" dependencies = [ "form_urlencoded", "idna", @@ -2366,15 +2937,15 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn", + "syn 2.0.48", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.37" +version = "0.4.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c02dbc21516f9f1f04f187958890d7e6026df8d16540b7ad9492bc34a67cea03" +checksum = "877b9c3f61ceea0e56331985743b13f3d25c406a7098d45180fb5f09bc19ed97" dependencies = [ "cfg-if", "js-sys", @@ -2400,7 +2971,7 @@ checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.48", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -2413,9 +2984,9 @@ checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" [[package]] name = "wasm-streams" -version = "0.2.3" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bbae3363c08332cadccd13b67db371814cd214c2524020932f0804b8cf7c078" +checksum = "b65dc4c90b63b118468cf747d8bf3566c1913ef60be765b5730ead9e0a3ba129" dependencies = [ "futures-util", "js-sys", @@ -2426,14 +2997,24 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.64" +version = "0.3.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b" +checksum = "96565907687f7aceb35bc5fc03770a8a0471d82e479f25832f54a0e3f4b28446" dependencies = [ "js-sys", "wasm-bindgen", ] +[[package]] +name = "wide" +version = "0.7.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81a1851a719f11d1d2fea40e15c72f6c00de8c142d7ac47c1441cc7e4d0d5bc6" +dependencies = [ + "bytemuck", + "safe_arch", +] + [[package]] name = "winapi" version = "0.3.9" @@ -2457,12 +3038,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] -name = "windows" -version = "0.48.0" +name = "windows-core" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" +checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" dependencies = [ - "windows-targets 0.48.1", + "windows-targets 0.52.0", ] [[package]] @@ -2471,7 +3052,7 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" dependencies = [ - "windows-targets 0.48.1", + "windows-targets 0.48.5", ] [[package]] @@ -2485,17 +3066,17 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.48.1" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05d4b17490f70499f20b9e791dcf6a299785ce8af4d709018206dc5b4953e95f" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" dependencies = [ - "windows_aarch64_gnullvm 0.48.0", - "windows_aarch64_msvc 0.48.0", - "windows_i686_gnu 0.48.0", - "windows_i686_msvc 0.48.0", - "windows_x86_64_gnu 0.48.0", - "windows_x86_64_gnullvm 0.48.0", - "windows_x86_64_msvc 0.48.0", + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", ] [[package]] @@ -2515,9 +3096,9 @@ dependencies = [ [[package]] name = "windows_aarch64_gnullvm" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" [[package]] name = "windows_aarch64_gnullvm" @@ -2527,9 +3108,9 @@ checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" [[package]] name = "windows_aarch64_msvc" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_aarch64_msvc" @@ -2539,9 +3120,9 @@ checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" [[package]] name = "windows_i686_gnu" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_gnu" @@ -2551,9 +3132,9 @@ checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" [[package]] name = "windows_i686_msvc" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_i686_msvc" @@ -2563,9 +3144,9 @@ checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" [[package]] name = "windows_x86_64_gnu" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnu" @@ -2575,9 +3156,9 @@ checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" [[package]] name = "windows_x86_64_gnullvm" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_gnullvm" @@ -2587,9 +3168,9 @@ checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" [[package]] name = "windows_x86_64_msvc" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "windows_x86_64_msvc" @@ -2599,18 +3180,31 @@ checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" [[package]] name = "winreg" -version = "0.10.1" +version = "0.50.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d" +checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" dependencies = [ - "winapi", + "cfg-if", + "windows-sys 0.48.0", +] + +[[package]] +name = "x25519-dalek" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7e468321c81fb07fa7f4c636c3972b9100f0346e5b6a9f2bd0603a52f7ed277" +dependencies = [ + "curve25519-dalek", + "rand_core 0.6.4", + "serde", + "zeroize", ] [[package]] name = "zeroize" -version = "1.6.0" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a0956f1ba7c7909bfb66c2e9e4124ab6f6482560f6628b5aaeba39207c9aad9" +checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d" dependencies = [ "zeroize_derive", ] @@ -2623,5 +3217,5 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.48", ] diff --git a/crates/lox-distributor/Cargo.toml b/crates/lox-distributor/Cargo.toml index 2bb9fd4..af9c2f3 100644 --- a/crates/lox-distributor/Cargo.toml +++ b/crates/lox-distributor/Cargo.toml @@ -16,11 +16,12 @@ readme = "README.md" [dependencies] julianday = "1.2.0" -base64 = "0.21.7" +base64 = "0.22.0" hyper = { version = "0.14.28", features = ["deprecated", "backports","server"] } +hex = "0.4.3" hex_fmt = "0.3" futures = "0.3.30" -time = "0.3.34" +time = "0.3.36" tokio = { version = "1", features = ["full", "macros", "signal"] } rand = "0.8.5" reqwest = { version = "0.11", features = ["json", "stream"]} @@ -30,7 +31,7 @@ lox-zkp = { git = "https://gitlab.torproject.org/onyinyang/lox-zkp", version = " lox-library = { path = "../lox-library", version = "0.1.0"} lox_utils = { path = "../lox-utils", version = "0.1.0"} rdsys_backend = { path = "../rdsys-backend-api", version = "0.2"} -clap = { version = "4.5.2", features = ["derive"] } +clap = { version = "4.5.4", features = ["derive"] } serde_json = "1.0.113" prometheus = "0.13.3" sled = "0.34.7" @@ -42,5 +43,5 @@ array-bytes = "6.2.0" sha1 = "0.10" [dependencies.chrono] -version = "0.4.34" +version = "0.4.38" features = ["serde"] diff --git a/crates/lox-distributor/bridge_config.json b/crates/lox-distributor/bridge_config.json new file mode 100644 index 0000000..a1f3ede --- /dev/null +++ b/crates/lox-distributor/bridge_config.json @@ -0,0 +1,6 @@ +{ + "watched_blockages": [ + "RU" + ], + "percent_spares": 50 +} \ No newline at end of file diff --git a/crates/lox-distributor/src/db_handler.rs b/crates/lox-distributor/src/db_handler.rs index 4b46b6c..72a26dc 100644 --- a/crates/lox-distributor/src/db_handler.rs +++ b/crates/lox-distributor/src/db_handler.rs @@ -81,7 +81,7 @@ impl DB { extra_bridges: Arc::new(Mutex::new(Vec::new())), to_be_replaced_bridges: Arc::new(Mutex::new(Vec::new())), tp_bridge_infos: Arc::new(Mutex::new(HashMap::< - [u8; 20], + String, BridgeVerificationInfo, >::new())), metrics, diff --git a/crates/lox-distributor/src/fake_resource_state.rs b/crates/lox-distributor/src/fake_resource_state.rs new file mode 100644 index 0000000..096e816 --- /dev/null +++ b/crates/lox-distributor/src/fake_resource_state.rs @@ -0,0 +1,151 @@ +use crate::resource_parser::ACCEPTED_HOURS_OF_FAILURE; +use chrono::{Duration, Utc}; +use rand::{Rng, RngCore}; +use rdsys_backend::proto::{Resource, ResourceState, TestResults}; +use std::collections::HashMap; + +#[derive(Default)] +pub struct TestResourceState { + pub rstate: ResourceState, +} + +impl TestResourceState { + + // A previously working resources become not_working but within accepted failure time + pub fn working_with_accepted_failures(&mut self) { + match &mut self.rstate.working { + Some(resources) => { + if let Some(resource) = resources.pop() { + self.add_not_working_to_rstate(resource) + } + } + None => { + panic!("rstate.working Empty") + } + } + + assert_ne!(self.rstate.working, None); + assert_eq!(self.rstate.not_working, None); + } + + // Block resources that are working. Targeted blocked regions are specified in bridge_config.json + pub fn block_working(&mut self) { + match &mut self.rstate.working { + Some(resources) => { + for resource in resources { + resource.blocked_in = HashMap::from([ + ("AS".to_owned(), true), + ("IR".to_owned(), false), + ("RU".to_owned(), false), + ("CN".to_owned(), false), + ("SA".to_owned(), false), + ]); + } + } + None => { + panic!("rstate.working Empty") + } + } + assert_ne!(self.rstate.working, None); + assert_eq!(self.rstate.not_working, None); + } + + // Add a resource that is working + pub fn add_working_resource(&mut self) { + let working_resource = make_resource( + HashMap::from([ + ("AS".to_owned(), false), + ("IR".to_owned(), false), + ("RU".to_owned(), false), + ("CN".to_owned(), false), + ("SA".to_owned(), false), + ]), + ACCEPTED_HOURS_OF_FAILURE - 12, + ); + self.add_working_to_rstate(working_resource); + } + + // Add a not-working resource that has been failing for 1 hour longer than the accepted threshold + pub fn add_not_working_resource(&mut self) { + let not_working_resource = make_resource( + HashMap::from([ + ("AS".to_owned(), false), + ("IR".to_owned(), false), + ("RU".to_owned(), false), + ("CN".to_owned(), false), + ("SA".to_owned(), false), + ]), + ACCEPTED_HOURS_OF_FAILURE + 1, + ); + self.add_not_working_to_rstate(not_working_resource); + } + + // Add resource to rstate's working field + pub fn add_working_to_rstate(&mut self, working_resource: Resource) { + match &mut self.rstate.working { + Some(resources) => { + resources.push(working_resource); + } + None => { + self.rstate.working = Some(vec![working_resource]); + } + } + } + + // Add resource to rstate's not_working field + pub fn add_not_working_to_rstate(&mut self, not_working_resource: Resource) { + match &mut self.rstate.not_working { + Some(resources) => { + resources.push(not_working_resource); + } + None => { + self.rstate.not_working = Some(vec![not_working_resource]); + } + } + } +} + +pub fn make_resource(blocked_in: HashMap, last_passed: i64) -> Resource { + let mut flags = HashMap::new(); + flags.insert(String::from("fast"), true); + flags.insert(String::from("stable"), true); + let mut params = HashMap::new(); + params.insert( + String::from("password"), + String::from("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"), + ); + Resource { + r#type: String::from("obfs4"), + blocked_in, + test_result: TestResults { + last_passed: Utc::now() - Duration::hours(last_passed), + }, + protocol: String::from("tcp"), + address: gen_ip(), + port: gen_port(), + fingerprint: gen_fingerprint(), + or_addresses: None, + distribution: String::from("https"), + flags: Some(flags), + params: Some(params), + } +} + +pub fn gen_fingerprint() -> String { + let mut rng = rand::thread_rng(); + let mut fingerprint_array: [u8; 16] = [0; 16]; + rng.fill_bytes(&mut fingerprint_array); + hex::encode_upper(fingerprint_array) +} + +pub fn gen_port() -> u16 { + rand::thread_rng().gen_range(0..u16::MAX) +} + +pub fn gen_ip() -> String { + let i = rand::thread_rng().gen_range(1..u8::MAX); + let ii = rand::thread_rng().gen_range(1..u8::MAX); + let iii = rand::thread_rng().gen_range(1..u8::MAX); + let iv = rand::thread_rng().gen_range(1..u8::MAX); + format!("{}.{}.{}.{}", i, ii, iii, iv) +} diff --git a/crates/lox-distributor/src/lox_context.rs b/crates/lox-distributor/src/lox_context.rs index 4c2b87e..924b183 100644 --- a/crates/lox-distributor/src/lox_context.rs +++ b/crates/lox-distributor/src/lox_context.rs @@ -38,7 +38,7 @@ pub struct LoxServerContext { pub extra_bridges: Arc>>, pub to_be_replaced_bridges: Arc>>, // Map of bridge fingerprint to values needed to verify TP reports - pub tp_bridge_infos: Arc>>, + pub tp_bridge_infos: Arc>>, #[serde(skip)] pub metrics: Metrics, } @@ -82,7 +82,10 @@ impl LoxServerContext { for bridge in blocked_bridgelines { let res = self.mark_blocked(bridge); if res { - println!("BridgeLine {:?} successfully marked unreachable", bridge); + println!( + "BridgeLine {:?} successfully marked unreachable", + bridge.uid_fingerprint + ); self.metrics.blocked_bridges.inc(); } else { println!( @@ -107,6 +110,7 @@ impl LoxServerContext { self.metrics.new_bridges.inc(); } } + accounted_for_bridges } @@ -127,7 +131,7 @@ impl LoxServerContext { if res { println!( "Blocked BridgeLine {:?} successfully marked unreachable", - bridge + bridge.uid_fingerprint ); self.metrics.blocked_bridges.inc(); } else { @@ -154,33 +158,37 @@ impl LoxServerContext { // Next, handle the failing bridges. If resource last passed tests >= ACCEPTED_HOURS_OF_FAILURE ago, // it should be replaced with a working resource and be removed from the bridgetable. for bridge in failing { - let res = self.replace_with_new(bridge); - if res == lox_library::ReplaceSuccess::Replaced { - println!( - "Failing BridgeLine {:?} successfully replaced.", - bridge.uid_fingerprint - ); - accounted_for_bridges.push(bridge.uid_fingerprint); - self.metrics.removed_bridges.inc(); - } else if res == lox_library::ReplaceSuccess::NotReplaced { - // Add the bridge to the list of to_be_replaced bridges in the Lox context and try - // again to replace at the next update (nothing changes in the Lox Authority) - println!( - "Failing BridgeLine {:?} NOT replaced, saved for next update!", - bridge.uid_fingerprint - ); - self.metrics.existing_or_updated_bridges.inc(); - accounted_for_bridges.push(bridge.uid_fingerprint); - } else { - // NotFound - assert!( - res == lox_library::ReplaceSuccess::NotFound, - "ReplaceSuccess incorrectly set" - ); - println!( + match self.replace_with_new(bridge) { + lox_library::ReplaceSuccess::Replaced => { + println!( + "Failing BridgeLine {:?} successfully replaced.", + bridge.uid_fingerprint + ); + accounted_for_bridges.push(bridge.uid_fingerprint); + self.metrics.removed_bridges.inc(); + } + lox_library::ReplaceSuccess::NotReplaced => { + // Add the bridge to the list of to_be_replaced bridges in the Lox context and try + // again to replace at the next update (nothing changes in the Lox Authority) + println!( + "Failing BridgeLine {:?} NOT replaced, saved for next update!", + bridge.uid_fingerprint + ); + self.metrics.existing_or_updated_bridges.inc(); + accounted_for_bridges.push(bridge.uid_fingerprint); + } + lox_library::ReplaceSuccess::Removed => { + println!( + "Failing BridgeLine {:?} successfully removed.", + bridge.uid_fingerprint + ); + accounted_for_bridges.push(bridge.uid_fingerprint); + self.metrics.removed_bridges.inc(); + } + lox_library::ReplaceSuccess::NotFound => println!( "Failing BridgeLine {:?} not found in bridge table.", bridge.uid_fingerprint - ); + ), } } accounted_for_bridges @@ -204,33 +212,36 @@ impl LoxServerContext { accounted_for_bridges, ); } - let mut ba_clone = self.ba.lock().unwrap(); - let total_reachable = ba_clone.bridge_table.reachable.len(); - match total_reachable.cmp(&accounted_for_bridges.len()) { - Ordering::Greater => { - let unaccounted_for = ba_clone.find_and_remove_unaccounted_for_bridges(accounted_for_bridges); - for bridgeline in unaccounted_for { - match self.replace_with_new(bridgeline) { - lox_library::ReplaceSuccess::Replaced => { - println!("BridgeLine {:?} not found in rdsys update was successfully replaced.", bridgeline.uid_fingerprint); - self.metrics.removed_bridges.inc(); - } - lox_library::ReplaceSuccess::NotReplaced => { - // Try again to replace at the next update (nothing changes in the Lox Authority) - println!("BridgeLine {:?} not found in rdsys update NOT replaced, saved for next update!", - bridgeline.uid_fingerprint); - self.metrics.existing_or_updated_bridges.inc(); - } - lox_library::ReplaceSuccess::NotFound => println!( - "BridgeLine {:?} no longer in reachable bridges.", - bridgeline.uid_fingerprint - ), - } - } - } - Ordering::Less => println!("Something unexpected occurred: The number of reachable bridges should not be less than those updated from rdsys"), - _ => (), + let unaccounted_for = self + .ba + .lock() + .unwrap() + .find_and_remove_unaccounted_for_bridges(accounted_for_bridges); + for bridgeline in unaccounted_for { + match self.replace_with_new(bridgeline) { + lox_library::ReplaceSuccess::Replaced => { + println!( + "BridgeLine {:?} not found in rdsys update was successfully replaced.", + bridgeline.uid_fingerprint + ); + self.metrics.removed_bridges.inc(); + } + lox_library::ReplaceSuccess::Removed => { + println!("BridgeLine {:?} not found in rdsys update was not distributed to a bucket so was removed", bridgeline.uid_fingerprint); + self.metrics.removed_bridges.inc(); + } + lox_library::ReplaceSuccess::NotReplaced => { + // Try again to replace at the next update (nothing changes in the Lox Authority) + println!("BridgeLine {:?} not found in rdsys update NOT replaced, saved for next update!", + bridgeline.uid_fingerprint); + self.metrics.existing_or_updated_bridges.inc(); + } + lox_library::ReplaceSuccess::NotFound => println!( + "BridgeLine {:?} no longer in reachable bridges.", + bridgeline.uid_fingerprint + ), + } } // Finally, assign any extra_bridges to new buckets if there are enough while self.extra_bridges.lock().unwrap().len() >= MAX_BRIDGES_PER_BUCKET { @@ -238,7 +249,12 @@ impl LoxServerContext { // TODO: Decide the circumstances under which a bridge is allocated to an open_inv or spare bucket, // eventually also do some more fancy grouping of new resources, i.e., by type or region let mut db_obj = self.db.lock().unwrap(); - match ba_clone.add_spare_bucket(bucket, &mut db_obj) { + match self + .ba + .lock() + .unwrap() + .add_spare_bucket(bucket, &mut db_obj) + { Ok(_) => (), Err(e) => { println!("Error: {:?}", e); @@ -251,6 +267,10 @@ impl LoxServerContext { // Regenerate tables for verifying TP reports self.generate_tp_bridge_infos(); + // Any remaining extra bridges should be cleared from the Lox Context after each sync + // Currently bridgetable updating behaviour does not occur without receiving a resource list + // from rdsys so if the extra bridge is still working, it can be added to the table later + self.extra_bridges.lock().unwrap().clear(); } pub fn append_extra_bridges(&self, bridge: BridgeLine) { @@ -362,11 +382,12 @@ impl LoxServerContext { let mut hasher = Sha1::new(); hasher.update(&bridge.fingerprint); let fingerprint: [u8; 20] = hasher.finalize().into(); + let fingerprint_str = array_bytes::bytes2hex("", fingerprint); // Add bucket to existing entry or add new entry - if tp_bridge_infos.contains_key(&fingerprint) { + if tp_bridge_infos.contains_key(&fingerprint_str) { tp_bridge_infos - .get_mut(&fingerprint) + .get_mut(&fingerprint_str) .unwrap() .buckets .insert(bucket); @@ -374,7 +395,7 @@ impl LoxServerContext { let mut buckets = HashSet::::new(); buckets.insert(bucket); tp_bridge_infos.insert( - fingerprint, + fingerprint_str, BridgeVerificationInfo { bridge_line: *bridge, buckets: buckets, @@ -807,13 +828,12 @@ impl LoxServerContext { }; // TODO: Forward this information to rdsys for bridge_str in blocked_bridges.keys() { - let bridge = array_bytes::hex2array(bridge_str).unwrap(); - if self.tp_bridge_infos.lock().unwrap().contains_key(&bridge) { + if self.tp_bridge_infos.lock().unwrap().contains_key(bridge_str) { let bl = self .tp_bridge_infos .lock() .unwrap() - .get(&bridge) + .get(bridge_str) .unwrap() .bridge_line; self.mark_blocked(bl); @@ -828,7 +848,7 @@ impl LoxServerContext { .tp_bridge_infos .lock() .unwrap() - .get(&report.fingerprint) + .get(&array_bytes::bytes2hex("", report.fingerprint)) { Some(bridge_info) => report.verify(&bridge_info), None => false, @@ -871,7 +891,7 @@ impl LoxServerContext { .tp_bridge_infos .lock() .unwrap() - .get(&report.fingerprint) + .get(&array_bytes::bytes2hex("", report.fingerprint)) { Some(bridge_info) => report.verify(la, &bridge_info, &Htable), None => false, @@ -920,3 +940,212 @@ fn prepare_header(response: String) -> Response { .insert("Access-Control-Allow-Origin", HeaderValue::from_static("*")); resp } + +#[cfg(test)] +mod tests { + use crate::{fake_resource_state::TestResourceState, metrics::Metrics, BridgeConfig}; + use lox_library::{bridge_table::MAX_BRIDGES_PER_BUCKET, BridgeAuth, BridgeDb}; + use std::{ + collections::HashMap, + env, fs, + sync::{Arc, Mutex}, + }; + use troll_patrol::bridge_verification_info::BridgeVerificationInfo; + + use super::LoxServerContext; + + struct TestHarness { + context: LoxServerContext, + } + + impl TestHarness { + fn new() -> Self { + let bridgedb = BridgeDb::new(); + let mut lox_auth = BridgeAuth::new(bridgedb.pubkey); + lox_auth.enc_bridge_table(); + let context = LoxServerContext { + db: Arc::new(Mutex::new(bridgedb)), + ba: Arc::new(Mutex::new(lox_auth)), + extra_bridges: Arc::new(Mutex::new(Vec::new())), + to_be_replaced_bridges: Arc::new(Mutex::new(Vec::new())), + tp_bridge_infos: Arc::new(Mutex::new( + HashMap::::new(), + )), + metrics: Metrics::default(), + }; + Self { context } + } + + fn new_with_bridges() -> Self { + let mut bridgedb = BridgeDb::new(); + let mut lox_auth = BridgeAuth::new(bridgedb.pubkey); + // Make 3 x num_buckets open invitation bridges, in sets of 3 + for _ in 0..5 { + let bucket = [ + lox_utils::random(), + lox_utils::random(), + lox_utils::random(), + ]; + let _ = lox_auth.add_openinv_bridges(bucket, &mut bridgedb); + } + + // Add hot_spare more hot spare buckets + for _ in 0..5 { + let bucket = [ + lox_utils::random(), + lox_utils::random(), + lox_utils::random(), + ]; + let _ = lox_auth.add_spare_bucket(bucket, &mut bridgedb); + } + // Create the encrypted bridge table + lox_auth.enc_bridge_table(); + let context = LoxServerContext { + db: Arc::new(Mutex::new(bridgedb)), + ba: Arc::new(Mutex::new(lox_auth)), + extra_bridges: Arc::new(Mutex::new(Vec::new())), + to_be_replaced_bridges: Arc::new(Mutex::new(Vec::new())), + tp_bridge_infos: Arc::new(Mutex::new( + HashMap::::new(), + )), + metrics: Metrics::default(), + }; + Self { context } + } + } + + fn get_config() -> BridgeConfig { + env::set_var("BRIDGE_CONFIG_PATH", "bridge_config.json"); + let path = env::var("BRIDGE_CONFIG_PATH").unwrap(); + let config_file = fs::File::open(&path).unwrap(); + serde_json::from_reader(config_file).unwrap() + } + + #[test] + fn test_sync_with_bridgetable_only_working_resources() { + let bridge_config = get_config(); + // Add bridges to empty bridge table and update with changed bridge state + let th = TestHarness::new(); + let mut rs = TestResourceState::default(); + for _ in 0..5 { + rs.add_working_resource(); + } + assert_ne!(rs.rstate.working, None); + assert_eq!(rs.rstate.not_working, None); + + th.context + .sync_with_bridgetable(bridge_config.watched_blockages.clone(), rs.rstate.clone()); + let mut reachable_expected_length = rs.rstate.clone().working.unwrap().len(); + let expected_extra_bridges = reachable_expected_length % MAX_BRIDGES_PER_BUCKET; + if expected_extra_bridges != 0 { + reachable_expected_length = reachable_expected_length - expected_extra_bridges; + } + assert_eq!( + th.context.ba.lock().unwrap().bridge_table.reachable.len(), + reachable_expected_length, + "Unexpected number of reachable bridges" + ); + // Extra bridges should be cleared from the Lox Context after each sync + assert!( + th.context.extra_bridges.lock().unwrap().is_empty(), + "Extra bridges should be empty after sync" + ); + } + + #[test] + fn test_sync_with_bridgetable_working_and_not_working_resources() { + let bridge_config = get_config(); + // Add bridges to empty bridge table and update with changed bridge state + let th = TestHarness::new(); + let mut rs = TestResourceState::default(); + for _ in 0..5 { + rs.add_working_resource(); + } + + for _ in 0..5 { + rs.add_not_working_resource() + } + assert_ne!(rs.rstate.working, None); + assert_ne!(rs.rstate.not_working, None); + + th.context + .sync_with_bridgetable(bridge_config.watched_blockages.clone(), rs.rstate.clone()); + let mut reachable_expected_length = rs.rstate.clone().working.unwrap().len(); + let expected_extra_bridges = reachable_expected_length % MAX_BRIDGES_PER_BUCKET; + if expected_extra_bridges != 0 { + reachable_expected_length = reachable_expected_length - expected_extra_bridges; + } + assert_eq!( + th.context.ba.lock().unwrap().bridge_table.reachable.len(), + reachable_expected_length, + "Unexpected number of reachable bridges" + ); + // Extra bridges should be cleared from the Lox Context after each sync + assert!( + th.context.extra_bridges.lock().unwrap().is_empty(), + "Extra bridges should be empty after sync" + ); + } + + #[test] + fn test_sync_with_preloaded_obsolete_bridgetable() { + // Tests the case where all bridges in the bridgetable are no longer in rdsys. + // In this case, all bridges should be replaced. If it's a bridge in a spare bucket, just remove the other bridges + // from the spare bucket and delete the bridge + let bridge_config = get_config(); + // Sync bridges to non-empty bridge table with disparate sets of bridges + let th_with_bridges = TestHarness::new_with_bridges(); //Creates 5 open invitation and 5 hot spare buckets, so 30 total buckets to be replaced + let mut rs = TestResourceState::default(); + for _ in 0..5 { + rs.add_working_resource(); + } + assert_ne!(rs.rstate.working, None); + assert_eq!(rs.rstate.not_working, None); + + assert_eq!(th_with_bridges.context.ba.lock().unwrap().bridge_table.reachable.len(), 15+15, "Unexpected number of reachable bridges should equal the number of open invitation bridges plus the number of spares added: 2x5x3"); + assert_eq!( + th_with_bridges + .context + .ba + .lock() + .unwrap() + .bridge_table + .spares + .len(), + 5, + "Unexpected number of spare bridges, should be 5" + ); + + // All potentially distributed resources (i.e., those assigned to open invitation/trusted buckets) + // not found in the rdsys update will first be replaced with any new resources coming in from rdsys then + // by bridges from the hot spare buckets. In this case, the hot spare buckets are also not in the bridge table + // so will also be replaced. + // Since there are fewer working resources than resources that have populated the bridge table, this update will + // exhaust the spare buckets and leave some obsolete bridges. The set of open invitation/trusted buckets should be + // preserved (5 open invitation buckets * 3) + th_with_bridges + .context + .sync_with_bridgetable(bridge_config.watched_blockages, rs.rstate.clone()); + assert_eq!(th_with_bridges.context.ba.lock().unwrap().bridge_table.reachable.len(), 15, "Unexpected number of reachable bridges should equal the number of open invitation bridges added: 5x3"); + assert_eq!( + th_with_bridges + .context + .ba + .lock() + .unwrap() + .bridge_table + .spares + .len(), + 0, + "Unexpected number of spare bridges, should be exhausted" + ); + + assert_eq!(th_with_bridges.context.ba.lock().unwrap().bridge_table.unallocated_bridges.len(), 0, "Unexpected number of unallocated bridges, should be 0 (All spare buckets and new resources for replacement exhausted)" + ); + assert_eq!( + th_with_bridges.context.extra_bridges.lock().unwrap().len(), + 0, + "Unexpected number of extra bridges" + ); + } +} diff --git a/crates/lox-distributor/src/main.rs b/crates/lox-distributor/src/main.rs index 25f3fb3..6655bdf 100644 --- a/crates/lox-distributor/src/main.rs +++ b/crates/lox-distributor/src/main.rs @@ -26,6 +26,7 @@ use std::{ mod db_handler; use db_handler::DB; +mod fake_resource_state; mod lox_context; mod metrics; use metrics::Metrics; diff --git a/crates/lox-distributor/src/request_handler.rs b/crates/lox-distributor/src/request_handler.rs index f58969d..7fb4b72 100644 --- a/crates/lox-distributor/src/request_handler.rs +++ b/crates/lox-distributor/src/request_handler.rs @@ -74,14 +74,10 @@ mod tests { use super::*; - use base64::{engine::general_purpose, Engine as _}; + use base64::{engine::general_purpose, Engine}; use chrono::{Duration, Utc}; use julianday::JulianDay; - use lox_library::{ - bridge_table::{self, BridgeLine}, - cred::BucketReachability, - proto, BridgeAuth, BridgeDb, - }; + use lox_library::{bridge_table, bridge_table::BridgeLine, cred::BucketReachability, proto, BridgeAuth, BridgeDb}; use rand::RngCore; use std::sync::{Arc, Mutex}; @@ -226,13 +222,21 @@ mod tests { // Make 3 x num_buckets open invitation bridges, in sets of 3 for _ in 0..5 { - let bucket = [random(), random(), random()]; + let bucket = [ + lox_utils::random(), + lox_utils::random(), + lox_utils::random(), + ]; let _ = lox_auth.add_openinv_bridges(bucket, &mut bridgedb); } // Add hot_spare more hot spare buckets for _ in 0..5 { - let bucket = [random(), random(), random()]; + let bucket = [ + lox_utils::random(), + lox_utils::random(), + lox_utils::random(), + ]; let _ = lox_auth.add_spare_bucket(bucket, &mut bridgedb); } // Create the encrypted bridge table @@ -243,7 +247,7 @@ mod tests { extra_bridges: Arc::new(Mutex::new(Vec::new())), to_be_replaced_bridges: Arc::new(Mutex::new(Vec::new())), tp_bridge_infos: Arc::new(Mutex::new(std::collections::HashMap::< - [u8; 20], + String, troll_patrol::bridge_verification_info::BridgeVerificationInfo, >::new())), metrics: Metrics::default(), diff --git a/crates/lox-distributor/src/resource_parser.rs b/crates/lox-distributor/src/resource_parser.rs index b3643aa..c2faf5d 100644 --- a/crates/lox-distributor/src/resource_parser.rs +++ b/crates/lox-distributor/src/resource_parser.rs @@ -189,7 +189,7 @@ mod tests { "123.456.789.100".to_owned(), 3002, "BE84A97D02130470A1C77839954392BA979F7EE1".to_owned(), - ACCEPTED_HOURS_OF_FAILURE-1, + ACCEPTED_HOURS_OF_FAILURE - 1, ); let resource_two = make_resource( "https".to_owned(), @@ -203,7 +203,7 @@ mod tests { "123.222.333.444".to_owned(), 6002, "C56B9EF202130470A1C77839954392BA979F7FF9".to_owned(), - ACCEPTED_HOURS_OF_FAILURE+2, + ACCEPTED_HOURS_OF_FAILURE + 2, ); let resource_three = make_resource( "scramblesuit".to_owned(), @@ -217,7 +217,7 @@ mod tests { "443.288.222.100".to_owned(), 3042, "5E3A8BD902130470A1C77839954392BA979F7B46".to_owned(), - ACCEPTED_HOURS_OF_FAILURE+1, + ACCEPTED_HOURS_OF_FAILURE + 1, ); let resource_four = make_resource( "https".to_owned(), diff --git a/crates/lox-distributor/src/troll_patrol_handler.rs b/crates/lox-distributor/src/troll_patrol_handler.rs index e4fb762..10a9a27 100644 --- a/crates/lox-distributor/src/troll_patrol_handler.rs +++ b/crates/lox-distributor/src/troll_patrol_handler.rs @@ -142,7 +142,7 @@ mod tests { extra_bridges: Arc::new(Mutex::new(Vec::new())), to_be_replaced_bridges: Arc::new(Mutex::new(Vec::new())), tp_bridge_infos: Arc::new(Mutex::new( - HashMap::<[u8; 20], BridgeVerificationInfo>::new(), + HashMap::::new(), )), metrics: Metrics::default(), }; diff --git a/crates/lox-library/Cargo.toml b/crates/lox-library/Cargo.toml index b5b1ac1..483c762 100644 --- a/crates/lox-library/Cargo.toml +++ b/crates/lox-library/Cargo.toml @@ -16,7 +16,7 @@ readme = "README.md" [dependencies] curve25519-dalek = { version = "4", default-features = false, features = ["serde", "rand_core", "digest"] } ed25519-dalek = { version = "2", features = ["serde", "rand_core"] } -bincode = "1" +bincode = "1.3.3" chrono = "0.4" rand = { version = "0.8", features = ["std_rng"]} serde = "1.0.197" @@ -26,11 +26,11 @@ statistical = "1.0.0" lazy_static = "1" hex_fmt = "0.3" aes-gcm = { version = "0.10", features =["aes"]} -base64 = "0.21" -time = "0.3.34" +base64 = "0.22.0" +time = "0.3.36" prometheus = "0.13.3" subtle = "2.5" -thiserror = "1.0.58" +thiserror = "1.0.59" lox-zkp = { git = "https://gitlab.torproject.org/onyinyang/lox-zkp", version = "0.8.0" } [features] diff --git a/crates/lox-library/src/lib.rs b/crates/lox-library/src/lib.rs index 694c184..3ade055 100644 --- a/crates/lox-library/src/lib.rs +++ b/crates/lox-library/src/lib.rs @@ -73,6 +73,7 @@ pub enum ReplaceSuccess { NotFound = 0, NotReplaced = 1, Replaced = 2, + Removed = 3, } /// This error is thrown if the number of buckets/keys in the bridge table @@ -511,6 +512,17 @@ impl BridgeAuth { return res; } } + // Also check the unallocated bridges just in case there is a bridge that should be updated there + let unallocated_bridges = self.bridge_table.unallocated_bridges.clone(); + for (i, unallocated_bridge) in unallocated_bridges.iter().enumerate() { + if unallocated_bridge.uid_fingerprint == bridge.uid_fingerprint { + // Now we must remove the old bridge from the unallocated bridges and insert the new bridge + // in its place + self.bridge_table.unallocated_bridges.remove(i); + self.bridge_table.unallocated_bridges.push(*bridge); + res = true; + } + } // If this is returned, we assume that the bridge wasn't found in the bridge table // and therefore should be treated as a "new bridge" res @@ -535,6 +547,25 @@ impl BridgeAuth { Ok(()) } + // Remove an unallocated resource + pub fn remove_unallocated(&mut self, bridge: &BridgeLine) -> ReplaceSuccess { + // Check if the bridge is in the unallocated bridges and remove the bridge if so + // Bridges in spare buckets should have been moved to the unallocated bridges + if self.bridge_table.unallocated_bridges.contains(bridge) { + let index = self + .bridge_table + .unallocated_bridges + .iter() + .position(|x| x == bridge) + .unwrap(); + self.bridge_table.unallocated_bridges.swap_remove(index); + // A bridge that is in the unallocated_bridges is not exactly replaced + // but is successfully handled and no further action is needed + return ReplaceSuccess::Removed; + } + ReplaceSuccess::NotFound + } + /// Attempt to remove a bridge that is failing tests and replace it with a bridge from /// available_bridge or from a spare bucket pub fn bridge_replace( @@ -544,8 +575,23 @@ impl BridgeAuth { ) -> ReplaceSuccess { let reachable_bridges = &self.bridge_table.reachable.clone(); let Some(positions) = reachable_bridges.get(bridge) else { - return ReplaceSuccess::NotFound; + return self.remove_unallocated(bridge); }; + // Check if the bridge is in a spare bucket first, if it is, dissolve the bucket + if let Some(spare) = self + .bridge_table + .spares + .iter() + .find(|x| positions.iter().any(|(bucketnum, _)| &bucketnum == x)) + .cloned() + { + let Ok(_) = self.dissolve_spare_bucket(spare) else { + return ReplaceSuccess::NotReplaced; + }; + // Next Check if the bridge is in the unallocated bridges and remove the bridge if so + // Bridges in spare buckets should have been moved to the unallocated bridges + return self.remove_unallocated(bridge); + } // select replacement: // - first try the given bridge // - second try to pick one from the set of available bridges diff --git a/crates/lox-library/src/tests.rs b/crates/lox-library/src/tests.rs index 33f1cd8..bd53068 100644 --- a/crates/lox-library/src/tests.rs +++ b/crates/lox-library/src/tests.rs @@ -1060,22 +1060,39 @@ fn test_update_bridge() { #[test] fn test_bridge_replace() { // Create 3 open invitation buckets and 3 spare buckets - let cases = vec!["not found", "available", "unallocated", "spare", "failed"]; + let cases = vec![ + "not found", + "available", + "unallocated", + "use_spare", + "remove_spare", + "failed", + ]; let num_buckets = 5; let hot_spare = 0; for case in cases { + let table_size: usize; let mut th: TestHarness; - if String::from(case) != "failed" { - th = TestHarness::new(); - } else { - th = TestHarness::new_buckets(num_buckets, hot_spare); + match case { + "failed" => { + th = TestHarness::new_buckets(num_buckets, hot_spare); + table_size = th.ba.bridge_table.buckets.len(); + } + "remove_spare" => { + th = TestHarness::new_buckets(0, 5); + table_size = th.ba.bridge_table.buckets.len(); + } + _ => { + th = TestHarness::new(); + // Ensure that a randomly selected bucket isn't taken from the set of spare bridges + table_size = th.ba.bridge_table.buckets.len() - 5; + } } // Randomly select a bridge to replace - let table_size = th.ba.bridge_table.buckets.len(); let mut num = 100000; while !th.ba.bridge_table.buckets.contains_key(&num) { - num = rand::thread_rng().gen_range(0..th.ba.bridge_table.counter); + num = rand::thread_rng().gen_range(0..table_size as u32); } println!("chosen num is: {:?}", num); let replaceable_bucket = *th.ba.bridge_table.buckets.get(&num).unwrap(); @@ -1093,7 +1110,10 @@ fn test_bridge_replace() { // Case zero: bridge to be replaced is not in the bridgetable let random_bridgeline = BridgeLine::random(); assert!( - !th.ba.bridge_table.reachable.contains_key(&random_bridgeline), + !th.ba + .bridge_table + .reachable + .contains_key(&random_bridgeline), "Random bridgeline happens to be in the bridge_table (and should not be)" ); assert!( @@ -1133,8 +1153,10 @@ fn test_bridge_replace() { .is_some(), "Replacement bridge not added to reachable bridges" ); + println!("Table Size {:?}", table_size); + println!("Bucket length {:?}", th.ba.bridge_table.buckets.len() - 5); assert!( - table_size == th.ba.bridge_table.buckets.len(), + table_size == th.ba.bridge_table.buckets.len() - 5, "Number of buckets changed size" ); assert!( @@ -1175,7 +1197,7 @@ fn test_bridge_replace() { "Replacement bridge not added to reachable bridges" ); assert!( - table_size == th.ba.bridge_table.buckets.len(), + table_size == th.ba.bridge_table.buckets.len() - 5, "Number of buckets changed size" ); assert!( @@ -1185,7 +1207,7 @@ fn test_bridge_replace() { println!("Successfully added unallocated bridgeline"); } - "spare" => { + "use_spare" => { // Case three: available_bridge == null and unallocated_bridges == null assert!( th.ba.bridge_table.unallocated_bridges.is_empty(), @@ -1205,7 +1227,7 @@ fn test_bridge_replace() { ); // Remove a spare bucket to replace bridge, buckets decrease by 1 assert!( - (table_size - 1) == th.ba.bridge_table.buckets.len(), + (table_size - 1) == th.ba.bridge_table.buckets.len() - 5, "Number of buckets changed size" ); assert!( @@ -1215,6 +1237,40 @@ fn test_bridge_replace() { println!("Successfully added bridgeline from spare"); } + "remove_spare" => { + // Case three: available_bridge == null and unallocated_bridges == null + assert!( + th.ba.bridge_table.unallocated_bridges.is_empty(), + "Unallocated bridges should have a length of 0" + ); + assert!( + th.ba.bridge_replace(replacement_bridge, None) == ReplaceSuccess::Removed, + "Bridge was replaced with available spare, instead of being removed" + ); + assert!( + th.ba.bridge_table.unallocated_bridges.len() == 2, + "Unallocated bridges should have a length of 2" + ); + assert!( + th.ba + .bridge_table + .reachable + .get(replacement_bridge) + .is_none(), + "Replacement bridge still marked as reachable" + ); + // Remove a spare bucket to replace bridge, buckets decrease by 1 + assert!( + (table_size - 1) == th.ba.bridge_table.buckets.len(), + "Number of buckets changed size" + ); + assert!( + th.ba.bridge_table.unallocated_bridges.len() == 2, + "Extra spare bridges not added to unallocated bridges" + ); + + println!("Successfully removed a spare bridgeline marked to be replaced"); + } "failed" => { // Case four: available_bridge == None and unallocated_bridges == None and spare buckets == None assert!( diff --git a/crates/lox-utils/Cargo.toml b/crates/lox-utils/Cargo.toml index 2879664..21d6d99 100644 --- a/crates/lox-utils/Cargo.toml +++ b/crates/lox-utils/Cargo.toml @@ -12,8 +12,10 @@ categories = ["rust-patterns"] repository = "https://gitlab.torproject.org/tpo/anti-censorship/lox.git/" [dependencies] -chrono = { version = "0.4.34", features = ["serde", "clock"] } +base64 = "0.22.0" +chrono = { version = "0.4.38", features = ["serde", "clock"] } lox-library = {path = "../lox-library", version = "0.1.0"} +rand = "0.8.5" serde = "1" serde_json = "1.0.113" serde_with = "3.7.0" diff --git a/crates/lox-utils/src/lib.rs b/crates/lox-utils/src/lib.rs index 20b24cc..0a137fe 100644 --- a/crates/lox-utils/src/lib.rs +++ b/crates/lox-utils/src/lib.rs @@ -1,3 +1,4 @@ +use base64::{engine::general_purpose, Engine as _}; use chrono::{DateTime, Utc}; use lox_library::bridge_table::{ from_scalar, BridgeLine, BridgeTable, EncryptedBucket, MAX_BRIDGES_PER_BUCKET, @@ -5,18 +6,53 @@ use lox_library::bridge_table::{ use lox_library::cred::{BucketReachability, Invitation, Lox}; use lox_library::proto::{self, check_blockage, level_up, trust_promotion}; use lox_library::{IssuerPubKey, OPENINV_LENGTH}; +use rand::RngCore; use serde::{Deserialize, Serialize}; use serde_with::serde_as; use std::array::TryFromSliceError; use std::collections::HashMap; -#[serde_as] +const LOX_INVITE_TOKEN: &str = "loxinvite_"; + #[derive(Serialize, Deserialize)] pub struct Invite { - #[serde_as(as = "[_; OPENINV_LENGTH]")] + #[serde(with = "base64serde")] pub invite: [u8; OPENINV_LENGTH], } +mod base64serde { + use base64::{engine::general_purpose::STANDARD_NO_PAD, Engine as _}; + use lox_library::OPENINV_LENGTH; + use serde::{Deserialize, Serialize}; + use serde::{Deserializer, Serializer}; + + use crate::LOX_INVITE_TOKEN; + + pub fn serialize(v: &[u8; OPENINV_LENGTH], s: S) -> Result { + let mut base64 = STANDARD_NO_PAD.encode(v); + base64.insert_str(0, LOX_INVITE_TOKEN); + String::serialize(&base64, s) + } + + pub fn deserialize<'de, D: Deserializer<'de>>(d: D) -> Result<[u8; OPENINV_LENGTH], D::Error> { + let mut base64 = String::deserialize(d)?; + let encoded_str = base64.split_off(LOX_INVITE_TOKEN.len()); + if base64 != LOX_INVITE_TOKEN { + return Err(serde::de::Error::custom("Token identifier does not match")) + } + match STANDARD_NO_PAD.decode(encoded_str) { + Ok(output) => { + let out: Result<[u8; OPENINV_LENGTH], D::Error> = match output.try_into() { + Ok(out) => Ok(out), + Err(e) => Err(serde::de::Error::custom(String::from_utf8(e).unwrap())), + }; + out + } + Err(e) => Err(serde::de::Error::custom(e)), + } + } +} + #[derive(Deserialize, Serialize)] pub struct OpenReqState { pub request: proto::open_invite::Request, @@ -154,3 +190,34 @@ pub fn calc_test_days(trust_level: i64) -> i64 { // } total } + +pub fn random() -> BridgeLine { + let mut rng = rand::thread_rng(); + let mut res: BridgeLine = BridgeLine::default(); + // Pick a random 4-byte address + let mut addr: [u8; 4] = [0; 4]; + rng.fill_bytes(&mut addr); + // If the leading byte is 224 or more, that's not a valid IPv4 + // address. Choose an IPv6 address instead (but don't worry too + // much about it being well formed). + if addr[0] >= 224 { + rng.fill_bytes(&mut res.addr); + } else { + // Store an IPv4 address as a v4-mapped IPv6 address + res.addr[10] = 255; + res.addr[11] = 255; + res.addr[12..16].copy_from_slice(&addr); + }; + let ports: [u16; 4] = [443, 4433, 8080, 43079]; + let portidx = (rng.next_u32() % 4) as usize; + res.port = ports[portidx]; + res.uid_fingerprint = rng.next_u64(); + let mut cert: [u8; 52] = [0; 52]; + rng.fill_bytes(&mut cert); + let infostr: String = format!( + "obfs4 cert={}, iat-mode=0", + general_purpose::STANDARD_NO_PAD.encode(cert) + ); + res.info[..infostr.len()].copy_from_slice(infostr.as_bytes()); + res +} diff --git a/crates/lox-wasm/Cargo.toml b/crates/lox-wasm/Cargo.toml index ace07c9..e84e5c8 100644 --- a/crates/lox-wasm/Cargo.toml +++ b/crates/lox-wasm/Cargo.toml @@ -21,7 +21,7 @@ lazy_static = "1.4.0" lox-library = { path = "../lox-library", version = "0.1.0" } lox_utils = { path = "../lox-utils", version = "0.1.0" } wasm-bindgen = "0.2" -time = "0.3.34" +time = "0.3.36" serde_json = "1.0.113" console_error_panic_hook = "0.1.7" @@ -30,5 +30,5 @@ rand = { version = "0.7", features = ["wasm-bindgen"] } lox-zkp = { git = "https://gitlab.torproject.org/onyinyang/lox-zkp", version = "0.8.0" } [dependencies.chrono] -version = "0.4.34" +version = "0.4.38" features = ["serde", "wasmbind"] diff --git a/crates/lox-wasm/index.js b/crates/lox-wasm/index.js index 6f337a9..2c491a3 100644 --- a/crates/lox-wasm/index.js +++ b/crates/lox-wasm/index.js @@ -199,7 +199,7 @@ function request_open_invite() { return new Promise((fulfill, reject) => { loxServerPostRequest("/invite", null).then((response) => { console.log("Got invitation token: " + response.invite); - fulfill(response.invite); + fulfill(JSON.stringify(response)); return; }).catch(() => { console.log("Error requesting open invite from Lox server"); diff --git a/crates/lox-wasm/src/lib.rs b/crates/lox-wasm/src/lib.rs index da2a578..f15bb8c 100644 --- a/crates/lox-wasm/src/lib.rs +++ b/crates/lox-wasm/src/lib.rs @@ -29,9 +29,13 @@ pub fn set_panic_hook() { // Receives an invite and prepares an open_invite request, returning the // Request and State #[wasm_bindgen] -pub fn open_invite(invite: &[u8]) -> Result { - log(&format!("Using invite: {:?}", invite)); - let token = match lox_utils::validate(invite) { +pub fn open_invite(base64_invite: String) -> Result { + log(&format!("Using invite: {:?}", base64_invite)); + let invite: lox_utils::Invite = match serde_json::from_str(&base64_invite) { + Ok(invite) => invite, + Err(e) => return Err(JsValue::from(e.to_string())), + }; + let token = match lox_utils::validate(&invite.invite) { Ok(token) => token, Err(e) => return Err(JsValue::from(e.to_string())), }; @@ -831,29 +835,32 @@ pub fn get_next_unlock(constants_str: String, lox_cred_str: String) -> Result { - let mut blockage_days = days_to_next_level; - let mut count = 1; - while trust_level + count < constants.min_blockage_migration_trust_level { - blockage_days += constants.level_interval[trust_level as usize + count as usize]; - count += 1; - } - blockage_days + let days_to_blockage_migration_unlock = match trust_level + < constants.min_blockage_migration_trust_level + { + // If the credential is greater than the minimum level that enables + // migrating after a blockage, the time to unlock is 0, otherwise we + // add the time to upgrade until that level + true => { + let mut blockage_days = days_to_next_level; + let mut count = 1; + while trust_level + count < constants.min_blockage_migration_trust_level { + blockage_days += constants.level_interval[trust_level as usize + count as usize]; + count += 1; } - false => 0, - }; + blockage_days + } + false => 0, + }; let day_of_level_unlock = (scalar_u32(&lox_cred.lox_credential.level_since).unwrap() + days_to_next_level) as i32; let level_unlock_date = JulianDay::new(day_of_level_unlock).to_date(); let day_of_invite_unlock = (scalar_u32(&lox_cred.lox_credential.level_since).unwrap() + days_to_invite_inc) as i32; let invite_unlock_date = JulianDay::new(day_of_invite_unlock).to_date(); - let day_of_blockage_migration_unlock = (scalar_u32(&lox_cred.lox_credential.level_since).unwrap() + days_to_blockage_migration_unlock) as i32; + let day_of_blockage_migration_unlock = (scalar_u32(&lox_cred.lox_credential.level_since) + .unwrap() + + days_to_blockage_migration_unlock) as i32; let blockage_migration_unlock_date = JulianDay::new(day_of_blockage_migration_unlock as i32).to_date(); let next_unlock: lox_utils::LoxNextUnlock = lox_utils::LoxNextUnlock { diff --git a/crates/rdsys-backend-api/Cargo.toml b/crates/rdsys-backend-api/Cargo.toml index a249ffc..0556013 100644 --- a/crates/rdsys-backend-api/Cargo.toml +++ b/crates/rdsys-backend-api/Cargo.toml @@ -25,4 +25,4 @@ reqwest = { version = "0.11", features = ["json", "stream"]} tokio-stream = "0.1.15" futures = "0.3.30" tokio-util = "0.7.10" -chrono = { version = "0.4.34", features = ["serde", "clock"] } +chrono = { version = "0.4.38", features = ["serde", "clock"] } diff --git a/crates/rdsys-backend-api/src/proto.rs b/crates/rdsys-backend-api/src/proto.rs index 7ce41e9..39915e5 100644 --- a/crates/rdsys-backend-api/src/proto.rs +++ b/crates/rdsys-backend-api/src/proto.rs @@ -10,13 +10,13 @@ pub struct ResourceRequest { pub resource_types: Vec, } -#[derive(Serialize, Deserialize, Debug, PartialEq, Eq)] +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq)] pub struct TestResults { pub last_passed: DateTime, } /// Representation of a bridge resource -#[derive(Deserialize, PartialEq, Eq, Debug)] +#[derive(Clone, Deserialize, PartialEq, Eq, Debug)] pub struct Resource { pub r#type: String, pub blocked_in: HashMap, @@ -57,7 +57,7 @@ impl Resource { } /// A ResourceState holds information about new, changed, or pruned resources -#[derive(Deserialize, PartialEq, Eq, Debug)] +#[derive(Clone, Deserialize, Default, PartialEq, Eq, Debug)] pub struct ResourceState { pub working: Option>, pub not_working: Option>,