diff --git a/CHANGELOG.md b/CHANGELOG.md index adbd496..596a1d7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ All notable changes to this project will be documented in this file. +## [0.1.13] - 2021-11-18 + +### Changed + +- Support upload task output to COS. + ## [0.1.12] - 2021-11-16 ### Changed diff --git a/Cargo.lock b/Cargo.lock index f926430..e9398da 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,19 +4,19 @@ version = 3 [[package]] name = "adler" -version = "0.2.3" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee2a4ec343196209d6594e19543ae87a39f96d5534d7174822a3ad825dd6ed7e" +checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] name = "ahash" -version = "0.7.4" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43bb833f0bf979d8475d38fbf09ed3b8a55e1885fe93ad3f93239fc6a4f17b98" +checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" dependencies = [ "getrandom 0.2.3", "once_cell", - "version_check 0.9.2", + "version_check 0.9.3", ] [[package]] @@ -30,15 +30,15 @@ dependencies = [ [[package]] name = "arc-swap" -version = "0.4.7" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d25d88fd6b8041580a654f9d0c581a047baee2b3efee13275f2fc392fc75034" +checksum = "dabe5a181f83789739c194cbe5a897dde195078fac08568d09221fd6137a7ba8" [[package]] name = "async-attributes" -version = "1.1.1" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efd3d156917d94862e779f356c5acae312b08fd3121e792c857d7928c8088423" +checksum = "a3203e79f4dd9bdda415ed03cf14dae5a2bf775c683a00f94e9cd1faf0f596e5" dependencies = [ "quote", "syn", @@ -46,9 +46,9 @@ dependencies = [ [[package]] name = "async-channel" -version = "1.5.1" +version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59740d83946db6a5af71ae25ddf9562c2b176b2ca42cf99a455f09f4a220d6b9" +checksum = "2114d64672151c0c5eaa5e131ec84a74f06e1e559830dabba01ca30605d66319" dependencies = [ "concurrent-queue", "event-listener", @@ -57,26 +57,29 @@ dependencies = [ [[package]] name = "async-executor" -version = "1.3.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d373d78ded7d0b3fa8039375718cde0aace493f2e34fb60f51cbf567562ca801" +checksum = "871f9bb5e0a22eeb7e8cf16641feb87c9dc67032ccf8ff49e772eb9941d3a965" dependencies = [ "async-task", "concurrent-queue", "fastrand", "futures-lite", "once_cell", - "vec-arena", + "slab", ] [[package]] name = "async-global-executor" -version = "1.4.3" +version = "2.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73079b49cd26b8fd5a15f68fc7707fc78698dc2a3d61430f2a7a9430230dfa04" +checksum = "9586ec52317f36de58453159d48351bc244bc24ced3effc1fce22f3d48664af6" dependencies = [ + "async-channel", "async-executor", "async-io", + "async-mutex", + "blocking", "futures-lite", "num_cpus", "once_cell", @@ -84,24 +87,32 @@ dependencies = [ [[package]] name = "async-io" -version = "1.1.10" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d54bc4c1c7292475efb2253227dbcfad8fe1ca4c02bc62c510cc2f3da5c4704e" +checksum = "a811e6a479f2439f0c04038796b5cfb3d2ad56c230e0f2d3f7b04d68cfee607b" dependencies = [ "concurrent-queue", - "fastrand", "futures-lite", "libc", - "log 0.4.11", - "nb-connect", + "log 0.4.14", "once_cell", "parking", "polling", - "vec-arena", + "slab", + "socket2 0.4.2", "waker-fn", "winapi 0.3.9", ] +[[package]] +name = "async-lock" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6a8ea61bf9947a1007c5cada31e647dbc77b103c679858150003ba697ea798b" +dependencies = [ + "event-listener", +] + [[package]] name = "async-mutex" version = "1.4.0" @@ -113,14 +124,14 @@ dependencies = [ [[package]] name = "async-std" -version = "1.7.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7e82538bc65a25dbdff70e4c5439d52f068048ab97cdea0acd73f131594caa1" +checksum = "f8056f1455169ab86dd47b47391e4ab0cbd25410a70e9fe675544f49bafaf952" dependencies = [ + "async-channel", "async-global-executor", "async-io", - "async-mutex", - "blocking", + "async-lock", "crossbeam-utils 0.8.5", "futures-channel", "futures-core", @@ -128,16 +139,37 @@ dependencies = [ "futures-lite", "gloo-timers", "kv-log-macro", - "log 0.4.11", + "log 0.4.14", "memchr", "num_cpus", "once_cell", - "pin-project-lite", + "pin-project-lite 0.2.7", "pin-utils", "slab", "wasm-bindgen-futures", ] +[[package]] +name = "async-stream" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "171374e7e3b2504e0e5236e3b59260560f9fe94bfe9ac39ba5e4e929c5590625" +dependencies = [ + "async-stream-impl", + "futures-core", +] + +[[package]] +name = "async-stream-impl" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "648ed8c8d2ce5409ccd57453d9d1b214b342a0d69376a6feda1fd6cae3299308" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "async-task" version = "4.0.3" @@ -146,9 +178,9 @@ checksum = "e91831deabf0d6d7ec49552e489aed63b7456a7a3c46cff62adad428110b0af0" [[package]] name = "async-trait" -version = "0.1.50" +version = "0.1.51" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b98e84bbb4cbcdd97da190ba0c58a1bb0de2c1fdf67d159e192ed766aeca722" +checksum = "44318e776df68115a881de9a8fd1b9e53368d7a4a5ce4cc48517da3393233a5e" dependencies = [ "proc-macro2", "quote", @@ -203,12 +235,6 @@ dependencies = [ "byteorder", ] -[[package]] -name = "base64" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff" - [[package]] name = "base64" version = "0.13.0" @@ -217,9 +243,9 @@ checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" [[package]] name = "bitflags" -version = "1.2.1" +version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "block-buffer" @@ -264,9 +290,9 @@ checksum = "5988cb1d626264ac94100be357308f29ff7cbdd3b36bda27f450a4ee3f713426" [[package]] name = "bumpalo" -version = "3.4.0" +version = "3.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e8c087f005730276d1096a652e92a8bacee2e2472bcc9715a74d2bec38b5820" +checksum = "8f1e260c3a9040a7c19a12468758f4c16f31a81a1fe087482be9570ec864bb6c" [[package]] name = "byte-tools" @@ -276,9 +302,9 @@ checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" [[package]] name = "byteorder" -version = "1.3.4" +version = "1.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de" +checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[package]] name = "bytes" @@ -297,6 +323,12 @@ version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0e4cec68f03f32e44924783795810fa50a7035d8c8ebe78580ad7e6c703fba38" +[[package]] +name = "bytes" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4872d67bab6358e59559027aa3b9157c53d9358c51423c17554809a8858e0f8" + [[package]] name = "bzip2" version = "0.3.3" @@ -309,9 +341,9 @@ dependencies = [ [[package]] name = "bzip2-sys" -version = "0.1.9+1.0.8" +version = "0.1.11+1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad3b39a260062fca31f7b0b12f207e8f2590a67d32ec7d59c20484b07ea7285e" +checksum = "736a955f3fa7875102d57c82b8cac37ec45224a07fd32d58f9f7a186b6cd4cdc" dependencies = [ "cc", "libc", @@ -326,9 +358,9 @@ checksum = "631ae5198c9be5e753e5cc215e1bd73c2b466a3565173db433f52bb9d3e66dba" [[package]] name = "cc" -version = "1.0.61" +version = "1.0.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed67cbde08356238e75fc4656be4749481eeffb09e19f320a25237d5221c985d" +checksum = "79c2681d6594606957bbb8631c4b90a7fcaaa72cdb714743a437b156d6a7eedd" [[package]] name = "cfg-if" @@ -379,15 +411,6 @@ dependencies = [ "bitflags", ] -[[package]] -name = "cloudabi" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4344512281c643ae7638bbabc3af17a11307803ec8f0fcad9fae512a8bf36467" -dependencies = [ - "bitflags", -] - [[package]] name = "codepage" version = "0.1.1" @@ -423,11 +446,17 @@ version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f92cfa0fd5690b3cf8c1ef2cabbd9b7ef22fa53cf5e1f92b05103f6d5d1cf6e7" +[[package]] +name = "convert_case" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" + [[package]] name = "core-foundation" -version = "0.9.1" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a89e2ae426ea83155dccf10c0fa6b1463ef6d5fcb44cee0b224a408fa640a62" +checksum = "6888e10551bb93e424d8df1d07f1a8b4fceb0001a3a4b048bfc47554946f47b3" dependencies = [ "core-foundation-sys", "libc", @@ -435,9 +464,9 @@ dependencies = [ [[package]] name = "core-foundation-sys" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea221b5284a47e40033bf9b66f35f984ec0ea2931eb03505246cd27a963f981b" +checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" [[package]] name = "crc32fast" @@ -450,9 +479,9 @@ dependencies = [ [[package]] name = "crossbeam-deque" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f02af974daeee82218205558e51ec8768b48cf524bd01d550abe5573a608285" +checksum = "c20ff29ded3204c5106278a81a38f4b482636ed4fa1e6cfbeef193291beb29ed" dependencies = [ "crossbeam-epoch", "crossbeam-utils 0.7.2", @@ -506,6 +535,16 @@ dependencies = [ "lazy_static", ] +[[package]] +name = "ctor" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccc0a48a9b826acdf4028595adc9db92caea352f7af011a3034acd172a52a0aa" +dependencies = [ + "quote", + "syn", +] + [[package]] name = "daemonize" version = "0.4.1" @@ -551,6 +590,19 @@ dependencies = [ "syn", ] +[[package]] +name = "derive_more" +version = "0.99.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40eebddd2156ce1bb37b20bbe5151340a31828b1f2d22ba4141f3531710e38df" +dependencies = [ + "convert_case", + "proc-macro2", + "quote", + "rustc_version 0.3.3", + "syn", +] + [[package]] name = "digest" version = "0.8.1" @@ -562,9 +614,9 @@ dependencies = [ [[package]] name = "dtoa" -version = "0.4.6" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "134951f4028bdadb9b84baf4232681efbf277da25144b9b0ad65df75946c422b" +checksum = "56899898ce76aaf4a0f24d914c97ea6ed976d42fec6ad33fcbb0a1103e07b2b0" [[package]] name = "either" @@ -638,9 +690,9 @@ checksum = "a246d82be1c9d791c5dfde9a2bd045fc3cbba3fa2b11ad558f27d01712f00569" [[package]] name = "encoding_rs" -version = "0.8.28" +version = "0.8.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80df024fbc5ac80f87dfef0d9f5209a252f2a497f7f42944cff24d8253cac065" +checksum = "a74ea89a0a1b98f6332de42c95baff457ada66d1cb4030f9ff151b2041a1c746" dependencies = [ "cfg-if 1.0.0", ] @@ -659,9 +711,9 @@ checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" [[package]] name = "fastrand" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca5faf057445ce5c9d4329e382b2ce7ca38550ef3b73a5348362d5f24e0c7fe3" +checksum = "b394ed3d285a429378d3b384b9eb1285267e7df4b166df24b7a6939a04dc392e" dependencies = [ "instant", ] @@ -690,9 +742,9 @@ dependencies = [ [[package]] name = "flate2" -version = "1.0.19" +version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7411863d55df97a419aa64cb4d2f167103ea9d767e2c54a1868b7ac3f6b47129" +checksum = "1e6988e897c1c9c485f43b47a529cef42fde0547f9d8d41a7062518f1d8fc53f" dependencies = [ "cfg-if 1.0.0", "crc32fast", @@ -721,6 +773,16 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" +[[package]] +name = "form_urlencoded" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fc25a87fa4fd2094bffb06925852034d90a17f0d1e05197d4956d3555752191" +dependencies = [ + "matches", + "percent-encoding 2.1.0", +] + [[package]] name = "fuchsia-cprng" version = "0.1.1" @@ -745,15 +807,15 @@ checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" [[package]] name = "futures" -version = "0.1.30" +version = "0.1.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c7e4c2612746b0df8fed4ce0c69156021b704c9aefa360311c04e6e9e002eed" +checksum = "3a471a38ef8ed83cd6e40aa59c1ffe17db6855c18e3604d9c4ed8c08ebc28678" [[package]] name = "futures" -version = "0.3.7" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95314d38584ffbfda215621d723e0a3906f032e03ae5551e650058dac83d4797" +checksum = "a12aa0eb539080d55c3f2d45a67c3b58b6b0773c1a3ca2dfec66d58c97fd66ca" dependencies = [ "futures-channel", "futures-core", @@ -766,9 +828,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.7" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0448174b01148032eed37ac4aed28963aaaa8cfa93569a08e5b479bbc6c2c151" +checksum = "5da6ba8c3bb3c165d3c7319fc1cc8304facf1fb8db99c5de877183c08a273888" dependencies = [ "futures-core", "futures-sink", @@ -776,9 +838,9 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.7" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18eaa56102984bed2c88ea39026cff3ce3b4c7f508ca970cedf2450ea10d4e46" +checksum = "88d1c26957f23603395cd326b0ffe64124b818f4449552f960d815cfba83a53d" [[package]] name = "futures-cpupool" @@ -786,15 +848,15 @@ version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ab90cde24b3319636588d0c35fe03b1333857621051837ed769faefb4c2162e4" dependencies = [ - "futures 0.1.30", + "futures 0.1.31", "num_cpus", ] [[package]] name = "futures-executor" -version = "0.3.7" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5f8e0c9258abaea85e78ebdda17ef9666d390e987f006be6080dfe354b708cb" +checksum = "45025be030969d763025784f7f355043dc6bc74093e4ecc5000ca4dc50d8745c" dependencies = [ "futures-core", "futures-task", @@ -803,31 +865,32 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.7" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e1798854a4727ff944a7b12aa999f58ce7aa81db80d2dfaaf2ba06f065ddd2b" +checksum = "522de2a0fe3e380f1bc577ba0474108faf3f6b18321dbf60b3b9c39a75073377" [[package]] name = "futures-lite" -version = "1.11.2" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e6c079abfac3ab269e2927ec048dabc89d009ebfdda6b8ee86624f30c689658" +checksum = "7694489acd39452c77daa48516b894c153f192c3578d5a839b62c58099fcbf48" dependencies = [ "fastrand", "futures-core", "futures-io", "memchr", "parking", - "pin-project-lite", + "pin-project-lite 0.2.7", "waker-fn", ] [[package]] name = "futures-macro" -version = "0.3.7" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e36fccf3fc58563b4a14d265027c627c3b665d7fed489427e88e7cc929559efe" +checksum = "18e4a4b95cea4b4ccbcf1c5675ca7c4ee4e9e75eb79944d07defde18068f79bb" dependencies = [ + "autocfg 1.0.1", "proc-macro-hack", "proc-macro2", "quote", @@ -836,25 +899,23 @@ dependencies = [ [[package]] name = "futures-sink" -version = "0.3.7" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e3ca3f17d6e8804ae5d3df7a7d35b2b3a6fe89dac84b31872720fc3060a0b11" +checksum = "36ea153c13024fe480590b3e3d4cad89a0cfacecc24577b68f86c6ced9c2bc11" [[package]] name = "futures-task" -version = "0.3.7" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d502af37186c4fef99453df03e374683f8a1eec9dcc1e66b3b82dc8278ce3c" -dependencies = [ - "once_cell", -] +checksum = "1d3d00f4eddb73e498a54394f228cd55853bdf059259e8e7bc6e69d408892e99" [[package]] name = "futures-util" -version = "0.3.7" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abcb44342f62e6f3e8ac427b8aa815f724fd705dfad060b18ac7866c15bb8e34" +checksum = "36568465210a3a6ee45e1f165136d68671471a501e632e9a98d96872222b5481" dependencies = [ + "autocfg 1.0.1", "futures-channel", "futures-core", "futures-io", @@ -862,29 +923,35 @@ dependencies = [ "futures-sink", "futures-task", "memchr", - "pin-project 1.0.1", + "pin-project-lite 0.2.7", "pin-utils", "proc-macro-hack", "proc-macro-nested", "slab", ] +[[package]] +name = "gcc" +version = "0.3.55" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f5f3913fa0bfe7ee1fd8248b6b9f42a5af4b9d65ec2dd2c3c26132b950ecfc2" + [[package]] name = "generic-array" -version = "0.12.3" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c68f0274ae0e023facc3c97b2e00f076be70e254bc851d972503b328db79b2ec" +checksum = "ffdf9f34f1447443d37393cc6c2b8313aebddcd96906caf34e54c68d8e57d7bd" dependencies = [ "typenum", ] [[package]] name = "getrandom" -version = "0.1.15" +version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc587bc0ec293155d5bfa6b9891ec18a1e330c234f896ea47fbada4cadbe47e6" +checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" dependencies = [ - "cfg-if 0.1.10", + "cfg-if 1.0.0", "libc", "wasi 0.9.0+wasi-snapshot-preview1", ] @@ -922,10 +989,10 @@ dependencies = [ "byteorder", "bytes 0.4.12", "fnv", - "futures 0.1.30", + "futures 0.1.31", "http 0.1.21", "indexmap", - "log 0.4.11", + "log 0.4.14", "slab", "string", "tokio-io", @@ -942,10 +1009,10 @@ dependencies = [ "futures-core", "futures-sink", "futures-util", - "http 0.2.1", + "http 0.2.5", "indexmap", "slab", - "tokio 0.2.22", + "tokio 0.2.25", "tokio-util", "tracing", "tracing-futures", @@ -953,19 +1020,25 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.9.1" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7afe4a420e3fe79967a00898cc1f4db7c8a49a9333a29f8a4bd76a253d5cd04" +checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" [[package]] name = "hermit-abi" -version = "0.1.17" +version = "0.1.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aca5565f760fb5b220e499d72710ed156fdb74e631659e99377d9ebfbd13ae8" +checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" dependencies = [ "libc", ] +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + [[package]] name = "http" version = "0.1.21" @@ -979,11 +1052,11 @@ dependencies = [ [[package]] name = "http" -version = "0.2.1" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28d569972648b2c512421b5f2a405ad6ac9666547189d0c5477a3f200f3e02f9" +checksum = "1323096b05d41827dadeaee54c9981958c0f94e670bc94ed80037d1a7b8b186b" dependencies = [ - "bytes 0.5.6", + "bytes 1.1.0", "fnv", "itoa", ] @@ -995,7 +1068,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6741c859c1b2463a423a1dbce98d418e6c3c3fc720fb0d45528657320920292d" dependencies = [ "bytes 0.4.12", - "futures 0.1.30", + "futures 0.1.31", "http 0.1.21", "tokio-buf", ] @@ -1007,14 +1080,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13d5ff830006f7646652e057693569bfe0d51760c0085a071769d142a205111b" dependencies = [ "bytes 0.5.6", - "http 0.2.1", + "http 0.2.5", ] [[package]] name = "httparse" -version = "1.3.4" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd179ae861f0c2e53da70d892f5f3029f9594be0c41dc5269cd371691b1dc2f9" +checksum = "acd94fdbe1d4ff688b67b04eee2e17bd50995534a61539e45adfefb45e5e5503" [[package]] name = "httpdate" @@ -1052,12 +1125,12 @@ dependencies = [ [[package]] name = "hyper" -version = "0.12.35" +version = "0.12.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9dbe6ed1438e1f8ad955a4701e9a944938e9519f6888d12d8558b645e247d5f6" +checksum = "5c843caf6296fc1f93444735205af9ed4e109a539005abb2564ae1d6fad34c52" dependencies = [ "bytes 0.4.12", - "futures 0.1.30", + "futures 0.1.31", "futures-cpupool", "h2 0.1.26", "http 0.1.21", @@ -1065,9 +1138,9 @@ dependencies = [ "httparse", "iovec", "itoa", - "log 0.4.11", + "log 0.4.14", "net2", - "rustc_version", + "rustc_version 0.2.3", "time 0.1.44", "tokio 0.1.22", "tokio-buf", @@ -1082,23 +1155,23 @@ dependencies = [ [[package]] name = "hyper" -version = "0.13.9" +version = "0.13.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6ad767baac13b44d4529fcf58ba2cd0995e36e7b435bc5b039de6f47e880dbf" +checksum = "8a6f157065790a3ed2f88679250419b5cdd96e714a0d65f7797fd337186e96bb" dependencies = [ "bytes 0.5.6", "futures-channel", "futures-core", "futures-util", "h2 0.2.7", - "http 0.2.1", + "http 0.2.5", "http-body 0.3.1", "httparse", "httpdate", "itoa", - "pin-project 1.0.1", - "socket2", - "tokio 0.2.22", + "pin-project", + "socket2 0.3.19", + "tokio 0.2.25", "tower-service", "tracing", "want 0.3.0", @@ -1111,9 +1184,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d979acc56dcb5b8dddba3917601745e877576475aa046df3226eabdecef78eed" dependencies = [ "bytes 0.5.6", - "hyper 0.13.9", + "hyper 0.13.10", "native-tls", - "tokio 0.2.22", + "tokio 0.2.25", "tokio-tls 0.3.1", ] @@ -1136,9 +1209,9 @@ dependencies = [ [[package]] name = "idna" -version = "0.2.0" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02e2673c30ee86b5b96a9cb52ad15718aa1f966f5ab9ad54a8b95d5ca33120a9" +checksum = "418a0a6fab821475f634efe3ccc45c013f742efe03d853e8d3355d5cb850ecf8" dependencies = [ "matches", "unicode-bidi", @@ -1147,9 +1220,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "1.6.0" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55e2e4c765aa53a0424761bf9f41aa7a6ac1efa87238f59560640e27fca028f2" +checksum = "bc633605454125dec4b66843673f01c7df2b89479b32e0ed634e43a91cff62a5" dependencies = [ "autocfg 1.0.1", "hashbrown", @@ -1157,9 +1230,9 @@ dependencies = [ [[package]] name = "instant" -version = "0.1.8" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb1fc4429a33e1f80d41dc9fea4d108a88bec1de8053878898ae448a0b52f613" +checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" dependencies = [ "cfg-if 1.0.0", ] @@ -1175,21 +1248,21 @@ dependencies = [ [[package]] name = "ipnet" -version = "2.3.0" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47be2f14c678be2fdcab04ab1171db51b2762ce6f0a8ee87c8dd4a04ed216135" +checksum = "68f2d64f2edebec4ce84ad108148e67e1064789bee435edc5b60ad398714a3a9" [[package]] name = "itoa" -version = "0.4.6" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc6f3ad7b9d11a0c00842ff8de1b60ee58661048eb8049ed33c73594f359d7e6" +checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4" [[package]] name = "js-sys" -version = "0.3.45" +version = "0.3.55" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca059e81d9486668f12d455a4ea6daa600bd408134cd17e3d3fb5a32d1f016f8" +checksum = "7cc9ffccd38c451a86bf13657df244e9c3f37493cce8e5e21e940963777acc84" dependencies = [ "wasm-bindgen", ] @@ -1210,7 +1283,7 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0de8b303297635ad57c9f5059fd9cee7a47f8e8daa09df0fcd07dd39fb22977f" dependencies = [ - "log 0.4.11", + "log 0.4.14", ] [[package]] @@ -1227,15 +1300,15 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.100" +version = "0.2.107" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1fa8cddc8fbbee11227ef194b5317ed014b8acbf15139bd716a18ad3fe99ec5" +checksum = "fbe5e23404da5b4f555ef85ebed98fb4083e55a00c317800bc2a50ede9f3d219" [[package]] name = "linked-hash-map" -version = "0.5.3" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8dd5a6d5999d9907cda8ed67bbd137d3af8085216c2ac62de5be860bd41f304a" +checksum = "7fb9b38af92608140b86b693604b9ffcc5824240a484d1ecd4795bacb2fe88f3" [[package]] name = "lock_api" @@ -1248,9 +1321,9 @@ dependencies = [ [[package]] name = "lock_api" -version = "0.4.1" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28247cc5a5be2f05fbcd76dd0cf2c7d3b5400cb978a28042abcd4fa0b3f8261c" +checksum = "712a4d093c9976e24e7dbca41db895dabcbac38eb5f4045393d17a95bdfb1109" dependencies = [ "scopeguard", ] @@ -1261,17 +1334,18 @@ version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b" dependencies = [ - "log 0.4.11", + "log 0.4.14", ] [[package]] name = "log" -version = "0.4.11" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fabed175da42fed1fa0746b0ea71f412aa9d35e76e95e59b192c64b9dc2bf8b" +checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" dependencies = [ - "cfg-if 0.1.10", + "cfg-if 1.0.0", "serde", + "value-bag", ] [[package]] @@ -1292,9 +1366,9 @@ dependencies = [ "fnv", "humantime", "libc", - "log 0.4.11", + "log 0.4.14", "log-mdc", - "parking_lot 0.11.0", + "parking_lot 0.11.2", "serde", "serde-value", "serde_derive", @@ -1307,9 +1381,9 @@ dependencies = [ [[package]] name = "matches" -version = "0.1.8" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" +checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f" [[package]] name = "maybe-uninit" @@ -1325,9 +1399,9 @@ checksum = "490cc448043f947bae3cbee9c203358d62dbee0db12107a74be5c30ccfd09771" [[package]] name = "memchr" -version = "2.3.4" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525" +checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a" [[package]] name = "memoffset" @@ -1365,9 +1439,9 @@ dependencies = [ [[package]] name = "miniz_oxide" -version = "0.4.3" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f2d26ec3309788e423cfbf68ad1800f061638098d76a83681af979dc4eda19d" +checksum = "a92518e98c078586bc6c934028adcca4c92a53d6a958196de835170a01d84e4b" dependencies = [ "adler", "autocfg 1.0.1", @@ -1375,9 +1449,9 @@ dependencies = [ [[package]] name = "mio" -version = "0.6.22" +version = "0.6.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fce347092656428bc8eaf6201042cb551b8d67855af7374542a92a0fbfcac430" +checksum = "4afd66f5b91bf2a3bc13fad0e21caedac168ca4c707504e75585648ae80e4cc4" dependencies = [ "cfg-if 0.1.10", "fuchsia-zircon", @@ -1385,8 +1459,8 @@ dependencies = [ "iovec", "kernel32-sys", "libc", - "log 0.4.11", - "miow 0.2.1", + "log 0.4.14", + "miow 0.2.2", "net2", "slab", "winapi 0.2.8", @@ -1398,9 +1472,9 @@ version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0840c1c50fd55e521b247f949c241c9997709f23bd7f023b9762cd561e935656" dependencies = [ - "log 0.4.11", + "log 0.4.14", "mio", - "miow 0.3.5", + "miow 0.3.7", "winapi 0.3.9", ] @@ -1417,9 +1491,9 @@ dependencies = [ [[package]] name = "miow" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919" +checksum = "ebd808424166322d4a38da87083bfddd3ac4c131334ed55856112eb06d46944d" dependencies = [ "kernel32-sys", "net2", @@ -1429,11 +1503,10 @@ dependencies = [ [[package]] name = "miow" -version = "0.3.5" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07b88fb9795d4d36d62a012dfbf49a8f5cf12751f36d31a9dbe66d528e58979e" +checksum = "b9f1c5b025cda876f66ef43a113f91ebc9f4ccef34843000e0adf6ebbab84e21" dependencies = [ - "socket2", "winapi 0.3.9", ] @@ -1449,13 +1522,13 @@ dependencies = [ [[package]] name = "native-tls" -version = "0.2.5" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a1cda389c26d6b88f3d2dc38aa1b750fe87d298cc5d795ec9e975f402f00372" +checksum = "48ba9f7719b5a0f42f338907614285fb5fd70e53858141f69898a1fb7203b24d" dependencies = [ "lazy_static", "libc", - "log 0.4.11", + "log 0.4.14", "openssl", "openssl-probe", "openssl-sys", @@ -1465,33 +1538,17 @@ dependencies = [ "tempfile", ] -[[package]] -name = "nb-connect" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8123a81538e457d44b933a02faf885d3fe8408806b23fa700e8f01c6c3a98998" -dependencies = [ - "libc", - "winapi 0.3.9", -] - [[package]] name = "net2" -version = "0.2.35" +version = "0.2.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ebc3ec692ed7c9a255596c67808dee269f64655d8baf7b4f0638e51ba1d6853" +checksum = "391630d12b68002ae1e25e8f974306474966550ad82dac6886fb8910c19568ae" dependencies = [ "cfg-if 0.1.10", "libc", "winapi 0.3.9", ] -[[package]] -name = "nom" -version = "2.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf51a729ecf40266a2368ad335a5fdde43471f545a967109cd62146ecf8b66ff" - [[package]] name = "num-integer" version = "0.1.44" @@ -1545,9 +1602,9 @@ checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" [[package]] name = "openssl" -version = "0.10.35" +version = "0.10.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "549430950c79ae24e6d02e0b7404534ecf311d94cc9f861e9e4020187d13d885" +checksum = "0c7ae222234c30df141154f159066c5093ff73b63204dcda7121eb082fc56a95" dependencies = [ "bitflags", "cfg-if 1.0.0", @@ -1559,24 +1616,24 @@ dependencies = [ [[package]] name = "openssl-probe" -version = "0.1.2" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de" +checksum = "28988d872ab76095a6e6ac88d99b54fd267702734fd7ffe610ca27f533ddb95a" [[package]] name = "openssl-src" -version = "111.15.0+1.1.1k" +version = "300.0.2+3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1a5f6ae2ac04393b217ea9f700cd04fa9bf3d93fae2872069f3d15d908af70a" +checksum = "14a760a11390b1a5daf72074d4f6ff1a6e772534ae191f999f57e9ee8146d1fb" dependencies = [ "cc", ] [[package]] name = "openssl-sys" -version = "0.9.65" +version = "0.9.70" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a7907e3bfa08bb85105209cdfcb6c63d109f8f6c1ed6ca318fff5c1853fbc1d" +checksum = "c6517987b3f8226b5da3661dad65ff7f300cc59fb5ea8333ca191fc65fde3edf" dependencies = [ "autocfg 1.0.1", "cc", @@ -1588,9 +1645,9 @@ dependencies = [ [[package]] name = "ordered-float" -version = "1.1.0" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3741934be594d77de1c8461ebcbbe866f585ea616a9753aa78f2bdc69f0e4579" +checksum = "3305af35278dd29f46fcdd139e0b1fbfae2153f0e5928b39b035542dd31e37b7" dependencies = [ "num-traits", ] @@ -1609,18 +1666,18 @@ checksum = "f842b1982eb6c2fe34036a4fbfb06dd185a3f5c8edfaacdf7d1ea10b07de6252" dependencies = [ "lock_api 0.3.4", "parking_lot_core 0.6.2", - "rustc_version", + "rustc_version 0.2.3", ] [[package]] name = "parking_lot" -version = "0.11.0" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4893845fa2ca272e647da5d0e46660a314ead9c2fdd9a883aabc32e481a8733" +checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" dependencies = [ "instant", - "lock_api 0.4.1", - "parking_lot_core 0.8.0", + "lock_api 0.4.5", + "parking_lot_core 0.8.5", ] [[package]] @@ -1630,34 +1687,33 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b876b1b9e7ac6e1a74a6da34d25c42e17e8862aa409cbbbdcfc8d86c6f3bc62b" dependencies = [ "cfg-if 0.1.10", - "cloudabi 0.0.3", + "cloudabi", "libc", - "redox_syscall", - "rustc_version", - "smallvec 0.6.13", + "redox_syscall 0.1.57", + "rustc_version 0.2.3", + "smallvec 0.6.14", "winapi 0.3.9", ] [[package]] name = "parking_lot_core" -version = "0.8.0" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c361aa727dd08437f2f1447be8b59a33b0edd15e0fcee698f935613d9efbca9b" +checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216" dependencies = [ - "cfg-if 0.1.10", - "cloudabi 0.1.0", + "cfg-if 1.0.0", "instant", "libc", - "redox_syscall", - "smallvec 1.4.2", + "redox_syscall 0.2.10", + "smallvec 1.7.0", "winapi 0.3.9", ] [[package]] name = "paste" -version = "1.0.5" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acbf547ad0c65e31259204bd90935776d1c693cec2f4ff7abb7a1bbbd40dfe58" +checksum = "0744126afe1a6dd7f394cb50a716dbe086cb06e255e53d8d0185d82828358fb5" [[package]] name = "percent-encoding" @@ -1672,28 +1728,28 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" [[package]] -name = "pin-project" -version = "0.4.27" +name = "pest" +version = "2.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ffbc8e94b38ea3d2d8ba92aea2983b503cd75d0888d75b86bb37970b5698e15" +checksum = "10f4872ae94d7b90ae48754df22fd42ad52ce740b8f370b03da4835417403e53" dependencies = [ - "pin-project-internal 0.4.27", + "ucd-trie", ] [[package]] name = "pin-project" -version = "1.0.1" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee41d838744f60d959d7074e3afb6b35c7456d0f61cad38a24e35e6553f73841" +checksum = "576bc800220cc65dac09e99e97b08b358cfab6e17078de8dc5fee223bd2d0c08" dependencies = [ - "pin-project-internal 1.0.1", + "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "0.4.27" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65ad2ae56b6abe3a1ee25f15ee605bacadb9a764edaba9c2bf4103800d4a1895" +checksum = "6e8fe8163d14ce7f0cdac2e040116f22eac817edabff0be91e8aff7e9accf389" dependencies = [ "proc-macro2", "quote", @@ -1701,21 +1757,16 @@ dependencies = [ ] [[package]] -name = "pin-project-internal" -version = "1.0.1" +name = "pin-project-lite" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81a4ffa594b66bff340084d4081df649a7dc049ac8d7fc458d8e628bfbbb2f86" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] +checksum = "257b64915a082f7811703966789728173279bdebb956b143dbcd23f6f970a777" [[package]] name = "pin-project-lite" -version = "0.1.11" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c917123afa01924fc84bb20c4c03f004d9c38e5127e3c039bbf7f4b9c76a2f6b" +checksum = "8d31d11c69a6b52a174b42bdc0c30e5e11670f90788b2c471c31c1d17d449443" [[package]] name = "pin-utils" @@ -1725,9 +1776,9 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pkg-config" -version = "0.3.19" +version = "0.3.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c" +checksum = "12295df4f294471248581bc09bef3c38a5e46f1e36d6a37353621a0c6c357e1f" [[package]] name = "podio" @@ -1737,22 +1788,22 @@ checksum = "b18befed8bc2b61abc79a457295e7e838417326da1586050b919414073977f19" [[package]] name = "polling" -version = "2.0.2" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2a7bc6b2a29e632e45451c941832803a18cce6781db04de8a04696cdca8bde4" +checksum = "92341d779fa34ea8437ef4d82d440d5e1ce3f3ff7f824aa64424cd481f9a1f25" dependencies = [ - "cfg-if 0.1.10", + "cfg-if 1.0.0", "libc", - "log 0.4.11", - "wepoll-sys", + "log 0.4.14", + "wepoll-ffi", "winapi 0.3.9", ] [[package]] name = "ppv-lite86" -version = "0.2.10" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857" +checksum = "ed0cfbc8191465bed66e1718596ee0b0b35d5ee1f41c5df2189d0fe8bde535ba" [[package]] name = "proc-macro-hack" @@ -1762,29 +1813,32 @@ checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" [[package]] name = "proc-macro-nested" -version = "0.1.6" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eba180dafb9038b050a4c280019bbedf9f2467b61e5d892dcad585bb57aadc5a" +checksum = "bc881b2c22681370c6a780e47af9840ef841837bc98118431d4e1868bd0c1086" [[package]] name = "proc-macro2" -version = "1.0.27" +version = "1.0.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0d8caf72986c1a598726adc988bb5984792ef84f5ee5aa50209145ee8077038" +checksum = "ba508cc11742c0dc5c1659771673afbab7a0efab23aa17e854cbab0837ed0b43" dependencies = [ "unicode-xid", ] [[package]] -name = "procinfo" -version = "0.4.2" +name = "procfs" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ab1427f3d2635891f842892dda177883dca0639e05fe66796a62c9d2f23b49c" +checksum = "3f2e7eea7c1d7beccbd5acc1e37ac844afccf176525674aad26ece3de1fc7733" dependencies = [ + "bitflags", "byteorder", + "chrono", + "flate2", + "hex", + "lazy_static", "libc", - "nom", - "rustc_version", ] [[package]] @@ -1802,6 +1856,29 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "rand" +version = "0.3.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64ac302d8f83c0c1974bf758f6b041c6c8ada916fbb44a609158ca8b064cc76c" +dependencies = [ + "libc", + "rand 0.4.6", +] + +[[package]] +name = "rand" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293" +dependencies = [ + "fuchsia-cprng", + "libc", + "rand_core 0.3.1", + "rdrand", + "winapi 0.3.9", +] + [[package]] name = "rand" version = "0.6.5" @@ -1827,13 +1904,25 @@ version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" dependencies = [ - "getrandom 0.1.15", + "getrandom 0.1.16", "libc", "rand_chacha 0.2.2", "rand_core 0.5.1", "rand_hc 0.2.0", ] +[[package]] +name = "rand" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e7573632e6454cf6b99d7aac4ccca54be06da05aca2ef7423d22d27d4d4bcd8" +dependencies = [ + "libc", + "rand_chacha 0.3.1", + "rand_core 0.6.3", + "rand_hc 0.3.1", +] + [[package]] name = "rand_chacha" version = "0.1.1" @@ -1854,6 +1943,16 @@ dependencies = [ "rand_core 0.5.1", ] +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core 0.6.3", +] + [[package]] name = "rand_core" version = "0.3.1" @@ -1875,7 +1974,16 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" dependencies = [ - "getrandom 0.1.15", + "getrandom 0.1.16", +] + +[[package]] +name = "rand_core" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7" +dependencies = [ + "getrandom 0.2.3", ] [[package]] @@ -1896,6 +2004,15 @@ dependencies = [ "rand_core 0.5.1", ] +[[package]] +name = "rand_hc" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d51e9f596de227fda2ea6c84607f5558e196eeaf43c986b724ba4fb8fdf497e7" +dependencies = [ + "rand_core 0.6.3", +] + [[package]] name = "rand_isaac" version = "0.1.1" @@ -1922,7 +2039,7 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7b75f676a1e053fc562eafbb47838d67c84801e38fc1ba459e8f180deabd5071" dependencies = [ - "cloudabi 0.0.3", + "cloudabi", "fuchsia-cprng", "libc", "rand_core 0.4.2", @@ -1964,6 +2081,15 @@ version = "0.1.57" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" +[[package]] +name = "redox_syscall" +version = "0.2.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8383f39639269cde97d255a32bdb68c047337295414940c68bdd30c2e13203ff" +dependencies = [ + "bitflags", +] + [[package]] name = "remove_dir_all" version = "0.5.3" @@ -1975,47 +2101,75 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.10.8" +version = "0.10.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9eaa17ac5d7b838b7503d118fa16ad88f440498bf9ffe5424e621f93190d61e" +checksum = "0718f81a8e14c4dbb3b34cf23dc6aaf9ab8a0dfec160c534b3dbca1aaa21f47c" dependencies = [ - "base64 0.12.3", + "base64 0.13.0", "bytes 0.5.6", "encoding_rs", "futures-core", "futures-util", - "http 0.2.1", + "http 0.2.5", "http-body 0.3.1", - "hyper 0.13.9", + "hyper 0.13.10", "hyper-tls", "ipnet", "js-sys", "lazy_static", - "log 0.4.11", + "log 0.4.14", "mime 0.3.16", "mime_guess", "native-tls", "percent-encoding 2.1.0", - "pin-project-lite", + "pin-project-lite 0.2.7", "serde", "serde_json", "serde_urlencoded", - "tokio 0.2.22", + "tokio 0.2.25", "tokio-tls 0.3.1", - "url 2.1.1", + "url 2.2.2", "wasm-bindgen", "wasm-bindgen-futures", "web-sys", "winreg", ] +[[package]] +name = "rust-crypto" +version = "0.2.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f76d05d3993fd5f4af9434e8e436db163a12a9d40e1a58a726f27a01dfd12a2a" +dependencies = [ + "gcc", + "libc", + "rand 0.3.23", + "rustc-serialize", + "time 0.1.44", +] + +[[package]] +name = "rustc-serialize" +version = "0.3.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcf128d1287d2ea9d80910b5f1120d0b8eede3fbf1abe91c40d39ea7d51e6fda" + [[package]] name = "rustc_version" version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" dependencies = [ - "semver", + "semver 0.9.0", +] + +[[package]] +name = "rustc_version" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0dfe2087c51c460008730de8b57e6a320782fbfb312e1f4d520e6c6fae155ee" +dependencies = [ + "semver 0.11.0", ] [[package]] @@ -2048,9 +2202,9 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" [[package]] name = "security-framework" -version = "2.0.0" +version = "2.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1759c2e3c8580017a484a7ac56d3abc5a6c1feadf88db2f3633f12ae4268c69" +checksum = "525bc1abfda2e1998d152c45cf13e696f76d0a4972310b22fac1658b05df7c87" dependencies = [ "bitflags", "core-foundation", @@ -2061,9 +2215,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.0.0" +version = "2.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f99b9d5e26d2a71633cc4f2ebae7cc9f874044e0c351a27e17892d76dce5678b" +checksum = "a9dd14d83160b528b7bfd66439110573efcfbe281b17fc2ca9f39f550d619c7e" dependencies = [ "core-foundation-sys", "libc", @@ -2075,7 +2229,16 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" dependencies = [ - "semver-parser", + "semver-parser 0.7.0", +] + +[[package]] +name = "semver" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f301af10236f6df4160f7c3f04eec6dbc70ace82d23326abad5edee88801c6b6" +dependencies = [ + "semver-parser 0.10.2", ] [[package]] @@ -2084,11 +2247,20 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" +[[package]] +name = "semver-parser" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0bef5b7f9e0df16536d3961cfb6e84331c065b4066afb39768d0e319411f7" +dependencies = [ + "pest", +] + [[package]] name = "serde" -version = "1.0.117" +version = "1.0.130" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b88fa983de7720629c9387e9f517353ed404164b1e482c970a90c1a4aaf7dc1a" +checksum = "f12d06de37cf59146fbdecab66aa99f9fe4f78722e3607577a5375d66bd0c913" dependencies = [ "serde_derive", ] @@ -2105,9 +2277,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.117" +version = "1.0.130" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cbd1ae72adb44aab48f325a02444a5fc079349a8d804c1fc922aed3f7454c74e" +checksum = "d7bc1a1ab1961464eae040d96713baa5a724a8152c1222492465b54322ec508b" dependencies = [ "proc-macro2", "quote", @@ -2116,9 +2288,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.59" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcac07dbffa1c65e7f816ab9eba78eb142c6d44410f4eeba1e26e4f5dfa56b95" +checksum = "e466864e431129c7e0d3476b92f20458e5879919a0596c6472738d9fa2d342f8" dependencies = [ "itoa", "ryu", @@ -2127,24 +2299,24 @@ dependencies = [ [[package]] name = "serde_urlencoded" -version = "0.6.1" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ec5d77e2d4c73717816afac02670d5c4f534ea95ed430442cad02e7a6e32c97" +checksum = "edfa57a7f8d9c1d260a549e7224100f6c43d43f9103e06dd8b4095a9b2b43ce9" dependencies = [ - "dtoa", + "form_urlencoded", "itoa", + "ryu", "serde", - "url 2.1.1", ] [[package]] name = "serde_yaml" -version = "0.8.14" +version = "0.8.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7baae0a99f1a324984bcdc5f0718384c1f69775f1c7eec8b859b71b443e3fd7" +checksum = "d8c608a35705a5d3cdc9fbe403147647ff34b921f8e833e49306df898f9b20af" dependencies = [ "dtoa", - "linked-hash-map", + "indexmap", "serde", "yaml-rust", ] @@ -2163,43 +2335,52 @@ dependencies = [ [[package]] name = "signal-hook-registry" -version = "1.2.2" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce32ea0c6c56d5eacaeb814fbed9960547021d3edd010ded1425f180536b20ab" +checksum = "e51e73328dc4ac0c7ccbda3a494dfa03df1de2f46018127f60c693f2648455b0" dependencies = [ "libc", ] [[package]] name = "slab" -version = "0.4.2" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" +checksum = "9def91fd1e018fe007022791f865d0ccc9b3a0d5001e01aabb8b40e46000afb5" [[package]] name = "smallvec" -version = "0.6.13" +version = "0.6.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7b0758c52e15a8b5e3691eae6cc559f08eee9406e548a4477ba4e67770a82b6" +checksum = "b97fcaeba89edba30f044a10c6a3cc39df9c3f17d7cd829dd1446cab35f890e0" dependencies = [ "maybe-uninit", ] [[package]] name = "smallvec" -version = "1.4.2" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbee7696b84bbf3d89a1c2eccff0850e3047ed46bfcd2e92c29a2d074d57e252" +checksum = "1ecab6c735a6bb4139c0caafd0cc3635748bbb3acf4550e8138122099251f309" [[package]] name = "socket2" -version = "0.3.15" +version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1fa70dc5c8104ec096f4fe7ede7a221d35ae13dcd19ba1ad9a81d2cab9a1c44" +checksum = "122e570113d28d773067fab24266b66753f6ea915758651696b6e35e49f88d6e" +dependencies = [ + "cfg-if 1.0.0", + "libc", + "winapi 0.3.9", +] + +[[package]] +name = "socket2" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5dc90fe6c7be1a323296982db1836d1ea9e47b6839496dde9a541bc496df3516" dependencies = [ - "cfg-if 0.1.10", "libc", - "redox_syscall", "winapi 0.3.9", ] @@ -2209,7 +2390,7 @@ version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e113fb6f3de07a243d434a56ec6f186dfd51cb08448239fe7bcae73f87ff28ff" dependencies = [ - "version_check 0.9.2", + "version_check 0.9.3", ] [[package]] @@ -2235,9 +2416,9 @@ checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" [[package]] name = "syn" -version = "1.0.73" +version = "1.0.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f71489ff30030d2ae598524f61326b902466f72a0fb1a8564c001cc63425bcc7" +checksum = "f2afee18b8beb5a596ecb4a2dce128c719b4ba399d34126b9e4396e3f9860966" dependencies = [ "proc-macro2", "quote", @@ -2246,7 +2427,7 @@ dependencies = [ [[package]] name = "tat_agent" -version = "0.1.12" +version = "0.1.13" dependencies = [ "async-attributes", "async-std", @@ -2258,27 +2439,31 @@ dependencies = [ "clap", "codepage-strings", "daemonize", + "derive_more", "encoding", "faux", - "futures 0.1.30", - "futures 0.3.7", - "hyper 0.12.35", + "futures 0.1.31", + "futures 0.3.17", + "hex", + "hyper 0.12.36", "libc", - "log 0.4.11", + "log 0.4.14", "log4rs", "md5", "openssl", - "procinfo", + "procfs", "rand 0.7.3", "reqwest", + "rust-crypto", "serde", "serde_json", "time 0.2.27", "tokio 0.1.22", - "tokio 0.2.22", + "tokio 0.2.25", "tokio-test", "unzip", - "url 2.1.1", + "url 2.2.2", + "urlencoding", "users", "websocket", "winapi 0.3.9", @@ -2286,14 +2471,14 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.1.0" +version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9" +checksum = "dac1c663cfc93810f88aed9b8941d48cabf856a1b111c29a40439018d870eb22" dependencies = [ - "cfg-if 0.1.10", + "cfg-if 1.0.0", "libc", - "rand 0.7.3", - "redox_syscall", + "rand 0.8.4", + "redox_syscall 0.2.10", "remove_dir_all", "winapi 0.3.9", ] @@ -2314,7 +2499,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c7fbf4c9d56b320106cd64fd024dadfa0be7cb4706725fc44a7d7ce952d820c1" dependencies = [ "libc", - "redox_syscall", + "redox_syscall 0.1.57", "winapi 0.3.9", ] @@ -2338,7 +2523,7 @@ dependencies = [ "const_fn", "standback", "time-macros", - "version_check 0.9.2", + "version_check 0.9.3", ] [[package]] @@ -2366,9 +2551,18 @@ dependencies = [ [[package]] name = "tinyvec" -version = "0.3.4" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "238ce071d267c5710f9d31451efec16c5ee22de34df17cc05e56cbc92e967117" +checksum = "f83b2a3d4d9091d0abd7eba4dc2710b1718583bd4d8992e2190720ea38f391f7" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" [[package]] name = "tokio" @@ -2377,7 +2571,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a09c0b5bb588872ab2f09afa13ee6e9dac11e10a0ec9e8e3ba39a5a5d530af6" dependencies = [ "bytes 0.4.12", - "futures 0.1.30", + "futures 0.1.31", "mio", "num_cpus", "tokio-codec", @@ -2396,9 +2590,9 @@ dependencies = [ [[package]] name = "tokio" -version = "0.2.22" +version = "0.2.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d34ca54d84bf2b5b4d7d31e901a8464f7b60ac145a284fba25ceb801f2ddccd" +checksum = "6703a273949a90131b290be1fe7b039d0fc884aa1935860dfcbe056f28cd8092" dependencies = [ "bytes 0.5.6", "fnv", @@ -2411,7 +2605,7 @@ dependencies = [ "mio-named-pipes", "mio-uds", "num_cpus", - "pin-project-lite", + "pin-project-lite 0.1.12", "signal-hook-registry", "slab", "tokio-macros", @@ -2420,14 +2614,12 @@ dependencies = [ [[package]] name = "tokio" -version = "0.3.3" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5ca08accbcb46f11fd8d2d1c6158c348b7888009a1f39260bcad66f6a454250" +checksum = "588b2d10a336da58d877567cd8fb8a14b463e2104910f8132cd054b4b96e29ee" dependencies = [ "autocfg 1.0.1", - "futures-core", - "pin-project-lite", - "slab", + "pin-project-lite 0.2.7", ] [[package]] @@ -2438,7 +2630,7 @@ checksum = "8fb220f46c53859a4b7ec083e41dec9778ff0b1851c0942b211edb89e0ccdc46" dependencies = [ "bytes 0.4.12", "either", - "futures 0.1.30", + "futures 0.1.31", ] [[package]] @@ -2448,7 +2640,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "25b2998660ba0e70d18684de5d06b70b70a3a747469af9dea7618cc59e75976b" dependencies = [ "bytes 0.4.12", - "futures 0.1.30", + "futures 0.1.31", "tokio-io", ] @@ -2458,7 +2650,7 @@ version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b1de0e32a83f131e002238d7ccde18211c0a5397f60cbfffcb112868c2e0e20e" dependencies = [ - "futures 0.1.30", + "futures 0.1.31", "tokio-executor", ] @@ -2469,7 +2661,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fb2d1b8f4548dbf5e1f7818512e9c406860678f29c300cdf0ebac72d1a3a1671" dependencies = [ "crossbeam-utils 0.7.2", - "futures 0.1.30", + "futures 0.1.31", ] [[package]] @@ -2478,7 +2670,7 @@ version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "297a1206e0ca6302a0eed35b700d292b275256f596e2f3fea7729d5e629b6ff4" dependencies = [ - "futures 0.1.30", + "futures 0.1.31", "tokio-io", "tokio-threadpool", ] @@ -2490,15 +2682,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57fc868aae093479e3131e3d165c93b1c7474109d13c90ec0dda2a1bbfff0674" dependencies = [ "bytes 0.4.12", - "futures 0.1.30", - "log 0.4.11", + "futures 0.1.31", + "log 0.4.14", ] [[package]] name = "tokio-macros" -version = "0.2.5" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0c3acc6aa564495a0f2e1d59fab677cd7f81a19994cfc7f3ad0e64301560389" +checksum = "e44da00bfc73a25f814cd8d7e57a68a5c31b74b3152a0a1d1f590c97ed06265a" dependencies = [ "proc-macro2", "quote", @@ -2512,9 +2704,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09bc590ec4ba8ba87652da2068d150dcada2cfa2e07faae270a5e0409aa51351" dependencies = [ "crossbeam-utils 0.7.2", - "futures 0.1.30", + "futures 0.1.31", "lazy_static", - "log 0.4.11", + "log 0.4.14", "mio", "num_cpus", "parking_lot 0.9.0", @@ -2524,6 +2716,17 @@ dependencies = [ "tokio-sync", ] +[[package]] +name = "tokio-stream" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50145484efff8818b5ccd256697f36863f587da82cf8b409c53adf1e840798e3" +dependencies = [ + "futures-core", + "pin-project-lite 0.2.7", + "tokio 1.13.0", +] + [[package]] name = "tokio-sync" version = "0.1.8" @@ -2531,7 +2734,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "edfe50152bc8164fcc456dab7891fa9bf8beaf01c5ee7e1dd43a397c3cf87dee" dependencies = [ "fnv", - "futures 0.1.30", + "futures 0.1.31", ] [[package]] @@ -2541,7 +2744,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "98df18ed66e3b72e742f185882a9e201892407957e45fbff8da17ae7a7c51f72" dependencies = [ "bytes 0.4.12", - "futures 0.1.30", + "futures 0.1.31", "iovec", "mio", "tokio-io", @@ -2550,13 +2753,15 @@ dependencies = [ [[package]] name = "tokio-test" -version = "0.3.0" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7edc5a2b13a713b9134debc9aa1265b0a1ccf6a81fa05af2ba26e4aee56cdf1a" +checksum = "53474327ae5e166530d17f2d956afcb4f8a004de581b3cae10f12006bc8163e3" dependencies = [ - "bytes 0.5.6", + "async-stream", + "bytes 1.1.0", "futures-core", - "tokio 0.3.3", + "tokio 1.13.0", + "tokio-stream", ] [[package]] @@ -2568,9 +2773,9 @@ dependencies = [ "crossbeam-deque", "crossbeam-queue", "crossbeam-utils 0.7.2", - "futures 0.1.30", + "futures 0.1.31", "lazy_static", - "log 0.4.11", + "log 0.4.14", "num_cpus", "slab", "tokio-executor", @@ -2583,7 +2788,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "93044f2d313c95ff1cb7809ce9a7a05735b012288a888b62d4434fd58c94f296" dependencies = [ "crossbeam-utils 0.7.2", - "futures 0.1.30", + "futures 0.1.31", "slab", "tokio-executor", ] @@ -2594,7 +2799,7 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "354b8cd83825b3c20217a9dc174d6a0c67441a2fae5c41bcb1ea6679f6ae0f7c" dependencies = [ - "futures 0.1.30", + "futures 0.1.31", "native-tls", "tokio-io", ] @@ -2606,7 +2811,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a70f4fcd7b3b24fb194f837560168208f669ca8cb70d0c4b862944452396343" dependencies = [ "native-tls", - "tokio 0.2.22", + "tokio 0.2.25", ] [[package]] @@ -2616,8 +2821,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2a0b10e610b39c38b031a2fcab08e4b82f16ece36504988dcbd81dbba650d82" dependencies = [ "bytes 0.4.12", - "futures 0.1.30", - "log 0.4.11", + "futures 0.1.31", + "log 0.4.14", "mio", "tokio-codec", "tokio-io", @@ -2631,10 +2836,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ab57a4ac4111c8c9dbcf70779f6fc8bc35ae4b2454809febac840ad19bd7e4e0" dependencies = [ "bytes 0.4.12", - "futures 0.1.30", + "futures 0.1.31", "iovec", "libc", - "log 0.4.11", + "log 0.4.14", "mio", "mio-uds", "tokio-codec", @@ -2651,45 +2856,45 @@ dependencies = [ "bytes 0.5.6", "futures-core", "futures-sink", - "log 0.4.11", - "pin-project-lite", - "tokio 0.2.22", + "log 0.4.14", + "pin-project-lite 0.1.12", + "tokio 0.2.25", ] [[package]] name = "tower-service" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e987b6bf443f4b5b3b6f38704195592cca41c5bb7aedd3c3693c7081f8289860" +checksum = "360dfd1d6d30e05fda32ace2c8c70e9c0a9da713275777f5a4dbb8a1893930c6" [[package]] name = "tracing" -version = "0.1.21" +version = "0.1.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0987850db3733619253fe60e17cb59b82d37c7e6c0236bb81e4d6b87c879f27" +checksum = "375a639232caf30edfc78e8d89b2d4c375515393e7af7e16f01cd96917fb2105" dependencies = [ - "cfg-if 0.1.10", - "log 0.4.11", - "pin-project-lite", + "cfg-if 1.0.0", + "log 0.4.14", + "pin-project-lite 0.2.7", "tracing-core", ] [[package]] name = "tracing-core" -version = "0.1.17" +version = "0.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f50de3927f93d202783f4513cda820ab47ef17f624b03c096e86ef00c67e6b5f" +checksum = "1f4ed65637b8390770814083d20756f87bfa2c21bf2f110babdc5438351746e4" dependencies = [ "lazy_static", ] [[package]] name = "tracing-futures" -version = "0.2.4" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab7bb6f14721aa00656086e9335d363c5c8747bae02ebe32ea2c7dece5689b4c" +checksum = "97d095ae15e245a057c8e8451bab9b3ee1e1f68e9ba2b4fbc18d0ac5237835f2" dependencies = [ - "pin-project 0.4.27", + "pin-project", "tracing", ] @@ -2728,9 +2933,15 @@ dependencies = [ [[package]] name = "typenum" -version = "1.12.0" +version = "1.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "373c8a200f9e67a0c95e62a4f52fbf80c23b4381c05a17845531982fa99e6b33" +checksum = "b63708a265f51345575b27fe43f9500ad611579e764c79edbc2037b1121959ec" + +[[package]] +name = "ucd-trie" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56dee185309b50d1f11bfedef0fe6d036842e3fb77413abef29f8f8d1c5d4c1c" [[package]] name = "unicase" @@ -2747,38 +2958,35 @@ version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6" dependencies = [ - "version_check 0.9.2", + "version_check 0.9.3", ] [[package]] name = "unicode-bidi" -version = "0.3.4" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5" -dependencies = [ - "matches", -] +checksum = "1a01404663e3db436ed2746d9fefef640d868edae3cceb81c3b8d5732fda678f" [[package]] name = "unicode-normalization" -version = "0.1.13" +version = "0.1.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fb19cf769fa8c6a80a162df694621ebeb4dafb606470b2b2fce0be40a98a977" +checksum = "d54590932941a9e9266f0832deed84ebe1bf2e4c9e4a3554d393d18f5e854bf9" dependencies = [ "tinyvec", ] [[package]] name = "unicode-width" -version = "0.1.8" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3" +checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973" [[package]] name = "unicode-xid" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" +checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" [[package]] name = "unsafe-any" @@ -2813,15 +3021,22 @@ dependencies = [ [[package]] name = "url" -version = "2.1.1" +version = "2.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "829d4a8476c35c9bf0bbce5a3b23f4106f79728039b726d292bb93bc106787cb" +checksum = "a507c383b2d33b5fc35d1861e77e6b383d158b2da5e14fe51b83dfedf6fd578c" dependencies = [ - "idna 0.2.0", + "form_urlencoded", + "idna 0.2.3", "matches", "percent-encoding 2.1.0", ] +[[package]] +name = "urlencoding" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a1f0175e03a0973cf4afd476bef05c26e228520400eb1fd473ad417b1c00ffb" + [[package]] name = "users" version = "0.11.0" @@ -2829,20 +3044,24 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24cc0f6d6f267b73e5a2cadf007ba8f9bc39c6a6f9666f8cf25ea809a153b032" dependencies = [ "libc", - "log 0.4.11", + "log 0.4.14", ] [[package]] -name = "vcpkg" -version = "0.2.10" +name = "value-bag" +version = "1.0.0-alpha.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6454029bf181f092ad1b853286f23e2c507d8e8194d01d92da4a55c274a5508c" +checksum = "79923f7731dc61ebfba3633098bf3ac533bbd35ccd8c57e7088d9a5eebe0263f" +dependencies = [ + "ctor", + "version_check 0.9.3", +] [[package]] -name = "vec-arena" -version = "1.0.0" +name = "vcpkg" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eafc1b9b2dfc6f5529177b62cf806484db55b32dc7c9658a118e11bbeb33061d" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" [[package]] name = "vec_map" @@ -2858,9 +3077,9 @@ checksum = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd" [[package]] name = "version_check" -version = "0.9.2" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5a972e5669d67ba988ce3dc826706fb0a8b01471c088cb0b6110b805cc36aed" +checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe" [[package]] name = "waker-fn" @@ -2874,8 +3093,8 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b6395efa4784b027708f7451087e647ec73cc74f5d9bc2e418404248d679a230" dependencies = [ - "futures 0.1.30", - "log 0.4.11", + "futures 0.1.31", + "log 0.4.14", "try-lock", ] @@ -2885,7 +3104,7 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" dependencies = [ - "log 0.4.11", + "log 0.4.14", "try-lock", ] @@ -2903,11 +3122,11 @@ checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" [[package]] name = "wasm-bindgen" -version = "0.2.68" +version = "0.2.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ac64ead5ea5f05873d7c12b545865ca2b8d28adfc50a49b84770a3a97265d42" +checksum = "632f73e236b219150ea279196e54e610f5dbafa5d61786303d4da54f84e47fce" dependencies = [ - "cfg-if 0.1.10", + "cfg-if 1.0.0", "serde", "serde_json", "wasm-bindgen-macro", @@ -2915,13 +3134,13 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.68" +version = "0.2.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f22b422e2a757c35a73774860af8e112bff612ce6cb604224e8e47641a9e4f68" +checksum = "a317bf8f9fba2476b4b2c85ef4c4af8ff39c3c7f0cdfeed4f82c34a880aa837b" dependencies = [ "bumpalo", "lazy_static", - "log 0.4.11", + "log 0.4.14", "proc-macro2", "quote", "syn", @@ -2930,11 +3149,11 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.18" +version = "0.4.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7866cab0aa01de1edf8b5d7936938a7e397ee50ce24119aef3e1eaa3b6171da" +checksum = "8e8d7523cb1f2a4c96c1317ca690031b714a51cc14e05f712446691f413f5d39" dependencies = [ - "cfg-if 0.1.10", + "cfg-if 1.0.0", "js-sys", "wasm-bindgen", "web-sys", @@ -2942,9 +3161,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.68" +version = "0.2.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b13312a745c08c469f0b292dd2fcd6411dba5f7160f593da6ef69b64e407038" +checksum = "d56146e7c495528bf6587663bea13a8eb588d39b36b679d83972e1a2dbbdacf9" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -2952,9 +3171,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.68" +version = "0.2.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f249f06ef7ee334cc3b8ff031bfc11ec99d00f34d86da7498396dc1e3b1498fe" +checksum = "7803e0eea25835f8abdc585cd3021b3deb11543c6fe226dcd30b228857c5c5ab" dependencies = [ "proc-macro2", "quote", @@ -2965,15 +3184,15 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.68" +version = "0.2.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d649a3145108d7d3fbcde896a468d1bd636791823c9921135218ad89be08307" +checksum = "0237232789cf037d5480773fe568aac745bfe2afbc11a863e97901780a6b47cc" [[package]] name = "web-sys" -version = "0.3.45" +version = "0.3.55" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bf6ef87ad7ae8008e15a355ce696bed26012b7caa21605188cfd8214ab51e2d" +checksum = "38eb105f1c59d9eaa6b5cdc92b859d85b926e82cb2e0945cd0c9259faa6fe9fb" dependencies = [ "js-sys", "wasm-bindgen", @@ -2986,7 +3205,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "723abe6b75286edc51d8ecabb38a2353f62a9e9b0588998b59111474f1dcd637" dependencies = [ "bytes 0.4.12", - "futures 0.1.30", + "futures 0.1.31", "hyper 0.10.16", "native-tls", "rand 0.6.5", @@ -3010,7 +3229,7 @@ dependencies = [ "bitflags", "byteorder", "bytes 0.4.12", - "futures 0.1.30", + "futures 0.1.31", "native-tls", "rand 0.6.5", "sha-1", @@ -3021,10 +3240,10 @@ dependencies = [ ] [[package]] -name = "wepoll-sys" -version = "3.0.1" +name = "wepoll-ffi" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fcb14dea929042224824779fbc82d9fab8d2e6d3cbc0ac404de8edf489e77ff" +checksum = "d743fdedc5c64377b5fc2bc036b01c7fd642205a0d96356034ae3404d49eb7fb" dependencies = [ "cc", ] @@ -3084,9 +3303,9 @@ dependencies = [ [[package]] name = "yaml-rust" -version = "0.4.4" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39f0c922f1a334134dc2f7a8b67dc5d25f0735263feec974345ff706bcf20b0d" +checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85" dependencies = [ "linked-hash-map", ] diff --git a/Cargo.toml b/Cargo.toml index a90501c..d964f2f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tat_agent" -version = "0.1.12" +version = "0.1.13" edition = "2018" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html @@ -10,7 +10,7 @@ tokio = { version = "0.2.22", features = ["full"]} futures = "0.3" futures01 = { version = "0.1", package = "futures"} tokio01 = { version = "0.1.22", package = "tokio"} -reqwest = { version = "0.10", features = ["blocking", "json"] } +reqwest = { version = "0.10", features = ["blocking", "json", "stream"] } serde_json = "1.0.57" serde = {version = "1.0.115", features = ["derive"]} url = "2.1.1" @@ -34,12 +34,17 @@ encoding = "0.2.33" cfg-if = "1.0" time = { version = "0.2", default-features = false } faux = "0.1.5" +rust-crypto = "^0.2" +urlencoding = "1.3.3" +hex = "0.4" +derive_more = "0.99.5" [target.'cfg(target_family="unix")'.dependencies] daemonize = "0.4.1" users = { version = "0.11.0"} openssl = { version = '0.10.35', features = ["vendored"] } -procinfo = { version = "0.4.2" } +procfs = "0.11.0" + [target.'cfg(windows)'.dependencies] codepage-strings = "1.0.1" diff --git a/LICENSE b/LICENSE index a626264..7eeb0b5 100644 --- a/LICENSE +++ b/LICENSE @@ -183,8 +183,8 @@ Copyright (c) 2013, Kang Seonghoon 28. cfg-if Copyright (c) 2014 Alex Crichton -29. procinfo -Copyright (c) 2015 The Rust Project Developers +29. procfs +Copyright (c) 2015 The procfs Developers 30. codepage-strings Copyright (c) 2021 Bart Massey @@ -195,6 +195,20 @@ Copyright (c) 2015-2018 The winapi-rs Developers 32. faux Copyright (c) 2020 Andres Medina +33. rust-crypto +Copyright (c) 2006-2009 Graydon Hoare +Copyright (c) 2009-2013 Mozilla Foundation + +34. urlencoding +Copyright (c) 2016 Bertram Truong + +35. hex +Copyright (c) 2013-2014 The Rust Project Developers +Copyright (c) 2015-2020 The rust-hex Developers + +36. derive_more +Copyright (c) 2016 Jelte Fennema + Terms of the MIT License: -------------------------------------------------------------------- diff --git a/src/common/consts.rs b/src/common/consts.rs index a9e55ee..b47fb32 100644 --- a/src/common/consts.rs +++ b/src/common/consts.rs @@ -21,6 +21,7 @@ cfg_if::cfg_if! { pub const PID_FILE: &str = "/var/run/tat_agent.pid"; pub const TASK_STORE_PATH: &str = "/tmp/tat_agent/commands/"; + pub const TASK_LOG_PATH: &str = "/tmp/tat_agent/logs/"; pub const SELF_UPDATE_PATH: &str = "/tmp/tat_agent/self_update/"; pub const SELF_UPDATE_SCRIPT: &str = "self_update.sh"; pub const AGENT_DEFAULT_WORK_DIRECTORY: &str = "/root"; @@ -33,6 +34,7 @@ cfg_if::cfg_if! { pub const PIPE_BUF_DEFAULT_SIZE: usize = 64 * 4096; } else if #[cfg(windows)] { pub const TASK_STORE_PATH: &str = "C:\\Program Files\\qcloud\\tat_agent\\tmp\\commands\\"; + pub const TASK_LOG_PATH: &str = "C:\\Program Files\\qcloud\\tat_agent\\tmp\\logs\\"; pub const SELF_UPDATE_PATH: &str = "C:\\Program Files\\qcloud\\tat_agent\\tmp\\self_update"; pub const SELF_UPDATE_SCRIPT: &str = "self_update.bat"; } @@ -92,6 +94,10 @@ macro_rules! start_failed_err_info { format!("ScriptStoreFailed: script file store failed at `{}`, please check disk space or permission", $store_path); }; + (ERR_LOG_FILE_STORE_FAILED, $store_path:expr) => { + format!("LogStoreFailed: log file store failed at `{}`, please check disk space or permission", + $store_path); + }; } // service related @@ -103,6 +109,12 @@ pub const INVOKE_API: &str = "http://proxy-invoke"; #[allow(dead_code)] pub const MOCK_INVOKE_API: &str = "http://127.0.0.1:8080"; +// metadata +#[cfg(not(debug_assertions))] +pub const METADATA_API: &str = "http://metadata.tencentyun.com"; +#[cfg(debug_assertions)] +pub const METADATA_API: &str = "http://mock-server:8000"; + // cmd related pub const CMD_TYPE_SHELL: &str = "SHELL"; pub const CMD_TYPE_POWERSHELL: &str = "POWERSHELL"; diff --git a/src/cos.rs b/src/cos.rs new file mode 100644 index 0000000..284b2d9 --- /dev/null +++ b/src/cos.rs @@ -0,0 +1,8 @@ +pub mod auth; +pub mod client; +pub mod errors; +pub mod object; +pub mod utils; + +pub use client::COS; +pub use object::ObjectAPI; diff --git a/src/cos/auth.rs b/src/cos/auth.rs new file mode 100644 index 0000000..bfbc476 --- /dev/null +++ b/src/cos/auth.rs @@ -0,0 +1,101 @@ +use chrono::Local; +use crypto::digest::Digest; +use crypto::hmac::Hmac; +use crypto::mac::Mac; +use crypto::sha1::Sha1; +use reqwest::header::{HeaderMap, HeaderName, HeaderValue}; +use urlencoding::encode; + +use crate::cos::client::COS; + +pub trait Auth { + fn cos_sign( + &self, + verb: &str, + secret_id: &str, + secret_key: &str, + prefix: &str, + expires: i64, + headers: &HeaderMap, + ) -> String; +} + +impl<'a> Auth for COS<'a> { + fn cos_sign( + &self, + verb: &str, + secret_id: &str, + secret_key: &str, + prefix: &str, + expires: i64, + headers: &HeaderMap, + ) -> String { + // 步骤1:生成 KeyTime + // 拼接签名有效时间,格式为StartTimestamp;EndTimestamp,即为 KeyTime。例如:1557902800;1557910000。 + let key_time = { + let timestamp = Local::now().timestamp(); + format!("{};{}", timestamp, timestamp + expires) + }; + + // 步骤2:生成 SignKey + // 使用 HMAC-SHA1 以 SecretKey 为密钥,以 KeyTime 为消息,计算消息摘要(哈希值,16进制小写形式),即为 SignKey,例如:eb2519b498b02ac213cb1f3d1a3d27a3b3c9bc5f。 + let sign_key = { + let mut hmac = Hmac::new(Sha1::new(), secret_key.as_ref()); + hmac.input(key_time.as_bytes()); + hex::encode(hmac.result().code()) + }; + + // 步骤3:生成 UrlParamList 和 HttpParameters + let url_param_list = format!(""); + let http_parameters = format!(""); + + // 步骤4:生成 HeaderList 和 HttpHeaders + let mut cos_headers: Vec<(&HeaderName, &HeaderValue)> = headers.iter().collect(); + cos_headers.sort_by(|a, b| a.0.to_string().cmp(&b.0.to_string())); + let header_list = cos_headers + .iter() + .map(|(key, _)| encode(key.as_ref()).to_lowercase()) + .collect::>() + .join(";"); + let http_headers = cos_headers + .iter() + .map(|(k, v)| { + format!( + "{}={}", + encode(&*k.to_owned().as_str()).to_lowercase(), + encode(&*v.to_owned().to_str().unwrap_or("")) + ) + }) + .collect::>() + .join("&"); + + // 步骤5:生成 HttpString + let http_string = format!( + "{}\n{}\n{}\n{}\n", + verb.to_lowercase(), + prefix, + http_parameters, + http_headers + ); + + // 步骤6:生成 StringToSign + let string_to_sign = { + let mut sha1 = Sha1::new(); + sha1.input_str(&http_string); + format!("sha1\n{}\n{}\n", key_time, sha1.result_str()) + }; + + // 步骤7:生成 Signature + // 使用 HMAC-SHA1 以 SignKey 为密钥(字符串形式,非原始二进制),以 StringToSign 为消息,计算消息摘要,即为 Signature,例如:01681b8c9d798a678e43b685a9f1bba0f6c0e012。 + let signature = { + let mut hmac = Hmac::new(Sha1::new(), sign_key.as_bytes()); + hmac.input(string_to_sign.as_bytes()); + hex::encode(hmac.result().code()) + }; + + // 步骤8:生成签名 + format!("q-sign-algorithm=sha1&q-ak={ak}&q-sign-time={time}&q-key-time={time}&q-header-list={header_list}&q-url-param-list={url_param_list}&q-signature={signature}", + ak = secret_id, time = key_time, header_list = header_list, url_param_list = url_param_list, signature = signature + ) + } +} diff --git a/src/cos/client.rs b/src/cos/client.rs new file mode 100644 index 0000000..069278d --- /dev/null +++ b/src/cos/client.rs @@ -0,0 +1,77 @@ +use chrono::prelude::*; +use reqwest::Client; +use std::borrow::Cow; +use std::str; +use url::Url; + +#[derive(Clone, Debug)] +pub struct COS<'a> { + secret_id: Cow<'a, str>, + secret_key: Cow<'a, str>, + token: Cow<'a, str>, + endpoint: Cow<'a, str>, + host: Cow<'a, str>, + pub client: Client, +} + +impl<'a> COS<'a> { + pub fn new(secret_id: S, secret_key: S, token: S, endpoint: S) -> Self + where + S: Into>, + { + let endpoint = endpoint.into().to_string(); + let host = Url::parse(&*endpoint.clone()).unwrap(); + let host = host.host().unwrap().to_string(); + COS { + secret_id: secret_id.into(), + secret_key: secret_key.into(), + token: token.into(), + endpoint: Cow::from(endpoint), + host: Cow::from(host), + client: Client::new(), + } + } + + pub fn endpoint(&self) -> &str { + &self.endpoint + } + + pub fn host(&self) -> &str { + &self.host + } + + pub fn secret_id(&self) -> &str { + &self.secret_id + } + + pub fn secret_key(&self) -> &str { + &self.secret_key + } + + pub fn token(&self) -> &str { + &self.token + } + + pub fn date(&self) -> String { + let now: DateTime = Utc::now(); + now.format("%a, %d %b %Y %T GMT").to_string() + } +} + +#[cfg(test)] +mod tests { + // use crate::cos::client; + // use crate::cos::object::ObjectAPI; + + // #[test] + // fn test_upload_object() { + // let cli = client::COS::new( + // "tmp_ak_id", + // "tmp_ak_key", + // "tmp_token", + // "https://tat-xxxx.cos.ap-guangzhou.myqcloud.com", + // ); + // let res = cli.put_object_from_file("README.md".to_string(), "/tat/README.md".to_string(), None); + // assert!(res.is_ok()); + // } +} diff --git a/src/cos/errors.rs b/src/cos/errors.rs new file mode 100644 index 0000000..9f02a77 --- /dev/null +++ b/src/cos/errors.rs @@ -0,0 +1,55 @@ +use reqwest::header::InvalidHeaderName as HttpInvalidHeaderNameError; +use reqwest::header::InvalidHeaderValue as HttpInvalidHeaderValueError; +use reqwest::Error as ReqwestError; +use std::io::Error as IoError; +use std::string::FromUtf8Error; + +#[derive(Debug)] +pub enum Error { + Object(ObjectError), + Io(IoError), + String(FromUtf8Error), + Reqwest(ReqwestError), + Http(HttpError), +} + +#[derive(Debug)] +pub enum HttpError { + HttpInvalidHeaderValue(HttpInvalidHeaderValueError), + HttpInvalidHeaderName(HttpInvalidHeaderNameError), +} + +impl From for Error { + fn from(e: IoError) -> Error { + Error::Io(e) + } +} + +impl From for Error { + fn from(e: ReqwestError) -> Error { + Error::Reqwest(e) + } +} + +impl From for Error { + fn from(e: HttpInvalidHeaderValueError) -> Error { + Error::Http(HttpError::HttpInvalidHeaderValue(e)) + } +} + +impl From for Error { + fn from(e: HttpInvalidHeaderNameError) -> Error { + Error::Http(HttpError::HttpInvalidHeaderName(e)) + } +} + +impl From for Error { + fn from(e: FromUtf8Error) -> Error { + Error::String(e) + } +} + +#[derive(Debug)] +pub enum ObjectError { + PutError { msg: String }, +} diff --git a/src/cos/object.rs b/src/cos/object.rs new file mode 100644 index 0000000..9673ecf --- /dev/null +++ b/src/cos/object.rs @@ -0,0 +1,74 @@ +use reqwest::header::{HeaderMap, AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, DATE, HOST}; +use std::collections::HashMap; + +use crate::cos::auth::*; +use crate::cos::client::COS; +use crate::cos::errors::{Error, ObjectError}; +use crate::cos::utils::*; +use async_trait::async_trait; +use log::info; +use tokio::fs::File; + +#[async_trait] +pub trait ObjectAPI { + async fn put_object_from_file( + &self, + file: String, + object_name: String, + headers: Option>, + ) -> Result<(), Error>; +} + +#[async_trait] +impl<'a> ObjectAPI for COS<'a> { + async fn put_object_from_file( + &self, + file: String, + object_name: String, + headers: Option>, + ) -> Result<(), Error> { + let object_name = object_name.as_ref(); + let host = self.host(); + let date = self.date(); + let f = File::open(file).await?; + let mut headers = if let Some(h) = headers.into() { + to_headers(h)? + } else { + HeaderMap::new() + }; + headers.insert(HOST, host.parse()?); + headers.insert(DATE, date.parse()?); + headers.insert(CONTENT_TYPE, "application/xml".parse()?); + headers.insert( + CONTENT_LENGTH, + f.metadata().await.unwrap().len().to_string().parse()?, + ); + let authorization = self.cos_sign( + "PUT", + self.secret_id(), + self.secret_key(), + object_name, + 600, + &headers, + ); + headers.insert(AUTHORIZATION, authorization.parse()?); + headers.insert("x-cos-security-token", self.token().parse()?); + info!("{:?}", authorization); + + let resp = self + .client + .put(&format!("{}{}", self.endpoint(), object_name)) + .headers(headers) + .body(file_to_body(f)) + .send() + .await?; + + if resp.status().is_success() { + Ok(()) + } else { + Err(Error::Object(ObjectError::PutError { + msg: format!("can not put object, status code {}", resp.status()), + })) + } + } +} diff --git a/src/cos/utils.rs b/src/cos/utils.rs new file mode 100644 index 0000000..22dc1ea --- /dev/null +++ b/src/cos/utils.rs @@ -0,0 +1,23 @@ +use crate::cos::errors::Error; +use reqwest::header::{HeaderMap, HeaderName}; +use reqwest::Body; +use std::collections::HashMap; +use tokio::fs::File; + +pub fn to_headers(hashmap: HashMap) -> Result +where + S: AsRef, +{ + let mut headers = HeaderMap::new(); + for (key, val) in hashmap.iter() { + let key = key.as_ref(); + let val = val.as_ref(); + headers.insert(HeaderName::from_bytes(key.as_bytes())?, val.parse()?); + } + Ok(headers) +} + +pub fn file_to_body(file: File) -> Body { + let stream = tokio::io::reader_stream(file); + Body::wrap_stream(stream) +} diff --git a/src/executor/powershell_command.rs b/src/executor/powershell_command.rs index 3dc26e4..4a42399 100644 --- a/src/executor/powershell_command.rs +++ b/src/executor/powershell_command.rs @@ -10,8 +10,8 @@ use rand::{thread_rng, Rng}; use std::ffi::OsStr; use std::fmt; use std::fmt::{Debug, Formatter}; -use std::fs::File; -use std::fs::OpenOptions; +use std::fs::{File, OpenOptions}; +use std::io::Write; use std::os::windows::ffi::OsStrExt; use std::path::Path; use std::process::Stdio; @@ -43,6 +43,10 @@ impl PowerShellCommand { work_dir: &str, timeout: u64, bytes_max_report: u64, + log_file_path: &str, + cos_bucket: &str, + cos_prefix: &str, + task_id: &str, ) -> PowerShellCommand { let cmd_path = String::from(cmd_path).replace(" ", "` "); PowerShellCommand { @@ -52,6 +56,10 @@ impl PowerShellCommand { work_dir, timeout, bytes_max_report, + log_file_path, + cos_bucket, + cos_prefix, + task_id, )), } } @@ -107,15 +115,21 @@ impl MyCommand for PowerShellCommand { 3. support set process group. */ async fn run(&mut self) -> Result<(), String> { - //work dir check + // store path check + self.store_path_check()?; + + // work dir check self.work_dir_check()?; - //set policy + + let log_file = self.open_log_file()?; + + // set policy self.set_ps1_policy().await; - //create pipe + // create pipe let (our_pipe, their_pipe) = anon_pipe(true)?; - //start child + // start child let mut cmd = self.prepare_cmd(their_pipe)?; let mut child = cmd.spawn().map_err(|e| { *self.base.err_info.lock().unwrap() = e.to_string(); @@ -130,7 +144,7 @@ impl MyCommand for PowerShellCommand { // async read output. tokio::spawn(async move { base.add_timeout_timer(); - base.read_ps1_output(our_pipe).await; + base.read_ps1_output(our_pipe, log_file).await; base.del_timeout_timer(); base.process_finish(&mut child).await; }); @@ -146,7 +160,7 @@ impl MyCommand for PowerShellCommand { } impl BaseCommand { - async fn read_ps1_output(&self, file: File) { + async fn read_ps1_output(&self, file: File, mut log_file: File) { let pid = self.pid.lock().unwrap().unwrap(); const BUF_SIZE: usize = 1024; let mut buffer: [u8; BUF_SIZE] = [0; BUF_SIZE]; @@ -166,6 +180,9 @@ impl BaseCommand { .decode(&buffer[..len]) .unwrap(); debug!("output:[{}], pid:{}, len:{}", decoded_string, pid, len); + if let Err(e) = log_file.write(decoded_string.as_bytes()) { + error!("write output file fail: {:?}", e) + } unsafe { self.append_output(String::from(decoded_string).as_mut_vec()); } @@ -174,6 +191,12 @@ impl BaseCommand { break; } } + + if let Err(e) = log_file.sync_all() { + error!("sync in-memory data to file fail: {:?}", e) + } + + self.finish_logging().await; } pub fn kill_process_group(pid: u32) { diff --git a/src/executor/proc.rs b/src/executor/proc.rs index e0b32e4..7b6abd1 100644 --- a/src/executor/proc.rs +++ b/src/executor/proc.rs @@ -10,12 +10,18 @@ cfg_if::cfg_if! { use crate::common::asserts::GracefulUnwrap; use crate::common::consts::{ FINISH_RESULT_FAILED, FINISH_RESULT_START_FAILED, FINISH_RESULT_SUCCESS, - FINISH_RESULT_TERMINATED, FINISH_RESULT_TIMEOUT, OUTPUT_BYTE_LIMIT_EACH_REPORT, + FINISH_RESULT_TERMINATED, FINISH_RESULT_TIMEOUT, METADATA_API, OUTPUT_BYTE_LIMIT_EACH_REPORT, + TASK_LOG_PATH, TASK_STORE_PATH, }; +use crate::cos::ObjectAPI; +use crate::cos::COS; +use crate::http::MetadataAPIAdapter; use crate::ontime::timer::Timer; +use crate::start_failed_err_info; use async_trait::async_trait; -use log::{debug, info}; +use log::{debug, error, info}; use std::fmt; +use std::fs::{File, OpenOptions}; use std::sync::atomic::Ordering::SeqCst; use std::sync::atomic::{AtomicBool, AtomicU32, AtomicU64, Ordering}; use std::sync::{Arc, Mutex}; @@ -63,9 +69,27 @@ pub trait MyCommand { fn err_info(&self) -> String { self.get_base().err_info() } + fn finish_time(&self) -> u64 { self.get_base().finish_time() } + + fn output_url(&self) -> String { + self.get_base().output_url() + } + + fn output_err_info(&self) -> String { + self.get_base().output_err_info() + } + + fn open_log_file(&self) -> Result { + self.get_base().open_log_file() + } + + fn store_path_check(&self) -> Result<(), String> { + self.get_base().store_path_check() + } + fn debug(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result; fn get_base(&self) -> Arc; } @@ -77,6 +101,10 @@ pub fn new( work_dir: &str, timeout: u64, bytes_max_report: u64, + log_file_path: &str, + cos_bucket: &str, + cos_prefix: &str, + task_id: &str, ) -> Result, String> { match cmd_type { #[cfg(unix)] @@ -86,6 +114,10 @@ pub fn new( work_dir, timeout, bytes_max_report, + log_file_path, + cos_bucket, + cos_prefix, + task_id, ))), #[cfg(windows)] CMD_TYPE_POWERSHELL => Ok(Box::new(PowerShellCommand::new( @@ -94,6 +126,10 @@ pub fn new( work_dir, timeout, bytes_max_report, + log_file_path, + cos_bucket, + cos_prefix, + task_id, ))), _ => Err(format!("invalid cmd_type:{}", cmd_type)), } @@ -125,6 +161,15 @@ pub struct BaseCommand { // current output report index pub output_idx: AtomicU32, + pub log_file_path: String, + // bucket url where store the complete output. + pub cos_bucket: String, + pub cos_prefix: String, + pub task_id: String, + + pub output_url: Mutex, + pub output_err_info: Mutex, + // it's None before start, will be Some after self.run() pub pid: Mutex>, // if child has been killed by kill -9 @@ -146,6 +191,10 @@ impl BaseCommand { work_dir: &str, timeout: u64, bytes_max_report: u64, + log_file_path: &str, + cos_bucket: &str, + cos_prefix: &str, + task_id: &str, ) -> BaseCommand { let timestamp = SystemTime::now() .duration_since(SystemTime::UNIX_EPOCH) @@ -163,6 +212,12 @@ impl BaseCommand { exit_code: Arc::new(Mutex::new(None)), output: Arc::new(Mutex::new(Default::default())), output_idx: AtomicU32::new(0), + log_file_path: log_file_path.to_string(), + cos_bucket: cos_bucket.to_string(), + cos_prefix: cos_prefix.to_string(), + task_id: task_id.to_string(), + output_url: Mutex::new("".to_string()), + output_err_info: Mutex::new("".to_string()), pid: Mutex::new(None), killed: Arc::new(AtomicBool::new(false)), is_timeout: Arc::new(AtomicBool::new(false)), @@ -310,6 +365,16 @@ impl BaseCommand { self.finish_time.load(Ordering::SeqCst) } + pub fn output_url(&self) -> String { + let output_url = self.output_url.lock().unwrap(); + return String::from(output_url.as_str()); + } + + pub fn output_err_info(&self) -> String { + let err_info = self.output_err_info.lock().unwrap(); + return String::from(err_info.as_str()); + } + pub fn add_timeout_timer(&self) { let pid = self.pid.lock().unwrap().unwrap(); let timeout = self.timeout; @@ -396,6 +461,108 @@ impl BaseCommand { } } + fn store_path_check(&self) -> Result<(), String> { + if self.cmd_path.is_empty() { + let ret = format!("start fail because script file store failed."); + *self.err_info.lock().unwrap() = + start_failed_err_info!(ERR_SCRIPT_FILE_STORE_FAILED, TASK_STORE_PATH); + return Err(ret); + } + if self.log_file_path.is_empty() { + let ret = format!("start fail because log file store failed."); + *self.err_info.lock().unwrap() = + start_failed_err_info!(ERR_LOG_FILE_STORE_FAILED, TASK_LOG_PATH); + return Err(ret); + } + Ok(()) + } + + fn open_log_file(&self) -> Result { + let res = OpenOptions::new() + .write(true) + .open(self.log_file_path.clone()); + match res { + Ok(file) => Ok(file), + Err(e) => Err(format!( + "fail to open task log file {}: {:?}", + self.log_file_path, e + )), + } + } + + pub async fn finish_logging(&self) { + let log_file_path = self.log_file_path.to_string(); + if !self.cos_bucket.is_empty() { + let metadata = MetadataAPIAdapter::build(METADATA_API); + let rsp = metadata.tmp_credential().await; + match rsp { + Ok(credential) => { + let cli = COS::new( + credential.secret_id, + credential.secret_key, + credential.token, + self.cos_bucket.to_string(), + ); + let instance_id = metadata.instance_id().await; + let object_name = + self.object_name(&*self.cos_prefix, instance_id.as_str(), &*self.task_id); + if let Err(e) = cli + .put_object_from_file(log_file_path.clone(), object_name.clone(), None) + .await + { + error!("pub object to cos fail: {:?}", e); + *self.output_err_info.lock().unwrap() = format!("Upload output file to cos fail, please check if {} has permission to put file to COS: output file: {}, bucket: {}, prefix: {}", + instance_id.as_str(), + self.log_file_path, + self.cos_bucket, + self.cos_prefix, + ); + } + + *self.output_url.lock().unwrap() = self.set_output_url(instance_id.as_str()); + } + Err(e) => *self.output_err_info.lock().unwrap() = e.to_string(), + } + } + + // delete task output file. + if let Err(e) = std::fs::remove_file(log_file_path.clone()) { + error!("cleanup task output file fail: {}, {:?}", log_file_path, e) + } + } + + pub fn set_output_url(&self, instance_id: &str) -> String { + let output_err_info = self.output_err_info.lock().unwrap_or_exit("lock fail"); + if !output_err_info.is_empty() { + return "".to_string(); + } + + if self.cos_bucket.is_empty() { + return "".to_string(); + } + + let arr = vec![ + self.cos_bucket.to_string(), + self.cos_prefix.to_string(), + instance_id.to_string(), + format!("{}.log", self.task_id.to_string()), + ]; + let x: Vec = arr.into_iter().filter(|x| !x.is_empty()).collect(); + x.join("/") + } + + fn object_name(&self, cos_bucket_prefix: &str, instance_id: &str, task_id: &str) -> String { + let mut object_name = format!(""); + if !cos_bucket_prefix.is_empty() { + object_name.push_str(format!("/{}", cos_bucket_prefix).as_str()) + } + if !instance_id.is_empty() { + object_name.push_str(format!("/{}", instance_id).as_str()) + } + object_name.push_str(format!("/{}.log", task_id).as_str()); + object_name + } + pub fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { let output_clone; { @@ -421,6 +588,9 @@ impl BaseCommand { .field("killed", &self.killed) .field("is_timeout", &self.is_timeout) .field("finish_time", &self.finish_time) + .field("cos_bucket", &self.cos_bucket) + .field("cos_prefix", &self.cos_prefix) + .field("task_id", &self.task_id) .finish() } } @@ -472,14 +642,36 @@ mod tests { #[test] fn test_valid_type_shell() { - let ret = new(CMD_PATH, &username(), CMD_TYPE, "./", 1024, 1024); + let ret = new( + CMD_PATH, + &username(), + CMD_TYPE, + "./", + 1024, + 1024, + "", + "", + "", + "", + ); assert!(ret.is_ok()); } #[test] fn test_invalid_type() { init_log(); - let ret = new(CMD_PATH, &username(), "xxx", "./", 1024, 1024); + let ret = new( + CMD_PATH, + &username(), + "xxx", + "./", + 1024, + 1024, + "", + "", + "", + "", + ); match ret { Ok(_) => panic!(), Err(e) => info!("OK, ret:{}", e), @@ -492,7 +684,20 @@ mod tests { rt.block_on(async { init_log(); // it doesn't matter even if ./a.sh not exist - let ret = new(CMD_PATH, &username(), CMD_TYPE, "./", 1024, 1024); + let log_path = format!("./{}.log", gen_rand_str()); + File::create(log_path.as_str()).unwrap_or_exit("create log path fail."); + let ret = new( + CMD_PATH, + &username(), + CMD_TYPE, + "./", + 1024, + 1024, + log_path.as_str(), + "", + "", + "", + ); let mut cmd = ret.unwrap(); let ret = cmd.run().await; assert!(ret.is_ok()); @@ -516,6 +721,10 @@ mod tests { "./dir_not_exist", 1024, 1024, + "./fake_path", + "", + "", + "", ); let mut cmd = ret.unwrap(); let ret = cmd.run().await; @@ -534,7 +743,18 @@ mod tests { rt.block_on(async { init_log(); - let ret = new(CMD_PATH, "hacker-neo", CMD_TYPE, "./", 1024, 1024); + let ret = new( + CMD_PATH, + "hacker-neo", + CMD_TYPE, + "./", + 1024, + 1024, + "./fake_path", + "", + "", + "", + ); let mut cmd = ret.unwrap(); let ret = cmd.run().await; info!("cmd run ret:[{}]", ret.unwrap_err()); @@ -617,7 +837,20 @@ mod tests { } } - let ret = new(filename.as_str(), &username(), CMD_TYPE, "./", 1024, 1024); + let log_path = format!("./{}.log", gen_rand_str()); + File::create(log_path.as_str()).unwrap_or_exit("create log path fail."); + let ret = new( + filename.as_str(), + &username(), + CMD_TYPE, + "./", + 1024, + 1024, + log_path.as_str(), + "", + "", + "", + ); let mut cmd = ret.unwrap(); let ret = cmd.run().await; assert!(ret.is_ok()); @@ -665,7 +898,20 @@ mod tests { } } - let ret = new(filename.as_str(), &username(), CMD_TYPE, "./", 1024, 18); + let log_path = format!("./{}.log", gen_rand_str()); + File::create(log_path.as_str()).unwrap_or_exit("create log path fail."); + let ret = new( + filename.as_str(), + &username(), + CMD_TYPE, + "./", + 1024, + 18, + log_path.as_str(), + "", + "", + "", + ); let mut cmd = ret.unwrap(); let ret = cmd.run().await; assert!(ret.is_ok()); @@ -743,7 +989,20 @@ mod tests { ); } } - let ret = new(filename.as_str(), &username(), CMD_TYPE, "./", 10, 1024); + let log_path = format!("./{}.log", gen_rand_str()); + File::create(log_path.as_str()).unwrap_or_exit("create log path fail."); + let ret = new( + filename.as_str(), + &username(), + CMD_TYPE, + "./", + 10, + 1024, + log_path.as_str(), + "", + "", + "", + ); let mut cmd = ret.unwrap(); let ret = cmd.run().await; assert!(ret.is_ok()); @@ -780,7 +1039,7 @@ mod tests { cfg_if::cfg_if! { if #[cfg(unix)] { let filename = format!("./.{}.sh", gen_rand_str()); - create_file("sleep 10240", filename.as_str()); + create_file("pwd && sleep 10240", filename.as_str()); } else if #[cfg(windows)] { let filename = format!("./{}.ps1", gen_rand_str()); create_file( @@ -795,8 +1054,20 @@ mod tests { .unwrap() .as_secs(); info!("start_time:{}", start_time); - - let ret = new(filename.as_str(), &username(), CMD_TYPE, "./", 2, 1024); + let log_path = format!("./{}.log", gen_rand_str()); + File::create(log_path.as_str()).unwrap_or_exit("create log path fail."); + let ret = new( + filename.as_str(), + &username(), + CMD_TYPE, + "./", + 2, + 1024, + log_path.as_str(), + "", + "", + "", + ); let mut cmd = ret.unwrap(); let ret = cmd.run().await; assert!(ret.is_ok()); @@ -844,7 +1115,20 @@ mod tests { let filename = format!("./.{}.sh", gen_rand_str()); create_file("echo 'hello world'\nsleep 10 &\ndate", filename.as_str()); - let ret = new(filename.as_str(), &username(), CMD_TYPE, "./", 6, 1024); + let log_path = format!("./{}.log", gen_rand_str()); + File::create(log_path.as_str()).unwrap_or_exit("create log path fail."); + let ret = new( + filename.as_str(), + &username(), + CMD_TYPE, + "./", + 6, + 1024, + log_path.as_str(), + "", + "", + "", + ); let mut cmd = ret.unwrap(); let ret = cmd.run().await; assert!(ret.is_ok()); @@ -882,7 +1166,20 @@ mod tests { filename.as_str(), ); - let ret = new(filename.as_str(), &username(), CMD_TYPE, "./", 1200, 10240); + let log_path = format!("./{}.log", gen_rand_str()); + File::create(log_path.as_str()).unwrap_or_exit("create log path fail."); + let ret = new( + filename.as_str(), + &username(), + CMD_TYPE, + "./", + 1200, + 10240, + log_path.as_str(), + "", + "", + "", + ); let mut cmd = ret.unwrap(); let ret = cmd.run().await; assert!(ret.is_ok()); diff --git a/src/executor/shell_command.rs b/src/executor/shell_command.rs index 0455e67..485db8d 100644 --- a/src/executor/shell_command.rs +++ b/src/executor/shell_command.rs @@ -1,5 +1,7 @@ use std::env; use std::fmt::Debug; +use std::fs::File; +use std::io::Write; use std::path::Path; use std::process::Stdio; use std::sync::Arc; @@ -15,7 +17,7 @@ use tokio::time::timeout; use users::get_user_by_name; use crate::common::asserts::GracefulUnwrap; -use crate::common::consts::{DUP2_1_2, OWN_PROCESS_GROUP, TASK_STORE_PATH,PIPE_BUF_DEFAULT_SIZE}; +use crate::common::consts::{DUP2_1_2, OWN_PROCESS_GROUP, PIPE_BUF_DEFAULT_SIZE}; use crate::executor::proc::{BaseCommand, MyCommand}; use crate::start_failed_err_info; @@ -29,6 +31,10 @@ impl ShellCommand { work_dir: &str, timeout: u64, bytes_max_report: u64, + log_file_path: &str, + cos_bucket: &str, + cos_prefix: &str, + task_id: &str, ) -> ShellCommand { ShellCommand { base: Arc::new(BaseCommand::new( @@ -37,20 +43,14 @@ impl ShellCommand { work_dir, timeout, bytes_max_report, + log_file_path, + cos_bucket, + cos_prefix, + task_id, )), } } - fn cmd_path_check(&self) -> Result<(), String> { - if self.base.cmd_path.is_empty() { - let ret = format!("ShellCommand start fail because script file store failed."); - *self.base.err_info.lock().unwrap() = - start_failed_err_info!(ERR_SCRIPT_FILE_STORE_FAILED, TASK_STORE_PATH); - return Err(ret); - } - Ok(()) - } - fn sudo_check(&self) -> Result<(), String> { if !cmd_exists("sudo") { let ret = format!( @@ -144,7 +144,7 @@ impl ShellCommand { impl MyCommand for ShellCommand { async fn run(&mut self) -> Result<(), String> { // pre check before spawn cmd - self.cmd_path_check()?; + self.store_path_check()?; self.sudo_check()?; @@ -154,6 +154,8 @@ impl MyCommand for ShellCommand { self.work_dir_permission_check()?; + let log_file = self.open_log_file()?; + // start the process async let mut child = self.prepare_cmd().spawn().map_err(|e| { *self.base.err_info.lock().unwrap() = e.to_string(); @@ -168,7 +170,7 @@ impl MyCommand for ShellCommand { // async read output. tokio::spawn(async move { base.add_timeout_timer(); - base.read_shl_output(&mut child).await; + base.read_shl_output(&mut child, log_file).await; base.del_timeout_timer(); base.process_finish(&mut child).await; }); @@ -191,7 +193,7 @@ impl Debug for ShellCommand { } impl BaseCommand { - async fn read_shl_output(&self, child: &mut Child) { + async fn read_shl_output(&self, child: &mut Child, mut log_file: File) { let pid = child.id(); const BUF_SIZE: usize = 1024; let mut buffer: [u8; BUF_SIZE] = [0; BUF_SIZE]; @@ -219,6 +221,10 @@ impl BaseCommand { let len = read_size.unwrap(); if len > 0 { + if let Err(e) = log_file.write(&buffer) { + error!("write output file fail: {:?}", e) + } + if process_finish { byte_after_finish = byte_after_finish + len } @@ -245,6 +251,12 @@ impl BaseCommand { break; } } + + if let Err(e) = log_file.sync_all() { + error!("sync in-memory data to file fail: {:?}", e) + } + + self.finish_logging().await; } pub fn kill_process_group(pid: u32) { @@ -258,10 +270,9 @@ impl BaseCommand { } fn is_process_finish(pid: u32) -> bool { - let result = procinfo::pid::stat(pid as i32); - return match result { - Ok(stat) => { - if stat.state == procinfo::pid::State::Zombie { + return match procfs::process::Process::new(pid as i32) { + Ok(proc) => { + if proc.stat.state == 'Z' || proc.stat.state == 'z'{ true } else { false @@ -349,7 +360,7 @@ mod tests { #[test] fn test_fmt_cmd() { - let cmd = ShellCommand::new("./a.sh", "root", "./", 60, 10240); + let cmd = ShellCommand::new("./a.sh", "root", "./", 60, 10240, "", "", "", ""); println!("fmt cmd:{:?}", cmd); } diff --git a/src/http.rs b/src/http.rs index 8df7628..e95b501 100644 --- a/src/http.rs +++ b/src/http.rs @@ -1,9 +1,11 @@ mod invoke_adapter; +mod metadata_adapter; mod requester; pub mod store; pub mod thread; pub use invoke_adapter::InvokeAPIAdapter; +pub use metadata_adapter::MetadataAPIAdapter; pub use requester::HttpRequester; pub use requester::Requester; diff --git a/src/http/invoke_adapter.rs b/src/http/invoke_adapter.rs index dc873bf..3255932 100644 --- a/src/http/invoke_adapter.rs +++ b/src/http/invoke_adapter.rs @@ -3,7 +3,6 @@ use log::{error, info}; use serde::{de::DeserializeOwned, Serialize}; use serde_json::from_str; - use crate::common::consts::{HTTP_REQUEST_NO_RETRIES, HTTP_REQUEST_RETRIES}; use crate::http::{HttpRequester, Requester}; use crate::types::{ @@ -34,9 +33,8 @@ impl InvokeAPIAdapter { pub async fn report_task_start( &self, invocation_task_id: &str, - start_timestamp: u64 + start_timestamp: u64, ) -> Result> { - let req = ReportTaskStartRequest { invocation_task_id: invocation_task_id.to_string(), time_stamp: start_timestamp, @@ -53,6 +51,8 @@ impl InvokeAPIAdapter { exit_code: i32, final_log_index: u32, finish_timestamp: u64, + output_url: &str, + output_err_info: &str, ) -> Result> { let req = ReportTaskFinishRequest { invocation_task_id: invocation_task_id.to_string(), @@ -61,6 +61,8 @@ impl InvokeAPIAdapter { error_info: err_info.to_string(), exit_code, final_log_index, + output_url: output_url.to_string(), + output_error_info: output_err_info.to_string(), }; self.send("ReportTaskFinish", req, HTTP_REQUEST_RETRIES) .await diff --git a/src/http/metadata_adapter.rs b/src/http/metadata_adapter.rs new file mode 100644 index 0000000..0eb4b35 --- /dev/null +++ b/src/http/metadata_adapter.rs @@ -0,0 +1,114 @@ +// 用于封装访问HTTP API的方法 +use log::{error, info}; +use serde_json::from_str; + +use crate::http::{HttpRequester, Requester}; +use crate::types::{GetTmpCredentialResponse, HttpMethod}; + +pub struct MetadataAPIAdapter { + requester: HttpRequester, +} + +const CREDENTIAL_URI: &str = "/latest/meta-data/cam/security-credentials"; +const INSTANCE_ID_URI: &str = "/latest/meta-data/instance-id"; + +impl MetadataAPIAdapter { + pub fn build(url: &str) -> Self { + let mut req = HttpRequester::new(); + req.initialize(url); + MetadataAPIAdapter { requester: req } + } + + pub async fn tmp_credential(&self) -> Result { + let role_name = self.get_role_name().await?; + self.get_tmp_credential(role_name).await + } + + pub async fn instance_id(&self) -> String { + let res = self + .requester + .with_time_out(3) + .with_retrying(2) + .send_request::(HttpMethod::GET, INSTANCE_ID_URI, None) + .await; + match res { + Ok(resp) => match resp.text().await { + Ok(txt) => { + info!("response text {:?}", txt); + txt + } + Err(e) => { + error!("failed to read response {:?}", e); + format!("") + } + }, + Err(e) => { + error!("request error: {:?}", e); + format!("") + } + } + } + + async fn get_role_name(&self) -> Result { + let res = self + .requester + .with_time_out(3) + .with_retrying(2) + .send_request::(HttpMethod::GET, CREDENTIAL_URI, None) + .await; + match res { + Ok(resp) => match resp.text().await { + Ok(txt) => { + info!("response text {:?}", txt); + Ok(txt) + } + Err(e) => { + error!("failed to read response {:?}", e); + Err(format!("Get CAM role of instance failed.")) + } + }, + Err(e) => { + error!("request error: {:?}", e); + Err(format!("Get CAM role of instance failed.")) + } + } + } + + async fn get_tmp_credential( + &self, + role_name: String, + ) -> Result { + let url = format!("{}/{}", CREDENTIAL_URI, role_name); + let res = self + .requester + .with_time_out(3) + .with_retrying(2) + .send_request::(HttpMethod::GET, &*url, None) + .await; + match res { + Ok(resp) => { + // let txt = resp.text().await; + match resp.text().await { + Ok(txt) => { + let raw_resp_result: Result = from_str(&txt); + match raw_resp_result { + Ok(raw_resp) => Ok(raw_resp), + Err(e) => { + error!("failed to parse json response {:?}", e); + Err(format!("Get credential of CAM role failed.")) + } + } + } + Err(e) => { + error!("failed to read response {:?}", e); + Err(format!("Get credential of CAM role failed.")) + } + } + } + Err(e) => { + error!("request error: {:?}", e); + Err(format!("Get credential of CAM role failed.")) + } + } + } +} diff --git a/src/http/requester.rs b/src/http/requester.rs index d57a099..07c2741 100644 --- a/src/http/requester.rs +++ b/src/http/requester.rs @@ -3,13 +3,15 @@ use std::time::Duration; use async_std::task; use log::{debug, error, info}; -use reqwest::{Client, ClientBuilder, header, Response}; +use reqwest::{header, Client, ClientBuilder, Response}; use serde::Serialize; use serde_json::to_string; use url::Url; use crate::common::asserts::GracefulUnwrap; -use crate::common::consts::{HTTP_REQUEST_RETRY_INTERVAL, HTTP_REQUEST_TIME_OUT, VIP_HEADER, VPCID_HEADER}; +use crate::common::consts::{ + HTTP_REQUEST_RETRY_INTERVAL, HTTP_REQUEST_TIME_OUT, VIP_HEADER, VPCID_HEADER, +}; use crate::common::envs; use crate::types::{AgentError, AgentErrorCode, HttpMethod}; @@ -32,8 +34,14 @@ impl Requester for HttpRequester { // use for e2e test. let mut headers = header::HeaderMap::new(); if envs::enable_test() { - headers.insert(VPCID_HEADER, header::HeaderValue::from_str(&*envs::test_vpcid()).unwrap()); - headers.insert(VIP_HEADER, header::HeaderValue::from_str(&*envs::test_vip()).unwrap()); + headers.insert( + VPCID_HEADER, + header::HeaderValue::from_str(&*envs::test_vpcid()).unwrap(), + ); + headers.insert( + VIP_HEADER, + header::HeaderValue::from_str(&*envs::test_vip()).unwrap(), + ); } let cli = cli_builder diff --git a/src/http/store.rs b/src/http/store.rs index 9bf20c5..bbb28a7 100644 --- a/src/http/store.rs +++ b/src/http/store.rs @@ -1,4 +1,4 @@ -use log::{error, info}; +use log::info; use std::fs::{create_dir_all, remove_file, File}; use std::io::prelude::*; use std::path::{Path, PathBuf}; @@ -24,6 +24,7 @@ cfg_if::cfg_if! { pub struct TaskFileStore { store_path: PathBuf, prefix: String, + log_path: PathBuf, } impl TaskFileStore { @@ -31,6 +32,7 @@ impl TaskFileStore { let t = TaskFileStore { store_path: Path::new(consts::TASK_STORE_PATH).to_path_buf(), prefix: String::from(consts::TASK_STORE_PREFIX), + log_path: Path::new(consts::TASK_LOG_PATH).to_path_buf(), }; t } @@ -39,6 +41,10 @@ impl TaskFileStore { self.store_path.clone() } + pub fn get_log_path(&self) -> PathBuf { + self.log_path.clone() + } + fn get_suffix(&self, command_type: &String) -> &str { return match command_type.as_str() { consts::CMD_TYPE_SHELL => consts::SUFFIX_SHELL, @@ -48,7 +54,7 @@ impl TaskFileStore { }; } - fn get_task_file_path(&self, t: &InvocationNormalTask) -> PathBuf { + fn gen_task_file_path(&self, t: &InvocationNormalTask) -> PathBuf { // use YYYYmm as task directory name // use random string as postfix let now: DateTime = Local::now(); @@ -67,6 +73,11 @@ impl TaskFileStore { file_path } + pub fn get_task_log_path(&self, t: &InvocationNormalTask) -> PathBuf { + self.get_log_path() + .join(format!("{}.log", t.invocation_task_id)) + } + fn create_file( &self, path: &str, @@ -144,37 +155,27 @@ impl TaskFileStore { Ok(()) } - pub fn store(&self, t: &InvocationNormalTask) -> Option { - let path: &str = &self.get_task_file_path(t).display().to_string(); - info!("save task {} to {}", &t.invocation_task_id, path); + pub fn store(&self, t: &InvocationNormalTask) -> Result<(String, String), String> { + let task_file_path = self.gen_task_file_path(t).display().to_string(); + info!("save task {} to {}", &t.invocation_task_id, task_file_path); - let mut file = match self.create_file(path, true, true) { - Ok(file) => file, - Err(e) => { - error!("cannot create file {:?} error {:?}", path, e); - return None; - } - }; + let task_log_path = self.get_task_log_path(t).display().to_string(); + info!( + "save task {} output to {}", + &t.invocation_task_id, task_log_path + ); - match t.decode_command() { - Ok(s) => { - let task_str = &s; - match file.write_all(task_str.as_bytes()) { - Err(why) => { - error!("couldn't write {}", why); - None - } - Ok(_) => Some(path.to_string()), - } - } - Err(e) => { - info!( - "task {} command decode failed {:?}", - &t.invocation_task_id, e - ); - None - } + // store task file + let mut file = self.create_file(&task_file_path, true, true)?; + let s = t.decode_command()?; + let res = file.write_all(s.as_bytes()); + if res.is_err() { + return Err("fail to store command in task file".to_string()); } + + // create task log file + let _ = self.create_file(&task_log_path, true, false)?; + Ok((task_file_path, task_log_path)) } #[cfg(test)] @@ -206,6 +207,8 @@ mod tests { command: format!("bHMgLWw="), username: format!("root"), working_directory: workdir, + cos_bucket_url: "".to_string(), + cos_bucket_prefix: "".to_string(), }; let store = TaskFileStore::new(); @@ -218,7 +221,7 @@ mod tests { ); assert_eq!( store - .get_task_file_path(&task) + .gen_task_file_path(&task) .as_path() .parent() .unwrap() @@ -227,14 +230,15 @@ mod tests { desired_path ); - let path = store.store(&task).unwrap(); - let contents = read_to_string(&path).unwrap(); + let (task_file, log_path) = store.store(&task).unwrap(); + let contents = read_to_string(&task_file).unwrap(); assert_eq!(contents, "ls -l"); - store.remove(&path); - let paths = read_dir(Path::new(&path).parent().unwrap()).unwrap(); + store.remove(&task_file); + store.remove(&log_path); + let paths = read_dir(Path::new(&task_file).parent().unwrap()).unwrap(); for f in paths { remove_file(f.unwrap().path()).unwrap(); } - remove_dir(Path::new(&path).parent().unwrap()).unwrap(); + remove_dir(Path::new(&task_file).parent().unwrap()).unwrap(); } } diff --git a/src/http/thread.rs b/src/http/thread.rs index 65e8ac7..149cf82 100644 --- a/src/http/thread.rs +++ b/src/http/thread.rs @@ -86,13 +86,13 @@ impl HttpWorker { info!("describe task success: {:?}", resp); for task in resp.invocation_normal_task_set.iter() { match self.task_store.store(&task) { - Some(task_file) => { + Ok((task_file, log_file)) => { // if task is not in command cache, execute it - self.task_execute(task, &task_file).await; + self.task_execute(task, &task_file, &log_file).await; } - None => { + Err(_) => { // script file store failed, reuse this flow to report start failed - self.task_execute(task, "").await; + self.task_execute(task, "", "").await; } } } @@ -186,10 +186,15 @@ impl HttpWorker { // start Command to execute task // upload task log // report task finish - async fn task_execute(&self, task: &InvocationNormalTask, task_file: &str) { + async fn task_execute( + &self, + task: &InvocationNormalTask, + task_file: &str, + task_log_file: &str, + ) { info!("task execute begin: {:?}", task); let task_id = task.invocation_task_id.clone(); - let result = self.create_proc(task_file, task).await; + let result = self.create_proc(task_file, task_log_file, task).await; if result.is_none() { return; } @@ -202,11 +207,13 @@ impl HttpWorker { } let cmd = cmd_arc.lock().await; - //report finish + // report finish let finish_result = cmd.finish_result(); let err_info = cmd.err_info(); let exit_code = cmd.exit_code(); let finish_time = cmd.finish_time(); + let output_url = cmd.output_url(); + let output_err_info = cmd.output_err_info(); self.adapter .report_task_finish( &task_id, @@ -215,6 +222,8 @@ impl HttpWorker { exit_code, final_log_index, finish_time, + &output_url, + &output_err_info, ) .await .map(|_| info!("task_execute report_task_finish {} success", task_id)) @@ -257,7 +266,7 @@ impl HttpWorker { ); } - //report terminated + // report terminated let finish_time = SystemTime::now() .duration_since(SystemTime::UNIX_EPOCH) .unwrap_or_exit("sys time may before 1970") @@ -270,6 +279,8 @@ impl HttpWorker { 0, 0, finish_time, + "", + "", ) .await .map(|_| info!("task_cancel report_task_finish {} success", cancel_task_id)) @@ -307,6 +318,7 @@ impl HttpWorker { async fn create_proc( &self, task_file: &str, + task_log_file: &str, task: &InvocationNormalTask, ) -> Option>>> { let task_id = task.invocation_task_id.clone(); @@ -329,6 +341,12 @@ impl HttpWorker { return None; } + // remove suffix '/' of cos_bucket_prefix if exists. + let cos_bucket_prefix = if let Some(prefix) = task.cos_bucket_prefix.strip_suffix("/") { + prefix + } else { + &task.cos_bucket_prefix + }; let proc_result = proc::new( task_file, &task.username, @@ -336,6 +354,10 @@ impl HttpWorker { &task.working_directory, task.time_out, DEFAULT_OUTPUT_BYTE, + task_log_file, + &task.cos_bucket_url, + cos_bucket_prefix, + &task_id, ); if proc_result.is_err() { return None; @@ -355,6 +377,7 @@ impl HttpWorker { #[cfg(test)] mod tests { + use crate::common::asserts::GracefulUnwrap; use crate::common::consts::FINISH_RESULT_TERMINATED; use crate::common::logger; use crate::executor::proc; @@ -414,6 +437,8 @@ mod tests { command_type: cmd_type.to_string(), username: "root".to_string(), working_directory: "./".to_string(), + cos_bucket_url: "".to_string(), + cos_bucket_prefix: "".to_string(), } } @@ -422,7 +447,7 @@ mod tests { let cmd_type = "SHELL"; #[cfg(windows)] let cmd_type = "POWERSHELL"; - let result = proc::new("", "", cmd_type.as_ref(), "", 10, 1024); + let result = proc::new("", "", cmd_type.as_ref(), "", 10, 1024, "", "", "", ""); Arc::new(Mutex::new(result.unwrap())) } @@ -436,7 +461,9 @@ mod tests { .insert("invt-1111".to_string(), fake_command()); let task = build_invocation("invt-1111", "", 5, "POWERSHELL"); - let result = http_worker.create_proc("/fake_path", &task).await; + let result = http_worker + .create_proc("/fake_path", "/fake_path", &task) + .await; assert_eq!(result.is_none(), true); } @@ -456,7 +483,9 @@ mod tests { let task = build_invocation("invt-1111", "", 5, cmd_type.as_ref()); faux::when!(http_worker.adapter.report_task_start) .then_return(Err(AgentError::new(AgentErrorCode::ResponseReadError, ""))); - let result = http_worker.create_proc("/fake_path", &task).await; + let result = http_worker + .create_proc("/fake_path", "/fake_path", &task) + .await; assert_eq!(result.is_none(), true); } @@ -481,7 +510,9 @@ mod tests { faux::when!(http_worker.adapter.report_task_start) .then_return(Ok(ReportTaskStartResponse {})); - let result = http_worker.create_proc(filename.as_str(), &task).await; + let result = http_worker + .create_proc(filename.as_str(), "/fake_path", &task) + .await; fs::remove_file(filename.as_str()).unwrap(); assert_eq!(result.is_some(), true); assert_eq!( @@ -504,7 +535,7 @@ mod tests { #[cfg(windows)] let cmd_type = "POWERSHELL"; let task = build_invocation("invt-1133", "", 5, cmd_type); - let create_fut = http_worker.create_proc("", &task); + let create_fut = http_worker.create_proc("", "/fake_path", &task); let time_out = timeout(Duration::from_secs(1), create_fut).await; assert_eq!(time_out.is_err(), true); } @@ -546,8 +577,10 @@ mod tests { faux::when!(http_worker.adapter.report_task_finish) .then_return(Ok(ReportTaskFinishResponse {})); + let log_path = format!("./{}.log", gen_rand_str()); + File::create(log_path.as_str()).unwrap_or_exit("create log path fail."); let cmd = http_worker - .create_proc(filename.as_str(), &task) + .create_proc(filename.as_str(), log_path.as_str(), &task) .await .unwrap(); assert_eq!(cmd.lock().await.is_started(), true); diff --git a/src/lib.rs b/src/lib.rs index ef030c6..39c9dac 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -6,3 +6,4 @@ pub mod ws; pub mod executor; pub mod uname; pub mod daemonizer; +pub mod cos; diff --git a/src/main.rs b/src/main.rs index 0782b7a..4a1ffeb 100644 --- a/src/main.rs +++ b/src/main.rs @@ -4,13 +4,14 @@ use std::sync::mpsc::channel; use std::sync::Arc; mod common; +mod cos; +mod daemonizer; mod executor; mod http; mod ontime; mod types; -mod ws; mod uname; -mod daemonizer; +mod ws; use crate::common::asserts::GracefulUnwrap; use crate::common::consts::AGENT_VERSION; @@ -23,9 +24,8 @@ use crate::ws::thread as ws_thread; #[tokio::main] async fn main() { - let _opts = Opts::get_opts(); - daemonizer::daemonize(||{ + daemonizer::daemonize(|| { // log init after daemonized, so log dir will at same dir of agent logger::init(); info!("agent version:[{}]", AGENT_VERSION); @@ -35,8 +35,7 @@ async fn main() { let (ws_kick_sender, kick_receiver) = channel(); let ontime_kick_sender = ws_kick_sender.clone(); - let (ping_channel_sender, - ping_channel_receiver) = channel(); + let (ping_channel_sender, ping_channel_receiver) = channel(); let running_task_num = Arc::new(AtomicU64::new(0)); @@ -46,8 +45,8 @@ async fn main() { ontime_kick_sender, running_task_num.clone(), ); - // - // // http thread recv the notify + + // http thread recv the notify let _h_thread = http_thread::run(kick_receiver, running_task_num.clone()); loop { diff --git a/src/types.rs b/src/types.rs index a86060d..1392f06 100644 --- a/src/types.rs +++ b/src/types.rs @@ -1,6 +1,7 @@ /* 声明内部模块 */ mod common; mod error; +mod metadata; mod task; pub mod inner_msg; @@ -10,6 +11,7 @@ pub mod ws_msg; pub use common::HttpMethod; pub use error::AgentError; pub use error::AgentErrorCode; +pub use metadata::GetTmpCredentialResponse; pub use task::{ AgentRequest, CheckUpdateRequest, CheckUpdateResponse, DescribeTasksRequest, DescribeTasksResponse, ReportTaskFinishRequest, ReportTaskFinishResponse, diff --git a/src/types/metadata.rs b/src/types/metadata.rs new file mode 100644 index 0000000..d7b7c25 --- /dev/null +++ b/src/types/metadata.rs @@ -0,0 +1,20 @@ +use serde::{Deserialize, Serialize}; + +#[derive(Serialize, Deserialize, Debug, Clone)] +#[serde(rename_all = "PascalCase")] +pub struct GetTmpCredentialResponse { + #[serde(alias = "TmpSecretId")] + #[serde(default)] + pub secret_id: String, + #[serde(alias = "TmpSecretKey")] + #[serde(default)] + pub secret_key: String, + #[serde(default)] + pub expire_time: i64, + #[serde(default)] + pub expiration: String, + #[serde(default)] + pub token: String, + #[serde(default)] + pub code: String, +} diff --git a/src/types/task.rs b/src/types/task.rs index e4c4b6e..ca0c254 100644 --- a/src/types/task.rs +++ b/src/types/task.rs @@ -1,9 +1,9 @@ -use serde::{Deserialize, Serialize}; use crate::common::consts::AGENT_VERSION; use crate::types::AgentErrorCode; +use serde::{Deserialize, Serialize}; -use crate::uname::Uname; use crate::uname::common::UnameExt; +use crate::uname::Uname; //============================================================================== // Declare standard request and response format for C/S communication @@ -133,6 +133,12 @@ pub struct InvocationNormalTask { pub username: String, #[serde(default)] pub working_directory: String, + #[serde(alias = "OutputCOSBucketUrl")] + #[serde(default)] + pub cos_bucket_url: String, + #[serde(alias = "OutputCOSKeyPrefix")] + #[serde(default)] + pub cos_bucket_prefix: String, } #[derive(Serialize, Deserialize, Debug, Clone)] @@ -193,6 +199,11 @@ pub struct ReportTaskFinishRequest { pub exit_code: i32, #[serde(default)] pub final_log_index: u32, + #[serde(default)] + pub output_url: String, + #[serde(rename = "OutputUploadCOSErrorInfo")] + #[serde(default)] + pub output_error_info: String, } pub type ReportTaskFinishResponse = Empty; @@ -292,19 +303,21 @@ mod tests { bar: String, names: Vec, } - let i = Inner{ count: 3}; - let f = Foo{ + let i = Inner { count: 3 }; + let f = Foo { inner: i, bar: String::from("woo"), names: vec!["jack".to_string(), "john".to_string(), "ken".to_string()], }; let res = serde_json::to_string(&f).unwrap(); - assert_eq!(res, "{\"count\":3,\"bar\":\"woo\",\"names\":[\"jack\",\"john\",\"ken\"]}"); + assert_eq!( + res, + "{\"count\":3,\"bar\":\"woo\",\"names\":[\"jack\",\"john\",\"ken\"]}" + ); } #[test] fn deserialize_server_response_error() { - let error_str = " { \"Response\": { @@ -322,7 +335,10 @@ mod tests { } let raw_resp = serde_json::from_str::>(&error_str).unwrap(); let general_resp = &raw_resp.response; - assert_eq!(&general_resp.request_id, "e8fc76bf-ed90-4f38-a871-4f344d35d5ff"); + assert_eq!( + &general_resp.request_id, + "e8fc76bf-ed90-4f38-a871-4f344d35d5ff" + ); let error = &general_resp.error.as_ref().unwrap(); assert_eq!(&error.code, "ExampleCode"); assert_eq!(&error.message, "Some message"); @@ -331,7 +347,7 @@ mod tests { } #[test] - fn deserialize_server_response_content() { + fn deserialize_server_response_content() { let resp_str = " { \"Response\": { @@ -363,7 +379,10 @@ mod tests { } let raw_resp = serde_json::from_str::>(&resp_str).unwrap(); let general_resp = &raw_resp.response; - assert_eq!(&general_resp.request_id, "aee1c4f7-c782-45b7-b81b-9cea73448a31"); + assert_eq!( + &general_resp.request_id, + "aee1c4f7-c782-45b7-b81b-9cea73448a31" + ); let content = general_resp.content.as_ref().unwrap(); assert_eq!(content.user_set.len(), 2); assert_eq!(&content.user_set[0].name, "Foo"); @@ -378,7 +397,9 @@ mod tests { time_out: 0, command: String::from("bHMgLWw7CmVjaG8gIkhlbGxvIFdvcmxkIg=="), username: format!("root"), - working_directory: format!("") + working_directory: format!(""), + cos_bucket_url: format!(""), + cos_bucket_prefix: format!(""), }; assert_eq!( tasks1.decode_command().unwrap(), @@ -394,41 +415,38 @@ mod tests { time_out: 0, command: String::from("ls -l;\necho \"Hello World\""), username: format!("root"), - working_directory: format!("") + working_directory: format!(""), + cos_bucket_url: format!(""), + cos_bucket_prefix: format!(""), }; - assert_eq!( - tasks1.decode_command().is_err(), - true - ); + assert_eq!(tasks1.decode_command().is_err(), true); } #[cfg(target_family = "unix")] #[test] fn test_encode_log() { - use std::process::Command; use std::fs::remove_file; - use std::io::Read; use std::fs::File; + use std::io::Read; + use std::process::Command; use crate::types::UploadTaskLogRequest; let _cmd = Command::new("time") - .arg("dd") - .arg("if=/dev/urandom") - .arg("of=random-file") - .arg("bs=1").arg("count=1024") - .output().expect("failed to generate random binary file"); + .arg("dd") + .arg("if=/dev/urandom") + .arg("of=random-file") + .arg("bs=1") + .arg("count=1024") + .output() + .expect("failed to generate random binary file"); // read binary file let mut f = File::open("./random-file").unwrap(); let mut buffer = Vec::new(); // read the whole file - f.read_to_end(&mut buffer).expect("failed to read random-file"); + f.read_to_end(&mut buffer) + .expect("failed to read random-file"); assert_eq!(remove_file("./random-file").is_ok(), true); - let _req = UploadTaskLogRequest::new( - "invk-123123", - 0, - buffer, - 0 - ); + let _req = UploadTaskLogRequest::new("invk-123123", 0, buffer, 0); // println!("{:?}", req); } } diff --git a/tests/http_test.rs b/tests/http_test.rs index 3d9a6a3..7751f56 100644 --- a/tests/http_test.rs +++ b/tests/http_test.rs @@ -2,9 +2,9 @@ extern crate tat_agent; mod support; -use support::server; -use std::thread; use std::sync::Once; +use std::thread; +use support::server; use tat_agent::common::consts; @@ -36,11 +36,13 @@ async fn test_report_task_start() { use tat_agent::common::asserts::GracefulUnwrap; initialize(); let adapter = tat_agent::http::InvokeAPIAdapter::build(consts::MOCK_INVOKE_API); - let start_timestamp = SystemTime::now().duration_since( - SystemTime::UNIX_EPOCH - ).unwrap_or_exit("sys time may before 1970").as_secs(); - let resp = - adapter.report_task_start("invt-12345678", start_timestamp).await; + let start_timestamp = SystemTime::now() + .duration_since(SystemTime::UNIX_EPOCH) + .unwrap_or_exit("sys time may before 1970") + .as_secs(); + let resp = adapter + .report_task_start("invt-12345678", start_timestamp) + .await; assert_eq!(true, resp.is_ok()); } @@ -50,7 +52,12 @@ async fn test_upload_task_log() { initialize(); let adapter = tat_agent::http::InvokeAPIAdapter::build(consts::MOCK_INVOKE_API); let resp = adapter - .upload_task_log("invk-12345678", 1, "some output info".as_bytes().to_vec(), 0) + .upload_task_log( + "invk-12345678", + 1, + "some output info".as_bytes().to_vec(), + 0, + ) .await; assert_eq!(true, resp.is_ok()); } @@ -61,7 +68,7 @@ async fn test_report_task_finish() { initialize(); let adapter = tat_agent::http::InvokeAPIAdapter::build(consts::MOCK_INVOKE_API); let resp = adapter - .report_task_finish("invk-12345678", "some output info", "", 0, 1, 0) + .report_task_finish("invk-12345678", "some output info", "", 0, 1, 0, "", "") .await; assert_eq!(true, resp.is_ok()); } @@ -74,14 +81,17 @@ async fn test_check_update() { let resp = resp.await.unwrap(); assert_eq!(true, resp.need_update()); assert_eq!("http://example.com", resp.download_url().clone().unwrap()); - assert_eq!("eeb0248363b2e9b66f975abd4f092db8", resp.md5().clone().unwrap()); + assert_eq!( + "eeb0248363b2e9b66f975abd4f092db8", + resp.md5().clone().unwrap() + ); } #[tokio::test(basic_scheduler)] async fn test_process_msg() { + use std::sync::{atomic::AtomicU64, Arc}; use tat_agent::http::thread::HttpWorker; use tat_agent::types::inner_msg::KickMsg; - use std::sync::{Arc, atomic::AtomicU64}; initialize(); let adapter = tat_agent::http::InvokeAPIAdapter::build(consts::MOCK_INVOKE_API); let worker = HttpWorker::new(adapter, Arc::new(AtomicU64::new(0))); @@ -90,4 +100,3 @@ async fn test_process_msg() { }; worker.process(msg).await; } -